linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings
@ 2025-08-22  8:20 Muhammad Usama Anjum
  2025-08-22  8:20 ` [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings Muhammad Usama Anjum
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:20 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

Recently, I reviewed a patch on the mm/kselftest mailing list about a
test which had obvious type mismatch fix in it. It was strange why that
wasn't caught during development and when patch was accepted. This led
me to discover that those extra compiler options to catch these warnings
aren't being used. When I added them, I found tens of warnings in just
mm suite.

In this series, I'm adding these flags and fixing those warnings. In the
last try several months ago [1], I'd patches for individual tests. I've
made patches better by grouping the same type of fixes together. Hence
there is no changelog for individual patches.

The changes have been build tested on x86_64, arm64, powerpc64 and
partially
on riscv64. The test run with and without this series has been done on
x86_64.

---
Changes since v1:
- Drop test harness patch which isn't needed anymore
- Revamp how patches are written per same kind of failure

Changes since v2:
- split_huge_page_test.c: better deadcode removal
- Drop -Wunused-parameter flag as kernel also doesn't enable it and it
  causes too much hassle
- Drop previous patches 6 and 7 as they are just marking unused parameters
  with unused flag
- Rename __unused to __always_unused and also add __maybe_unused

Muhammad Usama Anjum (8):
  selftests/mm: Add -Wunreachable-code and fix warnings
  selftests/mm: protection_keys: Fix dead code
  selftests: kselftest.h: Add unused macro
  selftests/mm: Add -Wunused family of flags
  selftests/mm: Remove unused parameters
  selftests/mm: Fix unused parameter warnings for different
    architectures
  selftests/mm: mark variable unused with macro
  selftests/mm: pkey-helpers: Remove duplicate __maybe_unused

 tools/testing/selftests/kselftest.h           |  8 ++++++
 tools/testing/selftests/mm/Makefile           |  2 +-
 tools/testing/selftests/mm/compaction_test.c  |  2 +-
 tools/testing/selftests/mm/cow.c              |  2 +-
 tools/testing/selftests/mm/droppable.c        |  2 +-
 tools/testing/selftests/mm/gup_longterm.c     |  2 +-
 tools/testing/selftests/mm/hmm-tests.c        |  5 ++--
 tools/testing/selftests/mm/hugepage-vmemmap.c |  2 +-
 tools/testing/selftests/mm/hugetlb-madvise.c  |  2 +-
 .../selftests/mm/hugetlb-soft-offline.c       |  2 +-
 tools/testing/selftests/mm/ksm_tests.c        | 17 ++++++-------
 tools/testing/selftests/mm/madv_populate.c    |  2 +-
 tools/testing/selftests/mm/map_populate.c     |  2 +-
 tools/testing/selftests/mm/memfd_secret.c     |  2 +-
 .../testing/selftests/mm/mlock-random-test.c  |  2 +-
 tools/testing/selftests/mm/mlock2-tests.c     |  2 +-
 tools/testing/selftests/mm/mseal_test.c       |  8 ++++--
 tools/testing/selftests/mm/on-fault-limit.c   |  2 +-
 tools/testing/selftests/mm/pkey-helpers.h     |  3 ---
 .../selftests/mm/pkey_sighandler_tests.c      | 25 +++++++++++++++----
 tools/testing/selftests/mm/protection_keys.c  |  6 ++---
 tools/testing/selftests/mm/soft-dirty.c       |  6 ++---
 .../selftests/mm/split_huge_page_test.c       |  2 +-
 tools/testing/selftests/mm/uffd-common.c      |  4 +--
 tools/testing/selftests/mm/uffd-common.h      |  2 +-
 tools/testing/selftests/mm/uffd-stress.c      |  2 +-
 tools/testing/selftests/mm/uffd-unit-tests.c  |  8 +++---
 tools/testing/selftests/mm/uffd-wp-mremap.c   |  2 +-
 .../selftests/mm/virtual_address_range.c      |  2 +-
 29 files changed, 73 insertions(+), 55 deletions(-)

-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
@ 2025-08-22  8:20 ` Muhammad Usama Anjum
  2025-08-22 17:08   ` Zi Yan
  2025-08-26  8:33   ` Kevin Brodsky
  2025-08-22  8:20 ` [PATCH v3 2/8] selftests/mm: protection_keys: Fix dead code Muhammad Usama Anjum
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:20 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel, Sidhartha Kumar

Enable -Wunreachable-code flag to catch dead code and fix them.

1. Remove the dead code and write a comment instead:
hmm-tests.c:2033:3: warning: code will never be executed
[-Wunreachable-code]
                perror("Should not reach this\n");
                ^~~~~~

2. ksft_exit_fail_msg() calls exit(). Remove the dead code.
split_huge_page_test.c:301:3: warning: code will never be executed
[-Wunreachable-code]
                goto cleanup;
                ^~~~~~~~~~~~

3. Remove duplicate inline.
pkey_sighandler_tests.c:44:15: warning: duplicate 'inline' declaration
specifier [-Wduplicate-decl-specifier]
static inline __always_inline

Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v2:
- In split_huge_page_test.c, print error message and then go to cleanup
  tag for cleanup instead of just exiting without cleanup
---
 tools/testing/selftests/mm/Makefile                | 1 +
 tools/testing/selftests/mm/hmm-tests.c             | 5 ++---
 tools/testing/selftests/mm/pkey_sighandler_tests.c | 2 +-
 tools/testing/selftests/mm/split_huge_page_test.c  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index d13b3cef2a2b2..23d4bf6215465 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -34,6 +34,7 @@ endif
 MAKEFLAGS += --no-builtin-rules
 
 CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
+CFLAGS += -Wunreachable-code
 LDLIBS = -lrt -lpthread -lm
 
 # Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c
index 141bf63cbe05e..15aadaf24a667 100644
--- a/tools/testing/selftests/mm/hmm-tests.c
+++ b/tools/testing/selftests/mm/hmm-tests.c
@@ -2027,11 +2027,10 @@ TEST_F(hmm, hmm_cow_in_device)
 	if (pid == -1)
 		ASSERT_EQ(pid, 0);
 	if (!pid) {
-		/* Child process waitd for SIGTERM from the parent. */
+		/* Child process waits for SIGTERM from the parent. */
 		while (1) {
 		}
-		perror("Should not reach this\n");
-		exit(0);
+		/* Should not reach this */
 	}
 	/* Parent process writes to COW pages(s) and gets a
 	 * new copy in system. In case of device private pages,
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index b5e076a564c95..302fef54049c8 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -41,7 +41,7 @@ static siginfo_t siginfo = {0};
  * syscall will attempt to access the PLT in order to call a library function
  * which is protected by MPK 0 which we don't have access to.
  */
-static inline __always_inline
+static __always_inline
 long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
 {
 	unsigned long ret;
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index bf40e6b121abc..de0d26f3df675 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -297,7 +297,7 @@ void split_file_backed_thp(int order)
 
 	status = snprintf(testfile, INPUT_MAX, "%s/thp_file", tmpfs_loc);
 	if (status >= INPUT_MAX) {
-		ksft_exit_fail_msg("Fail to create file-backed THP split testing file\n");
+		ksft_print_msg("Fail to create file-backed THP split testing file\n");
 		goto cleanup;
 	}
 
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 2/8] selftests/mm: protection_keys: Fix dead code
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
  2025-08-22  8:20 ` [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings Muhammad Usama Anjum
@ 2025-08-22  8:20 ` Muhammad Usama Anjum
  2025-08-22 17:11   ` Zi Yan
  2025-08-22  8:21 ` [PATCH v3 3/8] selftests: kselftest.h: Add unused macro Muhammad Usama Anjum
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:20 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel, Sidhartha Kumar

The while loop doesn't execute and following warning gets generated:

protection_keys.c:561:15: warning: code will never be executed
[-Wunreachable-code]
                int rpkey = alloc_random_pkey();

Let's enable the while loop such that it gets executed nr_iterations
times. Simplify the code a bit as well.

Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/mm/protection_keys.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index 23ebec367015f..6281d4c61b50e 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -557,13 +557,11 @@ int mprotect_pkey(void *ptr, size_t size, unsigned long orig_prot,
 	int nr_iterations = random() % 100;
 	int ret;
 
-	while (0) {
+	while (nr_iterations-- >= 0) {
 		int rpkey = alloc_random_pkey();
 		ret = sys_mprotect_pkey(ptr, size, orig_prot, pkey);
 		dprintf1("sys_mprotect_pkey(%p, %zx, prot=0x%lx, pkey=%ld) ret: %d\n",
 				ptr, size, orig_prot, pkey, ret);
-		if (nr_iterations-- < 0)
-			break;
 
 		dprintf1("%s()::%d, ret: %d pkey_reg: 0x%016llx"
 			" shadow: 0x%016llx\n",
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 3/8] selftests: kselftest.h: Add unused macro
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
  2025-08-22  8:20 ` [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings Muhammad Usama Anjum
  2025-08-22  8:20 ` [PATCH v3 2/8] selftests/mm: protection_keys: Fix dead code Muhammad Usama Anjum
@ 2025-08-22  8:21 ` Muhammad Usama Anjum
  2025-08-22  8:21 ` [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags Muhammad Usama Anjum
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:21 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

Add unused macro instead of using the complete verbose unused compiler
attribute. The raw __attribute__((__unused__)) is quite long and makes
code too much verbose to the kernel developer's taste.

Add always_unused and maybe_unused variants just like kernel itself
have.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v2:
- Add always_unused and maybe_unused instead of __unused macro
---
 tools/testing/selftests/kselftest.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index c3b6d2604b1e4..274480e3573ab 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -92,6 +92,14 @@
 #endif
 #define __printf(a, b)   __attribute__((format(printf, a, b)))
 
+#ifndef __always_unused
+#define __always_unused __attribute__((__unused__))
+#endif
+
+#ifndef __maybe_unused
+#define __maybe_unused __attribute__((__unused__))
+#endif
+
 /* counters */
 struct ksft_count {
 	unsigned int ksft_pass;
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
                   ` (2 preceding siblings ...)
  2025-08-22  8:21 ` [PATCH v3 3/8] selftests: kselftest.h: Add unused macro Muhammad Usama Anjum
@ 2025-08-22  8:21 ` Muhammad Usama Anjum
  2025-08-25 18:21   ` John Hubbard
  2025-08-22  8:21 ` [PATCH v3 5/8] selftests/mm: Remove unused parameters Muhammad Usama Anjum
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:21 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

Add -Wunused flags and fix all the warnings coming because of
argc and argv. Remove them if they aren't being used entirely. Use
unused compiler attribute with argc where argv is being used.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v2:
- Remove -Wunused-parameter
- Remove -Wunused-function -Wunused-label -Wunused-variable
  -Wunused-value as -Wunused mean all of these by default
---
 tools/testing/selftests/mm/Makefile                | 3 +--
 tools/testing/selftests/mm/compaction_test.c       | 2 +-
 tools/testing/selftests/mm/cow.c                   | 2 +-
 tools/testing/selftests/mm/droppable.c             | 2 +-
 tools/testing/selftests/mm/gup_longterm.c          | 2 +-
 tools/testing/selftests/mm/hugepage-vmemmap.c      | 2 +-
 tools/testing/selftests/mm/hugetlb-madvise.c       | 2 +-
 tools/testing/selftests/mm/hugetlb-soft-offline.c  | 2 +-
 tools/testing/selftests/mm/madv_populate.c         | 2 +-
 tools/testing/selftests/mm/map_populate.c          | 2 +-
 tools/testing/selftests/mm/memfd_secret.c          | 2 +-
 tools/testing/selftests/mm/mlock-random-test.c     | 2 +-
 tools/testing/selftests/mm/mlock2-tests.c          | 2 +-
 tools/testing/selftests/mm/on-fault-limit.c        | 2 +-
 tools/testing/selftests/mm/pkey_sighandler_tests.c | 2 +-
 tools/testing/selftests/mm/soft-dirty.c            | 2 +-
 tools/testing/selftests/mm/uffd-wp-mremap.c        | 2 +-
 tools/testing/selftests/mm/virtual_address_range.c | 2 +-
 18 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index 23d4bf6215465..aa98a9820d0aa 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -20,7 +20,6 @@ endif
 # thus tricking Make (and you!) into believing that All Is Well, in subsequent
 # make invocations:
 .DELETE_ON_ERROR:
-
 # Avoid accidental wrong builds, due to built-in rules working just a little
 # bit too well--but not quite as well as required for our situation here.
 #
@@ -34,7 +33,7 @@ endif
 MAKEFLAGS += --no-builtin-rules
 
 CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
-CFLAGS += -Wunreachable-code
+CFLAGS += -Wunreachable-code -Wunused
 LDLIBS = -lrt -lpthread -lm
 
 # Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
index 9bc4591c7b169..4fa03679e9b07 100644
--- a/tools/testing/selftests/mm/compaction_test.c
+++ b/tools/testing/selftests/mm/compaction_test.c
@@ -203,7 +203,7 @@ int set_zero_hugepages(unsigned long *initial_nr_hugepages)
 	return ret;
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	struct rlimit lim;
 	struct map_list *list = NULL, *entry;
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index c744c603d688e..681f6e3752a26 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -1857,7 +1857,7 @@ static int tests_per_non_anon_test_case(void)
 	return tests;
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	struct thp_settings default_settings;
 
diff --git a/tools/testing/selftests/mm/droppable.c b/tools/testing/selftests/mm/droppable.c
index f3d9ecf96890a..90ea6377810c5 100644
--- a/tools/testing/selftests/mm/droppable.c
+++ b/tools/testing/selftests/mm/droppable.c
@@ -15,7 +15,7 @@
 
 #include "../kselftest.h"
 
-int main(int argc, char *argv[])
+int main(void)
 {
 	size_t alloc_size = 134217728;
 	size_t page_size = getpagesize();
diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c
index 268dadb8ce438..7fe4f94400cb6 100644
--- a/tools/testing/selftests/mm/gup_longterm.c
+++ b/tools/testing/selftests/mm/gup_longterm.c
@@ -504,7 +504,7 @@ static int tests_per_test_case(void)
 	return 3 + nr_hugetlbsizes;
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	int i;
 
diff --git a/tools/testing/selftests/mm/hugepage-vmemmap.c b/tools/testing/selftests/mm/hugepage-vmemmap.c
index df366a4d1b92d..23e97e552057d 100644
--- a/tools/testing/selftests/mm/hugepage-vmemmap.c
+++ b/tools/testing/selftests/mm/hugepage-vmemmap.c
@@ -87,7 +87,7 @@ static int check_page_flags(unsigned long pfn)
 	return 0;
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	void *addr;
 	unsigned long pfn;
diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c
index c5940c0595be8..26fc97366c659 100644
--- a/tools/testing/selftests/mm/hugetlb-madvise.c
+++ b/tools/testing/selftests/mm/hugetlb-madvise.c
@@ -57,7 +57,7 @@ void read_fault_pages(void *addr, unsigned long nr_pages)
 	}
 }
 
-int main(int argc, char **argv)
+int main(int __always_unused argc, char **argv)
 {
 	unsigned long free_hugepages;
 	void *addr, *addr2;
diff --git a/tools/testing/selftests/mm/hugetlb-soft-offline.c b/tools/testing/selftests/mm/hugetlb-soft-offline.c
index f086f0e04756f..cb087303f5ed3 100644
--- a/tools/testing/selftests/mm/hugetlb-soft-offline.c
+++ b/tools/testing/selftests/mm/hugetlb-soft-offline.c
@@ -216,7 +216,7 @@ static void test_soft_offline_common(int enable_soft_offline)
 			 enable_soft_offline);
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	ksft_print_header();
 	ksft_set_plan(2);
diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c
index b6fabd5c27ed6..178e0ae0cd4a1 100644
--- a/tools/testing/selftests/mm/madv_populate.c
+++ b/tools/testing/selftests/mm/madv_populate.c
@@ -281,7 +281,7 @@ static int system_has_softdirty(void)
 #endif
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	int nr_tests = 16;
 	int err;
diff --git a/tools/testing/selftests/mm/map_populate.c b/tools/testing/selftests/mm/map_populate.c
index 9df2636c829bf..2b240499f15c9 100644
--- a/tools/testing/selftests/mm/map_populate.c
+++ b/tools/testing/selftests/mm/map_populate.c
@@ -76,7 +76,7 @@ static int child_f(int sock, unsigned long *smap, int fd)
 	return ksft_cnt.ksft_pass;
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	int sock[2], child, ret;
 	FILE *ftmp;
diff --git a/tools/testing/selftests/mm/memfd_secret.c b/tools/testing/selftests/mm/memfd_secret.c
index 9a0597310a765..836383f63b630 100644
--- a/tools/testing/selftests/mm/memfd_secret.c
+++ b/tools/testing/selftests/mm/memfd_secret.c
@@ -299,7 +299,7 @@ static void prepare(void)
 
 #define NUM_TESTS 6
 
-int main(int argc, char *argv[])
+int main(void)
 {
 	int fd;
 
diff --git a/tools/testing/selftests/mm/mlock-random-test.c b/tools/testing/selftests/mm/mlock-random-test.c
index b8d7e966f44c6..4ff7a4cfc7331 100644
--- a/tools/testing/selftests/mm/mlock-random-test.c
+++ b/tools/testing/selftests/mm/mlock-random-test.c
@@ -236,7 +236,7 @@ static void test_mlock_outof_limit(char *p, int alloc_size)
 	ksft_test_result_pass("%s\n", __func__);
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	char *p = NULL;
 
diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c
index 3e90ff37e336a..ce5fd5ce1f51f 100644
--- a/tools/testing/selftests/mm/mlock2-tests.c
+++ b/tools/testing/selftests/mm/mlock2-tests.c
@@ -425,7 +425,7 @@ static void test_mlockall(void)
 	munlockall();
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	int ret, size = 3 * getpagesize();
 	void *map;
diff --git a/tools/testing/selftests/mm/on-fault-limit.c b/tools/testing/selftests/mm/on-fault-limit.c
index 431c1277d83a1..ade160966c926 100644
--- a/tools/testing/selftests/mm/on-fault-limit.c
+++ b/tools/testing/selftests/mm/on-fault-limit.c
@@ -28,7 +28,7 @@ static void test_limit(void)
 	munlockall();
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	ksft_print_header();
 	ksft_set_plan(1);
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index 302fef54049c8..eb4ef8532c0bf 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -528,7 +528,7 @@ static void (*pkey_tests[])(void) = {
 	test_pkru_sigreturn
 };
 
-int main(int argc, char *argv[])
+int main(void)
 {
 	int i;
 
diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c
index 8a3f2b4b21869..e62be4136f69e 100644
--- a/tools/testing/selftests/mm/soft-dirty.c
+++ b/tools/testing/selftests/mm/soft-dirty.c
@@ -194,7 +194,7 @@ static void test_mprotect_file(int pagemap_fd, int pagesize)
 	test_mprotect(pagemap_fd, pagesize, false);
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
 	int pagemap_fd;
 	int pagesize;
diff --git a/tools/testing/selftests/mm/uffd-wp-mremap.c b/tools/testing/selftests/mm/uffd-wp-mremap.c
index c2ba7d46c7b45..13ceb56289701 100644
--- a/tools/testing/selftests/mm/uffd-wp-mremap.c
+++ b/tools/testing/selftests/mm/uffd-wp-mremap.c
@@ -334,7 +334,7 @@ static const struct testcase testcases[] = {
 	},
 };
 
-int main(int argc, char **argv)
+int main(void)
 {
 	struct thp_settings settings;
 	int i, j, plan = 0;
diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c
index 169dbd692bf5f..3c21d136962cb 100644
--- a/tools/testing/selftests/mm/virtual_address_range.c
+++ b/tools/testing/selftests/mm/virtual_address_range.c
@@ -189,7 +189,7 @@ static int validate_complete_va_space(void)
 	return 0;
 }
 
-int main(int argc, char *argv[])
+int main(void)
 {
 	char *ptr[NR_CHUNKS_LOW];
 	char **hptr;
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 5/8] selftests/mm: Remove unused parameters
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
                   ` (3 preceding siblings ...)
  2025-08-22  8:21 ` [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags Muhammad Usama Anjum
@ 2025-08-22  8:21 ` Muhammad Usama Anjum
  2025-08-22  8:21 ` [PATCH v3 6/8] selftests/mm: Fix unused parameter warnings for different architectures Muhammad Usama Anjum
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:21 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

Cleanup code and remove the unused arguments

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/mm/ksm_tests.c       | 17 +++++++----------
 tools/testing/selftests/mm/soft-dirty.c      |  4 ++--
 tools/testing/selftests/mm/uffd-common.c     |  4 ++--
 tools/testing/selftests/mm/uffd-common.h     |  2 +-
 tools/testing/selftests/mm/uffd-stress.c     |  2 +-
 tools/testing/selftests/mm/uffd-unit-tests.c |  8 ++++----
 6 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/tools/testing/selftests/mm/ksm_tests.c b/tools/testing/selftests/mm/ksm_tests.c
index b77462b5c240b..f5dabb513ed7f 100644
--- a/tools/testing/selftests/mm/ksm_tests.c
+++ b/tools/testing/selftests/mm/ksm_tests.c
@@ -238,8 +238,7 @@ static int ksm_merge_pages(int merge_type, void *addr, size_t size,
 	return 0;
 }
 
-static int ksm_unmerge_pages(void *addr, size_t size,
-			     struct timespec start_time, int timeout)
+static int ksm_unmerge_pages(void *addr, size_t size)
 {
 	if (madvise(addr, size, MADV_UNMERGEABLE)) {
 		perror("madvise");
@@ -456,7 +455,7 @@ static int get_first_mem_node(void)
 	return get_next_mem_node(numa_max_node());
 }
 
-static int check_ksm_numa_merge(int merge_type, int mapping, int prot, int timeout,
+static int check_ksm_numa_merge(int merge_type, int timeout,
 				bool merge_across_nodes, size_t page_size)
 {
 	void *numa1_map_ptr, *numa2_map_ptr;
@@ -520,8 +519,7 @@ static int check_ksm_numa_merge(int merge_type, int mapping, int prot, int timeo
 	return KSFT_FAIL;
 }
 
-static int ksm_merge_hugepages_time(int merge_type, int mapping, int prot,
-				int timeout, size_t map_size)
+static int ksm_merge_hugepages_time(int merge_type, int timeout, size_t map_size)
 {
 	void *map_ptr, *map_ptr_orig;
 	struct timespec start_time, end_time;
@@ -656,7 +654,7 @@ static int ksm_unmerge_time(int merge_type, int mapping, int prot, int timeout,
 		perror("clock_gettime");
 		goto err_out;
 	}
-	if (ksm_unmerge_pages(map_ptr, map_size, start_time, timeout))
+	if (ksm_unmerge_pages(map_ptr, map_size))
 		goto err_out;
 	if (clock_gettime(CLOCK_MONOTONIC_RAW, &end_time)) {
 		perror("clock_gettime");
@@ -884,8 +882,8 @@ int main(int argc, char *argv[])
 						page_size);
 		break;
 	case CHECK_KSM_NUMA_MERGE:
-		ret = check_ksm_numa_merge(merge_type, MAP_PRIVATE | MAP_ANONYMOUS, prot,
-					ksm_scan_limit_sec, merge_across_nodes, page_size);
+		ret = check_ksm_numa_merge(merge_type, ksm_scan_limit_sec, merge_across_nodes,
+					   page_size);
 		break;
 	case KSM_MERGE_TIME:
 		if (size_MB == 0) {
@@ -900,8 +898,7 @@ int main(int argc, char *argv[])
 			printf("Option '-s' is required.\n");
 			return KSFT_FAIL;
 		}
-		ret = ksm_merge_hugepages_time(merge_type, MAP_PRIVATE | MAP_ANONYMOUS, prot,
-				ksm_scan_limit_sec, size_MB);
+		ret = ksm_merge_hugepages_time(merge_type, ksm_scan_limit_sec, size_MB);
 		break;
 	case KSM_UNMERGE_TIME:
 		if (size_MB == 0) {
diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c
index e62be4136f69e..751fbc52857ea 100644
--- a/tools/testing/selftests/mm/soft-dirty.c
+++ b/tools/testing/selftests/mm/soft-dirty.c
@@ -76,7 +76,7 @@ static void test_vma_reuse(int pagemap_fd, int pagesize)
 	munmap(map2, pagesize);
 }
 
-static void test_hugepage(int pagemap_fd, int pagesize)
+static void test_hugepage(int pagemap_fd)
 {
 	char *map;
 	int i, ret;
@@ -210,7 +210,7 @@ int main(void)
 
 	test_simple(pagemap_fd, pagesize);
 	test_vma_reuse(pagemap_fd, pagesize);
-	test_hugepage(pagemap_fd, pagesize);
+	test_hugepage(pagemap_fd);
 	test_mprotect_anon(pagemap_fd, pagesize);
 	test_mprotect_file(pagemap_fd, pagesize);
 
diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c
index a37088a23ffef..815c22114b57e 100644
--- a/tools/testing/selftests/mm/uffd-common.c
+++ b/tools/testing/selftests/mm/uffd-common.c
@@ -416,7 +416,7 @@ static void continue_range(int ufd, __u64 start, __u64 len, bool wp)
 		    ret, (int64_t) req.mapped);
 }
 
-int uffd_read_msg(int ufd, struct uffd_msg *msg)
+int uffd_read_msg(struct uffd_msg *msg)
 {
 	int ret = read(uffd, msg, sizeof(*msg));
 
@@ -537,7 +537,7 @@ void *uffd_poll_thread(void *arg)
 		}
 		if (!(pollfd[0].revents & POLLIN))
 			err("pollfd[0].revents %d", pollfd[0].revents);
-		if (uffd_read_msg(uffd, &msg))
+		if (uffd_read_msg(&msg))
 			continue;
 		switch (msg.event) {
 		default:
diff --git a/tools/testing/selftests/mm/uffd-common.h b/tools/testing/selftests/mm/uffd-common.h
index 7700cbfa39756..2e7066d69103d 100644
--- a/tools/testing/selftests/mm/uffd-common.h
+++ b/tools/testing/selftests/mm/uffd-common.h
@@ -117,7 +117,7 @@ void uffd_stats_report(struct uffd_args *args, int n_cpus);
 int uffd_test_ctx_init(uint64_t features, const char **errmsg);
 void uffd_test_ctx_clear(void);
 int userfaultfd_open(uint64_t *features);
-int uffd_read_msg(int ufd, struct uffd_msg *msg);
+int uffd_read_msg(struct uffd_msg *msg);
 void wp_range(int ufd, __u64 start, __u64 len, bool wp);
 void uffd_handle_page_fault(struct uffd_msg *msg, struct uffd_args *args);
 int __copy_page(int ufd, unsigned long offset, bool retry, bool wp);
diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c
index c0f64df5085c4..24aac0ae96c6c 100644
--- a/tools/testing/selftests/mm/uffd-stress.c
+++ b/tools/testing/selftests/mm/uffd-stress.c
@@ -137,7 +137,7 @@ static void *uffd_read_thread(void *arg)
 	/* from here cancellation is ok */
 
 	for (;;) {
-		if (uffd_read_msg(uffd, &msg))
+		if (uffd_read_msg(&msg))
 			continue;
 		uffd_handle_page_fault(&msg, args);
 	}
diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index 50501b38e34e7..df7b82bbebaad 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -248,7 +248,7 @@ static void *fork_event_consumer(void *data)
 	ready_for_fork = true;
 
 	/* Read until a full msg received */
-	while (uffd_read_msg(args->parent_uffd, &msg));
+	while (uffd_read_msg(&msg));
 
 	if (msg.event != UFFD_EVENT_FORK)
 		err("wrong message: %u\n", msg.event);
@@ -1352,11 +1352,11 @@ static void *uffd_mmap_changing_thread(void *opaque)
 	return NULL;
 }
 
-static void uffd_consume_message(int fd)
+static void uffd_consume_message(void)
 {
 	struct uffd_msg msg = { 0 };
 
-	while (uffd_read_msg(fd, &msg));
+	while (uffd_read_msg(&msg));
 }
 
 static void uffd_mmap_changing_test(uffd_test_args_t *targs)
@@ -1407,7 +1407,7 @@ static void uffd_mmap_changing_test(uffd_test_args_t *targs)
 	 * All succeeded above!  Recycle everything.  Start by reading the
 	 * event so as to kick the thread roll again..
 	 */
-	uffd_consume_message(uffd);
+	uffd_consume_message();
 
 	ret = pthread_join(tid, NULL);
 	assert(ret == 0);
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 6/8] selftests/mm: Fix unused parameter warnings for different architectures
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
                   ` (4 preceding siblings ...)
  2025-08-22  8:21 ` [PATCH v3 5/8] selftests/mm: Remove unused parameters Muhammad Usama Anjum
@ 2025-08-22  8:21 ` Muhammad Usama Anjum
  2025-08-22  8:21 ` [PATCH v3 7/8] selftests/mm: mark variable unused with macro Muhammad Usama Anjum
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:21 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

There are functions which have unused arguments for different
architectures. Separate the code for each architecture and move #ifdef
arch outside these functions.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/mm/mseal_test.c       |  8 +++++--
 .../selftests/mm/pkey_sighandler_tests.c      | 21 ++++++++++++++++---
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c
index 005f29c86484e..4c2a232796866 100644
--- a/tools/testing/selftests/mm/mseal_test.c
+++ b/tools/testing/selftests/mm/mseal_test.c
@@ -131,17 +131,21 @@ static unsigned int __read_pkey_reg(void)
 	return pkey_reg;
 }
 
+#if defined(__i386__) || defined(__x86_64__) /* arch */
 static void __write_pkey_reg(u64 pkey_reg)
 {
-#if defined(__i386__) || defined(__x86_64__) /* arch */
 	unsigned int eax = pkey_reg;
 	unsigned int ecx = 0;
 	unsigned int edx = 0;
 
 	asm volatile(".byte 0x0f,0x01,0xef\n\t"
 			: : "a" (eax), "c" (ecx), "d" (edx));
-#endif
 }
+#else
+static void __write_pkey_reg(u64 __always_unused pkey_reg)
+{
+}
+#endif
 
 static unsigned long pkey_bit_position(int pkey)
 {
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index eb4ef8532c0bf..bfa88fe188f66 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -41,11 +41,12 @@ static siginfo_t siginfo = {0};
  * syscall will attempt to access the PLT in order to call a library function
  * which is protected by MPK 0 which we don't have access to.
  */
+#ifdef __x86_64__
 static __always_inline
 long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
 {
 	unsigned long ret;
-#ifdef __x86_64__
+
 	register long r10 asm("r10") = a4;
 	register long r8 asm("r8") = a5;
 	register long r9 asm("r9") = a6;
@@ -53,12 +54,26 @@ long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
 		      : "=a"(ret)
 		      : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(r10), "r"(r8), "r"(r9)
 		      : "rcx", "r11", "memory");
+	return ret;
+}
 #elif defined __i386__
+static __always_inline
+long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long __always_unused a6)
+{
+	unsigned long ret;
+
 	asm volatile ("int $0x80"
 		      : "=a"(ret)
 		      : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5)
 		      : "memory");
+	return ret;
+}
 #elif defined __aarch64__
+static __always_inline
+long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
+{
+	unsigned long ret;
+
 	register long x0 asm("x0") = a1;
 	register long x1 asm("x1") = a2;
 	register long x2 asm("x2") = a3;
@@ -71,11 +86,11 @@ long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
 		      : "r"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5), "r"(x8)
 		      : "memory");
 	ret = x0;
+	return ret;
+}
 #else
 # error syscall_raw() not implemented
 #endif
