linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: wang lian <lianux.mm@gmail.com>
Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org,
	brauner@kernel.org, david@redhat.com, gkwang@linx-info.com,
	jannh@google.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	lorenzo.stoakes@oracle.com, p1ucky0923@gmail.com,
	ryncsn@gmail.com, shuah@kernel.org, sj@kernel.org,
	vbabka@suse.cz, zijing.zhang@proton.me
Subject: Re: [PATCH v3] selftests/mm: add process_madvise() tests
Date: Wed, 09 Jul 2025 10:46:07 -0400	[thread overview]
Message-ID: <A1603D53-03B1-412F-8FE8-851A37E4C08C@nvidia.com> (raw)
In-Reply-To: <20250709123224.6593-1-lianux.mm@gmail.com>

On 9 Jul 2025, at 8:32, wang lian wrote:

> Hi Zi Yan,
> Thanks for testing the patch and reporting this build failure.
> I don't have an arm64 environment readily available for testing, so I
> appreciate you catching this. I suspect this is caused by missing or
> older userspace headers in the cross-compilation toolchain.

Right. My /usr/include/sys does not have pidfd.h. IMHO selftests
should not rely on userspace headers, otherwise we cannot test
latest kernel changes.

> I will try to fix this in the next version. If the problem persists, a
> good solution would be to manually define the syscall wrapper to avoid
> the dependency on <sys/pidfd.h>.

Based on what I see in other mm tests, the following patch fixes my
compilation issue.

diff --git a/tools/testing/selftests/mm/process_madv.c b/tools/testing/selftests/mm/process_madv.c
index 3d26105b4781..8bf11433d6e6 100644
--- a/tools/testing/selftests/mm/process_madv.c
+++ b/tools/testing/selftests/mm/process_madv.c
@@ -10,13 +10,14 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <linux/mman.h>
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <sched.h>
-#include <sys/pidfd.h>
+#include <linux/pidfd.h>
+#include <linux/uio.h>
 #include "vm_util.h"

-#include "../pidfd/pidfd.h"

 FIXTURE(process_madvise)
 {
@@ -240,7 +241,7 @@ TEST_F(process_madvise, remote_collapse)
 	close(pipe_info[0]);
 	child_pid = info.pid;

-	pidfd = pidfd_open(child_pid, 0);
+	pidfd = syscall(__NR_pidfd_open, child_pid, 0);
 	ASSERT_GE(pidfd, 0);

 	/* Baseline Check from Parent's perspective */
@@ -312,7 +313,7 @@ TEST_F(process_madvise, invalid_pidfd)
 	if (child_pid == 0)
 		exit(0);

-	pidfd = pidfd_open(child_pid, 0);
+	pidfd = syscall(__NR_pidfd_open, child_pid, 0);
 	ASSERT_GE(pidfd, 0);

 	/* Wait for the child to ensure it has terminated. */


Best Regards,
Yan, Zi


  parent reply	other threads:[~2025-07-09 14:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03  4:43 wang lian
2025-07-05 19:32 ` Lorenzo Stoakes
2025-07-06  6:07   ` [PATCH v3] selftests/vm: Add tests for process_madvise() 王炼
2025-07-08 17:44 ` [PATCH v3] selftests/mm: add process_madvise() tests Zi Yan
2025-07-09 12:32   ` wang lian
2025-07-09 12:51     ` Lorenzo Stoakes
2025-07-10 11:29       ` wang lian
2025-07-09 14:46     ` Zi Yan [this message]
2025-07-10  8:42       ` Mark Brown
2025-07-10 16:28         ` Zi Yan
2025-07-11  8:34           ` Mark Brown
2025-07-11  8:49             ` Lorenzo Stoakes
2025-07-11 12:09               ` wang lian
2025-07-10 11:40       ` wang lian
2025-07-10 13:42 [PATCH v4] " Mark Brown
2025-07-11 12:19 ` [PATCH v3] " wang lian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A1603D53-03B1-412F-8FE8-851A37E4C08C@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@redhat.com \
    --cc=gkwang@linx-info.com \
    --cc=jannh@google.com \
    --cc=lianux.mm@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=p1ucky0923@gmail.com \
    --cc=ryncsn@gmail.com \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=zijing.zhang@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox