* [PATCH 0/4] selftests/mm: Tweaks to the cow test
@ 2025-06-10 14:13 Mark Brown
2025-06-10 14:13 ` [PATCH 1/4] kselftest/mm: Clarify errors for pipe() Mark Brown
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Mark Brown @ 2025-06-10 14:13 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, David Hildenbrand
Cc: linux-mm, linux-kselftest, linux-kernel, Mark Brown
A collection of non-functional updates from David Hildenbrand's review.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (4):
kselftest/mm: Clarify errors for pipe()
selftests/mm: Convert some cow error reports to ksft_perror()
selftests/mm: Don't compare return values to in cow
selftests/mm: Add messages about test errors to the cow tests
tools/testing/selftests/mm/cow.c | 44 +++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 16 deletions(-)
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250603-selftest-mm-cow-tweaks-0199c5132b3e
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] kselftest/mm: Clarify errors for pipe()
2025-06-10 14:13 [PATCH 0/4] selftests/mm: Tweaks to the cow test Mark Brown
@ 2025-06-10 14:13 ` Mark Brown
2025-06-11 12:09 ` David Hildenbrand
2025-06-10 14:13 ` [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror() Mark Brown
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2025-06-10 14:13 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, David Hildenbrand
Cc: linux-mm, linux-kselftest, linux-kernel, Mark Brown
Specify that errors reported from pipe() failures are the result of
failures.
Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/mm/cow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index dbbcc5eb3dce..0adc0ab142c1 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -113,11 +113,11 @@ struct comm_pipes {
static int setup_comm_pipes(struct comm_pipes *comm_pipes)
{
if (pipe(comm_pipes->child_ready) < 0) {
- ksft_perror("pipe()");
+ ksft_perror("pipe() failed");
return -errno;
}
if (pipe(comm_pipes->parent_ready) < 0) {
- ksft_perror("pipe()");
+ ksft_perror("pipe() failed");
close(comm_pipes->child_ready[0]);
close(comm_pipes->child_ready[1]);
return -errno;
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror()
2025-06-10 14:13 [PATCH 0/4] selftests/mm: Tweaks to the cow test Mark Brown
2025-06-10 14:13 ` [PATCH 1/4] kselftest/mm: Clarify errors for pipe() Mark Brown
@ 2025-06-10 14:13 ` Mark Brown
2025-06-11 12:10 ` David Hildenbrand
2025-06-10 14:13 ` [PATCH 3/4] selftests/mm: Don't compare return values to in cow Mark Brown
2025-06-10 14:13 ` [PATCH 4/4] selftests/mm: Add messages about test errors to the cow tests Mark Brown
3 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2025-06-10 14:13 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, David Hildenbrand
Cc: linux-mm, linux-kselftest, linux-kernel, Mark Brown
This prints the errno and a string decode of it.
Reported-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/mm/cow.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index 0adc0ab142c1..ff80329313e4 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -332,7 +332,7 @@ static void do_test_vmsplice_in_parent(char *mem, size_t size,
if (before_fork) {
transferred = vmsplice(fds[1], &iov, 1, 0);
if (transferred <= 0) {
- ksft_print_msg("vmsplice() failed\n");
+ ksft_perror("vmsplice() failed\n");
log_test_result(KSFT_FAIL);
goto close_pipe;
}
@@ -562,7 +562,7 @@ static void do_test_iouring(char *mem, size_t size, bool use_fork)
while (total < size) {
cur = pread(fd, tmp + total, size - total, total);
if (cur < 0) {
- ksft_print_msg("pread() failed\n");
+ ksft_perror("pread() failed\n");
log_test_result(KSFT_FAIL);
goto quit_child;
}
@@ -628,7 +628,7 @@ static void do_test_ro_pin(char *mem, size_t size, enum ro_pin_test test,
tmp = malloc(size);
if (!tmp) {
- ksft_print_msg("malloc() failed\n");
+ ksft_perror("malloc() failed\n");
log_test_result(KSFT_FAIL);
return;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] selftests/mm: Don't compare return values to in cow
2025-06-10 14:13 [PATCH 0/4] selftests/mm: Tweaks to the cow test Mark Brown
2025-06-10 14:13 ` [PATCH 1/4] kselftest/mm: Clarify errors for pipe() Mark Brown
2025-06-10 14:13 ` [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror() Mark Brown
@ 2025-06-10 14:13 ` Mark Brown
2025-06-11 12:10 ` David Hildenbrand
2025-06-10 14:13 ` [PATCH 4/4] selftests/mm: Add messages about test errors to the cow tests Mark Brown
3 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2025-06-10 14:13 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, David Hildenbrand
Cc: linux-mm, linux-kselftest, linux-kernel, Mark Brown
Tweak the coding style for checking for non-zero return values.
While we're at it also remove a now redundant oring of the madvise()
return code.
Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/mm/cow.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index ff80329313e4..48fcf03aa4cd 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -1613,13 +1613,13 @@ static void run_with_huge_zeropage(non_anon_test_fn fn, const char *desc)
smem = (char *)(((uintptr_t)mmap_smem + pmdsize) & ~(pmdsize - 1));
ret = madvise(mem, pmdsize, MADV_HUGEPAGE);
- if (ret != 0) {
+ if (ret) {
ksft_perror("madvise()");
log_test_result(KSFT_FAIL);
goto munmap;
}
- ret |= madvise(smem, pmdsize, MADV_HUGEPAGE);
- if (ret != 0) {
+ ret = madvise(smem, pmdsize, MADV_HUGEPAGE);
+ if (ret) {
ksft_perror("madvise()");
log_test_result(KSFT_FAIL);
goto munmap;
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] selftests/mm: Add messages about test errors to the cow tests
2025-06-10 14:13 [PATCH 0/4] selftests/mm: Tweaks to the cow test Mark Brown
` (2 preceding siblings ...)
2025-06-10 14:13 ` [PATCH 3/4] selftests/mm: Don't compare return values to in cow Mark Brown
@ 2025-06-10 14:13 ` Mark Brown
2025-06-11 12:11 ` David Hildenbrand
3 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2025-06-10 14:13 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, David Hildenbrand
Cc: linux-mm, linux-kselftest, linux-kernel, Mark Brown
It is not sufficiently clear what the individual tests in the cow test
program are checking so add messages for the failure cases.
Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/mm/cow.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index 48fcf03aa4cd..29767e2afdd0 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -268,8 +268,10 @@ static void do_test_cow_in_parent(char *mem, size_t size, bool do_mprotect,
* fail because (a) harder to fix and (b) nobody really cares.
* Flag them as expected failure for now.
*/
+ ksft_print_msg("Leak from parent into child\n");
log_test_result(KSFT_XFAIL);
} else {
+ ksft_print_msg("Leak from parent into child\n");
log_test_result(KSFT_FAIL);
}
close_comm_pipes:
@@ -397,8 +399,10 @@ static void do_test_vmsplice_in_parent(char *mem, size_t size,
* fail because (a) harder to fix and (b) nobody really cares.
* Flag them as expected failure for now.
*/
+ ksft_print_msg("Leak from child into parent\n");
log_test_result(KSFT_XFAIL);
} else {
+ ksft_print_msg("Leak from child into parent\n");
log_test_result(KSFT_FAIL);
}
close_pipe:
@@ -570,10 +574,12 @@ static void do_test_iouring(char *mem, size_t size, bool use_fork)
}
/* Finally, check if we read what we expected. */
- if (!memcmp(mem, tmp, size))
+ if (!memcmp(mem, tmp, size)) {
log_test_result(KSFT_PASS);
- else
+ } else {
+ ksft_print_msg("Longtom R/W pin is not reliable\n");
log_test_result(KSFT_FAIL);
+ }
quit_child:
if (use_fork) {
@@ -725,10 +731,12 @@ static void do_test_ro_pin(char *mem, size_t size, enum ro_pin_test test,
ksft_perror("PIN_LONGTERM_TEST_READ failed");
log_test_result(KSFT_FAIL);
} else {
- if (!memcmp(mem, tmp, size))
+ if (!memcmp(mem, tmp, size)) {
log_test_result(KSFT_PASS);
- else
+ } else {
+ ksft_print_msg("Longterm R/O pin is not reliable\n");
log_test_result(KSFT_FAIL);
+ }
}
ret = ioctl(gup_fd, PIN_LONGTERM_TEST_STOP);
@@ -1417,10 +1425,12 @@ static void do_test_anon_thp_collapse(char *mem, size_t size,
else
ret = -EINVAL;
- if (!ret)
+ if (!ret) {
log_test_result(KSFT_PASS);
- else
+ } else {
+ ksft_print_msg("Leak from parent into child\n");
log_test_result(KSFT_FAIL);
+ }
close_comm_pipes:
close_comm_pipes(&comm_pipes);
}
@@ -1528,10 +1538,12 @@ static void test_cow(char *mem, const char *smem, size_t size)
memset(mem, 0xff, size);
/* See if we still read the old values via the other mapping. */
- if (!memcmp(smem, old, size))
+ if (!memcmp(smem, old, size)) {
log_test_result(KSFT_PASS);
- else
+ } else {
+ ksft_print_msg("Other mapping modified\n");
log_test_result(KSFT_FAIL);
+ }
free(old);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] kselftest/mm: Clarify errors for pipe()
2025-06-10 14:13 ` [PATCH 1/4] kselftest/mm: Clarify errors for pipe() Mark Brown
@ 2025-06-11 12:09 ` David Hildenbrand
0 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand @ 2025-06-11 12:09 UTC (permalink / raw)
To: Mark Brown, Andrew Morton, Shuah Khan
Cc: linux-mm, linux-kselftest, linux-kernel
On 10.06.25 16:13, Mark Brown wrote:
> Specify that errors reported from pipe() failures are the result of
> failures.
>
> Suggested-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror()
2025-06-10 14:13 ` [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror() Mark Brown
@ 2025-06-11 12:10 ` David Hildenbrand
2025-06-11 12:14 ` Mark Brown
0 siblings, 1 reply; 10+ messages in thread
From: David Hildenbrand @ 2025-06-11 12:10 UTC (permalink / raw)
To: Mark Brown, Andrew Morton, Shuah Khan
Cc: linux-mm, linux-kselftest, linux-kernel
On 10.06.25 16:13, Mark Brown wrote:
> This prints the errno and a string decode of it.
>
> Reported-by: David Hildenbrand <david@redhat.com>
Probably not "Reported-by". Did you mean "Suggested-by" like for the others?
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] selftests/mm: Don't compare return values to in cow
2025-06-10 14:13 ` [PATCH 3/4] selftests/mm: Don't compare return values to in cow Mark Brown
@ 2025-06-11 12:10 ` David Hildenbrand
0 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand @ 2025-06-11 12:10 UTC (permalink / raw)
To: Mark Brown, Andrew Morton, Shuah Khan
Cc: linux-mm, linux-kselftest, linux-kernel
On 10.06.25 16:13, Mark Brown wrote:
> Tweak the coding style for checking for non-zero return values.
> While we're at it also remove a now redundant oring of the madvise()
> return code.
>
> Suggested-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] selftests/mm: Add messages about test errors to the cow tests
2025-06-10 14:13 ` [PATCH 4/4] selftests/mm: Add messages about test errors to the cow tests Mark Brown
@ 2025-06-11 12:11 ` David Hildenbrand
0 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand @ 2025-06-11 12:11 UTC (permalink / raw)
To: Mark Brown, Andrew Morton, Shuah Khan
Cc: linux-mm, linux-kselftest, linux-kernel
On 10.06.25 16:13, Mark Brown wrote:
> It is not sufficiently clear what the individual tests in the cow test
> program are checking so add messages for the failure cases.
>
> Suggested-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
Thanks!
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror()
2025-06-11 12:10 ` David Hildenbrand
@ 2025-06-11 12:14 ` Mark Brown
0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2025-06-11 12:14 UTC (permalink / raw)
To: David Hildenbrand
Cc: Andrew Morton, Shuah Khan, linux-mm, linux-kselftest,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
On Wed, Jun 11, 2025 at 02:10:20PM +0200, David Hildenbrand wrote:
> On 10.06.25 16:13, Mark Brown wrote:
> > This prints the errno and a string decode of it.
> >
> > Reported-by: David Hildenbrand <david@redhat.com>
>
> Probably not "Reported-by". Did you mean "Suggested-by" like for the others?
Probably. I'm sure I was thinking something there but not sure what.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-06-11 12:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 14:13 [PATCH 0/4] selftests/mm: Tweaks to the cow test Mark Brown
2025-06-10 14:13 ` [PATCH 1/4] kselftest/mm: Clarify errors for pipe() Mark Brown
2025-06-11 12:09 ` David Hildenbrand
2025-06-10 14:13 ` [PATCH 2/4] selftests/mm: Convert some cow error reports to ksft_perror() Mark Brown
2025-06-11 12:10 ` David Hildenbrand
2025-06-11 12:14 ` Mark Brown
2025-06-10 14:13 ` [PATCH 3/4] selftests/mm: Don't compare return values to in cow Mark Brown
2025-06-11 12:10 ` David Hildenbrand
2025-06-10 14:13 ` [PATCH 4/4] selftests/mm: Add messages about test errors to the cow tests Mark Brown
2025-06-11 12:11 ` David Hildenbrand
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).