-	return ret;
-}
 
 static inline long clone_raw(unsigned long flags, void *stack,
 			     int *parent_tid, int *child_tid)
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 7/8] selftests/mm: mark variable unused with macro
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
                   ` (5 preceding siblings ...)
  2025-08-22  8:21 ` [PATCH v3 6/8] selftests/mm: Fix unused parameter warnings for different architectures Muhammad Usama Anjum
@ 2025-08-22  8:21 ` Muhammad Usama Anjum
  2025-08-22  8:21 ` [PATCH v3 8/8] selftests/mm: pkey-helpers: Remove duplicate __maybe_unused Muhammad Usama Anjum
  2025-08-23  0:42 ` [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Andrew Morton
  8 siblings, 0 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:21 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

Use __always_unused macro instead of raw compiler attribute.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v2:
- Introduced in v2
---
 tools/testing/selftests/mm/protection_keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index 6281d4c61b50e..967181bcb4120 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -1302,7 +1302,7 @@ static void test_mprotect_with_pkey_0(int *ptr, u16 pkey)
 
 static void test_ptrace_of_child(int *ptr, u16 pkey)
 {
-	__attribute__((__unused__)) int peek_result;
+	int __always_unused peek_result;
 	pid_t child_pid;
 	void *ignored = 0;
 	long ret;
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 8/8] selftests/mm: pkey-helpers: Remove duplicate __maybe_unused
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
                   ` (6 preceding siblings ...)
  2025-08-22  8:21 ` [PATCH v3 7/8] selftests/mm: mark variable unused with macro Muhammad Usama Anjum
@ 2025-08-22  8:21 ` Muhammad Usama Anjum
  2025-08-23  0:42 ` [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Andrew Morton
  8 siblings, 0 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-22  8:21 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky
  Cc: Muhammad Usama Anjum, kernel

__maybe_unused is now defined in the kselftest.h. Remove from this file
as its not required.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v2:
- Introduced in v2
---
 tools/testing/selftests/mm/pkey-helpers.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/testing/selftests/mm/pkey-helpers.h b/tools/testing/selftests/mm/pkey-helpers.h
index ea404f80e6cb9..fa15f006fa68c 100644
--- a/tools/testing/selftests/mm/pkey-helpers.h
+++ b/tools/testing/selftests/mm/pkey-helpers.h
@@ -84,9 +84,6 @@ extern void abort_hooks(void);
 #ifndef noinline
 # define noinline __attribute__((noinline))
 #endif
-#ifndef __maybe_unused
-# define __maybe_unused __attribute__((__unused__))
-#endif
 
 int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
 int sys_pkey_free(unsigned long pkey);
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings
  2025-08-22  8:20 ` [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings Muhammad Usama Anjum
@ 2025-08-22 17:08   ` Zi Yan
  2025-08-26  8:33   ` Kevin Brodsky
  1 sibling, 0 replies; 16+ messages in thread
From: Zi Yan @ 2025-08-22 17:08 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Baolin Wang, Nico Pache, Ryan Roberts,
	Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, linux-kselftest, linux-kernel, linux-mm,
	linux-riscv, kevin.brodsky, kernel, Sidhartha Kumar

On 22 Aug 2025, at 4:20, Muhammad Usama Anjum wrote:

> Enable -Wunreachable-code flag to catch dead code and fix them.
>
> 1. Remove the dead code and write a comment instead:
> hmm-tests.c:2033:3: warning: code will never be executed
> [-Wunreachable-code]
>                 perror("Should not reach this\n");
>                 ^~~~~~
>
> 2. ksft_exit_fail_msg() calls exit(). Remove the dead code.
> split_huge_page_test.c:301:3: warning: code will never be executed
> [-Wunreachable-code]
>                 goto cleanup;
>                 ^~~~~~~~~~~~
>
> 3. Remove duplicate inline.
> pkey_sighandler_tests.c:44:15: warning: duplicate 'inline' declaration
> specifier [-Wduplicate-decl-specifier]
> static inline __always_inline
>
> Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes since v2:
> - In split_huge_page_test.c, print error message and then go to cleanup
>   tag for cleanup instead of just exiting without cleanup
> ---
>  tools/testing/selftests/mm/Makefile                | 1 +
>  tools/testing/selftests/mm/hmm-tests.c             | 5 ++---
>  tools/testing/selftests/mm/pkey_sighandler_tests.c | 2 +-
>  tools/testing/selftests/mm/split_huge_page_test.c  | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 2/8] selftests/mm: protection_keys: Fix dead code
  2025-08-22  8:20 ` [PATCH v3 2/8] selftests/mm: protection_keys: Fix dead code Muhammad Usama Anjum
@ 2025-08-22 17:11   ` Zi Yan
  0 siblings, 0 replies; 16+ messages in thread
