From: Andrew Morton <akpm@linux-foundation.org>
To: Dev Jain <dev.jain@arm.com>
Cc: david@redhat.com, catalin.marinas@arm.com, will@kernel.org,
lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
vbabka@suse.cz, rppt@kernel.org, surenb@google.com,
mhocko@suse.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, suzuki.poulose@arm.com,
steven.price@arm.com, gshan@redhat.com,
linux-arm-kernel@lists.infradead.org,
yang@os.amperecomputing.com, ryan.roberts@arm.com,
anshuman.khandual@arm.com
Subject: Re: [PATCH v4] arm64: Enable permission change on arm64 kernel block mappings
Date: Sat, 19 Jul 2025 16:29:30 -0700 [thread overview]
Message-ID: <20250719162930.f5ad0d97c880e9e1f569f9e7@linux-foundation.org> (raw)
In-Reply-To: <6e51f756-786f-4f15-a50a-73a482cc73a2@arm.com>
On Sat, 19 Jul 2025 19:22:20 +0530 Dev Jain <dev.jain@arm.com> wrote:
> Gentle ping
>
> On 03/07/25 8:44 pm, Dev Jain wrote:
> > This patch paves the path to enable huge mappings in vmalloc space and
> > linear map space by default on arm64. For this we must ensure that we can
> > handle any permission games on the kernel (init_mm) pagetable. Currently,
> > __change_memory_common() uses apply_to_page_range() which does not support
> > changing permissions for block mappings. We attempt to move away from this
> > by using the pagewalk API, similar to what riscv does right now; however,
> > it is the responsibility of the caller to ensure that we do not pass a
> > range overlapping a partial block mapping or cont mapping; in such a case,
> > the system must be able to support range splitting.
> >
>
> ...
>
> > arch/arm64/mm/pageattr.c | 155 +++++++++++++++++++++++++++++++--------
> > include/linux/pagewalk.h | 3 +
> > mm/pagewalk.c | 24 ++++++
> > 3 files changed, 150 insertions(+), 32 deletions(-)
I'm assuming this is an arm patch - the pagewalk.c bits are simple.
However, I have nits!
> > --- a/mm/pagewalk.c
> > +++ b/mm/pagewalk.c
> > @@ -633,6 +633,30 @@ int walk_kernel_page_table_range(unsigned long start, unsigned long end,
> > return walk_pgd_range(start, end, &walk);
> > }
> >
> > +/*
> > + * Use this function to walk the kernel page tables locklessly. It should be
> > + * guaranteed that the caller has exclusive access over the range they are
> > + * operating on - that there should be no concurrent access, for example,
> > + * changing permissions for vmalloc objects.
> > + */
All the other function documenation in there is in kerneldoc form.
> > +int walk_kernel_page_table_range_lockless(unsigned long start, unsigned long end,
> > + const struct mm_walk_ops *ops, void *private)
> > +{
> > + struct mm_walk walk = {
> > + .ops = ops,
> > + .mm = &init_mm,
> > + .private = private,
> > + .no_vma = true
> > + };
> > +
> > + if (start >= end)
> > + return -EINVAL;
> > + if (!check_ops_valid(ops))
> > + return -EINVAL;
> > +
> > + return walk_pgd_range(start, end, &walk);
> > +}
> > +
If we were being stingy with the bytes we could wrap this in some
`#ifdef CONFIG_ARM' thing,
This is awfully similar to walk_page_range_novma(). We could combine
them in some fashion but the results would be a bit messy.
next prev parent reply other threads:[~2025-07-19 23:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 15:14 Dev Jain
2025-07-04 4:11 ` Dev Jain
2025-07-19 13:52 ` Dev Jain
2025-07-19 23:29 ` Andrew Morton [this message]
2025-07-24 8:19 ` Catalin Marinas
2025-07-24 10:40 ` Dev Jain
2025-07-24 11:58 ` Catalin Marinas
2025-07-24 17:51 ` Yang Shi
2025-07-25 4:23 ` Dev Jain
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=20250719162930.f5ad0d97c880e9e1f569f9e7@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=gshan@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=steven.price@arm.com \
--cc=surenb@google.com \
--cc=suzuki.poulose@arm.com \
--cc=vbabka@suse.cz \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox