From: Hemanth Selam <hemanth.selam@gmail.com>
To: Lorenzo Stoakes <ljs@kernel.org>
Cc: David Hildenbrand <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>,
Yury Khrustalev <yury.khrustalev@arm.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
"Liam R . Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Hemanth Selam <hemanth.selam@gmail.com>
Subject: Re: [PATCH] selftests/mm: remove the local PKEY_UNRESTRICTED fallback
Date: Wed, 19 Aug 2026 13:17:09 +0530 [thread overview]
Message-ID: <20260819074709.1345730-1-hemanth.selam@gmail.com> (raw)
In-Reply-To: <aoRto6bT3Fv0jm7k@lucifer>
On Tue, Aug 18, 2026 at 02:36:00PM +0000, Lorenzo Stoakes (ARM) wrote:
> But it might be worth checking in this case to see whether the problem here
> is in fact that we need PKEY_UNRESTRICTED defined over there?
>
> Hemanth - could you check please?
Checked. It is already defined over there:
tools/include/uapi/asm-generic/mman-common.h:88:#define PKEY_UNRESTRICTED 0x0
and it does reach the mm selftests without "make headers", through
TOOLS_INCLUDES. The path is not obvious, so for the record:
pkey-helpers.h
-> <linux/mman.h> tools/include/uapi/linux/mman.h
-> <asm/mman.h> /usr/include/asm/mman.h
(tools/include/uapi/asm/mman.h does not exist)
-> <asm-generic/mman.h> tools/include/uapi/asm-generic/mman.h
(-isystem puts it ahead of the system one)
-> <asm-generic/mman-common-tools.h>
-> <asm-generic/mman-common.h> PKEY_UNRESTRICTED
I built the pkey tests with KHDR_INCLUDES pointing at an empty directory,
that is, as if "make headers" had never run. They build, and cpp -dD
says:
defined in: tools/include/uapi/asm-generic/mman-common.h
Pointing TOOLS_INCLUDES at an empty directory as well is what breaks it:
pkey-helpers.h:188:30: error: 'PKEY_UNRESTRICTED' undeclared
So that is where the definition comes from, and dropping the local
#ifndef does not depend on "make headers" being run.
The one thing worth being aware of is that the redirection into
tools/include/uapi only happens because the system <asm/mman.h> includes
<asm-generic/mman.h>.
I had a look at the history you pointed at, thanks, that was the part I
had wrong. If I read it right this is exactly the mechanism from commit
e076eaca5906 ("selftests: break the dependency upon local header
files"), which added TOOLS_INCLUDES to the mm selftests so they build
without "make headers". So for this particular macro the value comes
from the in-tree snapshot rather than from whatever the build host has
installed, which is why it does not vary per system here.
That said, if you would still rather keep the #ifndef as a matter of
course, I have no objection to dropping the patch, the guard costs
nothing. I mainly wanted to answer the question with something
measured rather than assumed.
> This is incorrect. We explicitly do not have this requirement in mm selftests,
> and they're often built without having to do this step and tooling has been
> provided _explicitly_ to allow for that, which is why this kind of thing exists
> right now.
You are right, the commit message was wrong on that point. v2 drops
that paragraph and describes the above instead.
On the powerpc header David mentioned, I would rather leave
tools/testing/selftests/powerpc/include/pkeys.h alone. It is not the
same construct: it is an unconditional
#undef PKEY_UNRESTRICTED
#define PKEY_UNRESTRICTED 0x0
next to other powerpc specific overrides such as PKEY_DISABLE_EXECUTE
0x4, and that header only includes <sys/mman.h>, never <linux/mman.h>.
A probe including just <sys/mman.h> does not find PKEY_UNRESTRICTED,
with or without TOOLS_INCLUDES, so the definition there is load bearing
and removing it would break the build.
Thanks,
Hemanth
next prev parent reply other threads:[~2026-08-19 7:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 11:49 [PATCH] selftests/mm: remove the local PKEY_UNRESTRICTED fallback Hemanth Selam
2026-08-18 13:11 ` David Hildenbrand (Arm)
2026-08-18 13:29 ` Lorenzo Stoakes (ARM)
2026-08-18 14:18 ` David Hildenbrand (Arm)
2026-08-18 14:36 ` Lorenzo Stoakes (ARM)
2026-08-19 7:47 ` Hemanth Selam [this message]
2026-08-19 7:47 ` [PATCH v2] " Hemanth Selam
2026-08-19 14:15 ` David Hildenbrand (Arm)
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=20260819074709.1345730-1-hemanth.selam@gmail.com \
--to=hemanth.selam@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=kevin.brodsky@arm.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=yury.khrustalev@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.