From: Zi Yan @ 2025-08-22 17:11 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Baolin Wang, Nico Pache, Ryan Roberts,
	Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, linux-kselftest, linux-kernel, linux-mm,
	linux-riscv, kevin.brodsky, kernel, Sidhartha Kumar

On 22 Aug 2025, at 4:20, Muhammad Usama Anjum wrote:

> The while loop doesn't execute and following warning gets generated:
>
> protection_keys.c:561:15: warning: code will never be executed
> [-Wunreachable-code]
>                 int rpkey = alloc_random_pkey();
>
> Let's enable the while loop such that it gets executed nr_iterations
> times. Simplify the code a bit as well.
>
> Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/mm/protection_keys.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>

LGTM. Acked-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings
  2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
                   ` (7 preceding siblings ...)
  2025-08-22  8:21 ` [PATCH v3 8/8] selftests/mm: pkey-helpers: Remove duplicate __maybe_unused Muhammad Usama Anjum
@ 2025-08-23  0:42 ` Andrew Morton
  2025-08-25  7:14   ` Muhammad Usama Anjum
  8 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2025-08-23  0:42 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Jason Gunthorpe, John Hubbard, Peter Xu, Leon Romanovsky, Zi Yan,
	Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-kselftest, linux-kernel, linux-mm, linux-riscv,
	kevin.brodsky, kernel

