From: "David Hildenbrand (Red Hat)" <davidhildenbrandkernel@gmail.com>
To: Ryan Roberts <ryan.roberts@arm.com>,
catalin.marinas@arm.com, will@kernel.org,
yang@os.amperecomputing.com, ardb@kernel.org, dev.jain@arm.com,
scott@os.amperecomputing.com, cl@gentwo.org
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Guenter Roeck <groeck@google.com>
Subject: Re: [PATCH v2 1/3] arm64: mm: Don't sleep in split_kernel_leaf_mapping() when in atomic context
Date: Thu, 6 Nov 2025 22:08:14 +0100 [thread overview]
Message-ID: <de2f65f0-8b5d-4d64-a918-4f0c91ee3e59@gmail.com> (raw)
In-Reply-To: <20251106160945.3182799-2-ryan.roberts@arm.com>
On 06.11.25 17:09, Ryan Roberts wrote:
> It has been reported that split_kernel_leaf_mapping() is trying to sleep
> in non-sleepable context. It does this when acquiring the
> pgtable_split_lock mutex, when either CONFIG_DEBUG_PAGEALLOC or
> CONFIG_KFENCE are enabled, which change linear map permissions within
> softirq context during memory allocation and/or freeing. All other paths
> into this function are called from sleepable context and so are safe.
>
> But it turns out that the memory for which these 2 features may attempt
> to modify the permissions is always mapped by pte, so there is no need
> to attempt to split the mapping. So let's exit early in these cases and
> avoid attempting to take the mutex.
>
> There is one wrinkle to this approach; late-initialized kfence allocates
> it's pool from the buddy which may be block mapped. So we must hook that
> allocation and convert it to pte-mappings up front. Previously this was
> done as a side-effect of kfence protecting all the individual pages in
> its pool at init-time, but this no longer works due to the added early
> exit path in split_kernel_leaf_mapping().
>
> So instead, do this via the existing arch_kfence_init_pool() arch hook,
> and reuse the existing linear_map_split_to_ptes() infrastructure.
>
> Closes: https://lore.kernel.org/all/f24b9032-0ec9-47b1-8b95-c0eeac7a31c5@roeck-us.net/
> Fixes: a166563e7ec3 ("arm64: mm: support large block mapping when rodata=full")
> Tested-by: Guenter Roeck <groeck@google.com>
> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
Reviewed-by: David Hildenbrand (Red Hat) <david@kernel.org>
next prev parent reply other threads:[~2025-11-06 21:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 16:09 [PATCH v2 0/3] " Ryan Roberts
2025-11-06 16:09 ` [PATCH v2 1/3] arm64: mm: " Ryan Roberts
2025-11-06 20:46 ` Yang Shi
2025-11-07 12:10 ` Ryan Roberts
2025-11-06 21:08 ` David Hildenbrand (Red Hat) [this message]
2025-11-06 16:09 ` [PATCH v2 2/3] arm64: mm: Optimize range_split_to_ptes() Ryan Roberts
2025-11-06 20:47 ` Yang Shi
2025-11-06 16:09 ` [PATCH v2 3/3] arm64: mm: Tidy up force_pte_mapping() Ryan Roberts
2025-11-06 20:51 ` Yang Shi
2025-11-06 21:08 ` David Hildenbrand (Red Hat)
2025-11-07 15:53 ` [PATCH v2 0/3] Don't sleep in split_kernel_leaf_mapping() when in atomic context Will Deacon
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=de2f65f0-8b5d-4d64-a918-4f0c91ee3e59@gmail.com \
--to=davidhildenbrandkernel@gmail.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=cl@gentwo.org \
--cc=dev.jain@arm.com \
--cc=groeck@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ryan.roberts@arm.com \
--cc=scott@os.amperecomputing.com \
--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
all inboxes | Powered by JetHome®