[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A1603D53-03B1-412F-8FE8-851A37E4C08C@nvidia.com>
Date: Wed, 09 Jul 2025 10:46:07 -0400
From: Zi Yan <ziy@...dia.com>
To: wang lian <lianux.mm@...il.com>
Cc: Liam.Howlett@...cle.com, akpm@...ux-foundation.org, brauner@...nel.org,
david@...hat.com, gkwang@...x-info.com, jannh@...gle.com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-mm@...ck.org, lorenzo.stoakes@...cle.com, p1ucky0923@...il.com,
ryncsn@...il.com, shuah@...nel.org, sj@...nel.org, vbabka@...e.cz,
zijing.zhang@...ton.me
Subject: Re: [PATCH v3] selftests/mm: add process_madvise() tests
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
Powered by blists - more mailing lists