On Fri, 22 Aug 2025 13:20:57 +0500 Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:

> Recently, I reviewed a patch on the mm/kselftest mailing list about a
> test which had obvious type mismatch fix in it. It was strange why that
> wasn't caught during development and when patch was accepted. This led
> me to discover that those extra compiler options to catch these warnings
> aren't being used. When I added them, I found tens of warnings in just
> mm suite.
> 
> In this series, I'm adding these flags and fixing those warnings. In the
> last try several months ago [1], I'd patches for individual tests. I've
> made patches better by grouping the same type of fixes together. Hence
> there is no changelog for individual patches.

I think it would be best to avoid adding warnings to selftests which
aren't present in the main kernel code.  If only to avoid surprising
people over what isn't permissible in selftests/.

In particular, there's an expectation that we can do

#else
static inline int some_stub(type1 arg1, type2 arg2)
{
}
#endif

without warning.  We do this extensively.

Also, please be aware that there's already a patch in mm-new which
centralizes selftests' __maybe_unused definition.
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-centralise-maybe-unused-definition-in-kselftesth.patch

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings
  2025-08-23  0:42 ` [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Andrew Morton
@ 2025-08-25  7:14   ` Muhammad Usama Anjum
  0 siblings, 0 replies; 16+ messages in thread
From: Muhammad Usama Anjum @ 2025-08-25  7:14 UTC (permalink / raw)
  To: Andrew Morton
  Cc: usama.anjum, Shuah Khan, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
	Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache,
	Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-kselftest, linux-kernel,
	linux-mm, linux-riscv, kevin.brodsky, kernel

On 8/23/25 5:42 AM, Andrew Morton wrote:
> On Fri, 22 Aug 2025 13:20:57 +0500 Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:
> 
>> Recently, I reviewed a patch on the mm/kselftest mailing list about a
>> test which had obvious type mismatch fix in it. It was strange why that
>> wasn't caught during development and when patch was accepted. This led
>> me to discover that those extra compiler options to catch these warnings
>> aren't being used. When I added them, I found tens of warnings in just
>> mm suite.
>>
>> In this series, I'm adding these flags and fixing those warnings. In the
>> last try several months ago [1], I'd patches for individual tests. I've
>> made patches better by grouping the same type of fixes together. Hence
>> there is no changelog for individual patches.
> 
> I think it would be best to avoid adding warnings to selftests which
> aren't present in the main kernel code.  If only to avoid surprising
> people over what isn't permissible in selftests/.
> 
> In particular, there's an expectation that we can do
> 
> #else
> static inline int some_stub(type1 arg1, type2 arg2)
> {
> }
> #endif
> 
> without warning.  We do this extensively.

I'm only adding -Wunreachable-code -Wunused flags now. The above shouldn't
cause any warnings. I'll double check again in next series.

> 
> Also, please be aware that there's already a patch in mm-new which
> centralizes selftests' __maybe_unused definition.
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-centralise-maybe-unused-definition-in-kselftesth.patch
I'll rebase on top of it and send again.


-- 
---
Thanks,
Usama

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags
  2025-08-22  8:21 ` [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags Muhammad Usama Anjum
@ 2025-08-25 18:21   ` John Hubbard
  2025-08-26  7:45     ` David Hildenbrand
  0 siblings, 1 reply; 16+ messages in thread
From: John Hubbard @ 2025-08-25 18:21 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Andrew Morton,
	David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Jason Gunthorpe, Peter Xu, Leon Romanovsky, Zi Yan, Baolin Wang,
	Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-kselftest,
	linux-kernel, linux-mm, linux-riscv, kevin.brodsky
  Cc: kernel

On 8/22/25 1:21 AM, Muhammad Usama Anjum wrote:
...
> diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
> index 9bc4591c7b169..4fa03679e9b07 100644
> --- a/tools/testing/selftests/mm/compaction_test.c
> +++ b/tools/testing/selftests/mm/compaction_test.c
> @@ -203,7 +203,7 @@ int set_zero_hugepages(unsigned long *initial_nr_hugepages)
>  	return ret;
>  }
>  
> -int main(int argc, char **argv)
> +int main(void)

Hi Muhammad,

This is not helpful nor desirable, in selftest code.

In fact, I think this particular patch is actually a solid
illustration of why you probably should just abandon the -Wunused
flag in kselftests.

Skimming through the other patches doesn't change my initial
impression, either. This is adding churn and admin overhead,
but for test code there is basically no benefit here. Certainly
not enough to be worth it.

thanks,
-- 
John Hubbard


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags
  2025-08-25 18:21   ` John Hubbard
@ 2025-08-26  7:45     ` David Hildenbrand
  0 siblings, 0 replies; 16+ messages in thread
From: David Hildenbrand @ 2025-08-26  7:45 UTC (permalink / raw)
  To: John Hubbard, Muhammad Usama Anjum, Shuah Khan, Andrew Morton,
	Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, Peter Xu,
	Leon Romanovsky, Zi Yan, Baolin Wang, Nico Pache, Ryan Roberts,
	Dev Jain, Barry Song, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, linux-kselftest, linux-kernel, linux-mm,
	linux-riscv, kevin.brodsky
  Cc: kernel

On 25.08.25 20:21, John Hubbard wrote:
> On 8/22/25 1:21 AM, Muhammad Usama Anjum wrote:
> ...
>> diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
>> index 9bc4591c7b169..4fa03679e9b07 100644
>> --- a/tools/testing/selftests/mm/compaction_test.c
>> +++ b/tools/testing/selftests/mm/compaction_test.c
>> @@ -203,7 +203,7 @@ int set_zero_hugepages(unsigned long *initial_nr_hugepages)
>>   	return ret;
>>   }
>>   
>> -int main(int argc, char **argv)
>> +int main(void)
> 
> Hi Muhammad,
> 
> This is not helpful nor desirable, in selftest code.
> 
> In fact, I think this particular patch is actually a solid
> illustration of why you probably should just abandon the -Wunused
> flag in kselftests.
> 
> Skimming through the other patches doesn't change my initial
> impression, either. This is adding churn and admin overhead,
> but for test code there is basically no benefit here. Certainly
> not enough to be worth it.

Fully agreed.

-- 
Cheers

David / dhildenb


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings
  2025-08-22  8:20 ` [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings Muhammad Usama Anjum
  2025-08-22 17:08   ` Zi Yan
@ 2025-08-26  8:33   ` Kevin Brodsky
  1 sibling, 0 replies; 16+ messages in thread
From: Kevin Brodsky @ 2025-08-26  8:33 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Andrew Morton,
	David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Jason Gunthorpe, John Hubbard, Peter Xu, Leon Romanovsky, Zi Yan,
	Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-kselftest, linux-kernel, linux-mm, linux-riscv
  Cc: kernel, Sidhartha Kumar

On 22/08/2025 10:20, Muhammad Usama Anjum wrote:
> Enable -Wunreachable-code flag to catch dead code and fix them.
>
> 1. Remove the dead code and write a comment instead:
> hmm-tests.c:2033:3: warning: code will never be executed
> [-Wunreachable-code]
>                 perror("Should not reach this\n");
>                 ^~~~~~
>
> 2. ksft_exit_fail_msg() calls exit(). Remove the dead code.

In that new version there's no dead code removal, rather that call is
replaced to a call to ksft_print_msg() that doesn't exit.

With that corrected:

Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>

- Kevin

> split_huge_page_test.c:301:3: warning: code will never be executed
> [-Wunreachable-code]
>                 goto cleanup;
>                 ^~~~~~~~~~~~
>
> 3. Remove duplicate inline.
> pkey_sighandler_tests.c:44:15: warning: duplicate 'inline' declaration
> specifier [-Wduplicate-decl-specifier]
> static inline __always_inline
>
> Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes since v2:
> - In split_huge_page_test.c, print error message and then go to cleanup
>   tag for cleanup instead of just exiting without cleanup
> ---
>  tools/testing/selftests/mm/Makefile                | 1 +
>  tools/testing/selftests/mm/hmm-tests.c             | 5 ++---
>  tools/testing/selftests/mm/pkey_sighandler_tests.c | 2 +-
>  tools/testing/selftests/mm/split_huge_page_test.c  | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
> index d13b3cef2a2b2..23d4bf6215465 100644
> --- a/tools/testing/selftests/mm/Makefile
> +++ b/tools/testing/selftests/mm/Makefile
> @@ -34,6 +34,7 @@ endif
>  MAKEFLAGS += --no-builtin-rules
>  
>  CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
> +CFLAGS += -Wunreachable-code
>  LDLIBS = -lrt -lpthread -lm
>  
>  # Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
> diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c
> index 141bf63cbe05e..15aadaf24a667 100644
> --- a/tools/testing/selftests/mm/hmm-tests.c
> +++ b/tools/testing/selftests/mm/hmm-tests.c
> @@ -2027,11 +2027,10 @@ TEST_F(hmm, hmm_cow_in_device)
>  	if (pid == -1)
>  		ASSERT_EQ(pid, 0);
>  	if (!pid) {
> -		/* Child process waitd for SIGTERM from the parent. */
> +		/* Child process waits for SIGTERM from the parent. */
>  		while (1) {
>  		}
> -		perror("Should not reach this\n");
> -		exit(0);
> +		/* Should not reach this */
>  	}
>  	/* Parent process writes to COW pages(s) and gets a
>  	 * new copy in system. In case of device private pages,
> diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> index b5e076a564c95..302fef54049c8 100644
> --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
> +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> @@ -41,7 +41,7 @@ static siginfo_t siginfo = {0};
>   * syscall will attempt to access the PLT in order to call a library function
>   * which is protected by MPK 0 which we don't have access to.
>   */
> -static inline __always_inline
> +static __always_inline
>  long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
>  {
>  	unsigned long ret;
> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> index bf40e6b121abc..de0d26f3df675 100644
> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> @@ -297,7 +297,7 @@ void split_file_backed_thp(int order)
>  
>  	status = snprintf(testfile, INPUT_MAX, "%s/thp_file", tmpfs_loc);
>  	if (status >= INPUT_MAX) {
> -		ksft_exit_fail_msg("Fail to create file-backed THP split testing file\n");
> +		ksft_print_msg("Fail to create file-backed THP split testing file\n");
>  		goto cleanup;
>  	}
>  

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-08-26  9:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22  8:20 [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Muhammad Usama Anjum
2025-08-22  8:20 ` [PATCH v3 1/8] selftests/mm: Add -Wunreachable-code and fix warnings Muhammad Usama Anjum
2025-08-22 17:08   ` Zi Yan
2025-08-26  8:33   ` Kevin Brodsky
2025-08-22  8:20 ` [PATCH v3 2/8] selftests/mm: protection_keys: Fix dead code Muhammad Usama Anjum
2025-08-22 17:11   ` Zi Yan
2025-08-22  8:21 ` [PATCH v3 3/8] selftests: kselftest.h: Add unused macro Muhammad Usama Anjum
2025-08-22  8:21 ` [PATCH v3 4/8] selftests/mm: Add -Wunused family of flags Muhammad Usama Anjum
2025-08-25 18:21   ` John Hubbard
2025-08-26  7:45     ` David Hildenbrand
2025-08-22  8:21 ` [PATCH v3 5/8] selftests/mm: Remove unused parameters Muhammad Usama Anjum
2025-08-22  8:21 ` [PATCH v3 6/8] selftests/mm: Fix unused parameter warnings for different architectures Muhammad Usama Anjum
2025-08-22  8:21 ` [PATCH v3 7/8] selftests/mm: mark variable unused with macro Muhammad Usama Anjum
2025-08-22  8:21 ` [PATCH v3 8/8] selftests/mm: pkey-helpers: Remove duplicate __maybe_unused Muhammad Usama Anjum
2025-08-23  0:42 ` [PATCH v3 0/8] selftests/mm: Add compiler flags and fix found warnings Andrew Morton
2025-08-25  7:14   ` Muhammad Usama Anjum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).