* [PATCH v2] arm64: Support ARM64_VA_BITS=52 when setting ARCH_MMAP_RND_BITS_MAX
@ 2025-04-17 11:47 Kornel Dulęba
2025-04-29 20:27 ` Will Deacon
0 siblings, 1 reply; 2+ messages in thread
From: Kornel Dulęba @ 2025-04-17 11:47 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: Steve Capper, linux-arm-kernel, linux-kernel, ssradjacoumar,
chromeos-krk-upstreaming, Kornel Dulęba, Anshuman Khandual
When the 52-bit virtual addressing was introduced the select like
ARCH_MMAP_RND_BITS_MAX logic was never updated to account for it.
Because of that the rnd max bits knob is set to the default value of 18
when ARM64_VA_BITS=52.
Fix this by setting ARCH_MMAP_RND_BITS_MAX to the same value that would
be used if 48-bit addressing was used. Higher values can't used here
because 52-bit addressing is used only if the caller provides a hint to
mmap, with a fallback to 48-bit. The knob in question is an upper bound
for what the user can set in /proc/sys/vm/mmap_rnd_bits, which in turn
is used to determine how many random bits can be inserted into the base
address used for mmap allocations. Since 48-bit allocations are legal
with ARM64_VA_BITS=52, we need to make sure that the base address is
small enough to facilitate this.
Fixes: b6d00d47e81a ("arm64: mm: Introduce 52-bit Kernel VAs")
Signed-off-by: Kornel Dulęba <korneld@google.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
v2:
- Update commit message to explain why we need to set the same value as
in the 48-bit case.
arch/arm64/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index a182295e6f08..6527d0d5656a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -333,9 +333,9 @@ config ARCH_MMAP_RND_BITS_MAX
default 24 if ARM64_VA_BITS=39
default 27 if ARM64_VA_BITS=42
default 30 if ARM64_VA_BITS=47
- default 29 if ARM64_VA_BITS=48 && ARM64_64K_PAGES
- default 31 if ARM64_VA_BITS=48 && ARM64_16K_PAGES
- default 33 if ARM64_VA_BITS=48
+ default 29 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_64K_PAGES
+ default 31 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_16K_PAGES
+ default 33 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52)
default 14 if ARM64_64K_PAGES
default 16 if ARM64_16K_PAGES
default 18
--
2.49.0.777.g153de2bbd5-goog
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] arm64: Support ARM64_VA_BITS=52 when setting ARCH_MMAP_RND_BITS_MAX
2025-04-17 11:47 [PATCH v2] arm64: Support ARM64_VA_BITS=52 when setting ARCH_MMAP_RND_BITS_MAX Kornel Dulęba
@ 2025-04-29 20:27 ` Will Deacon
0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2025-04-29 20:27 UTC (permalink / raw)
To: Catalin Marinas, Kornel Dulęba
Cc: kernel-team, Will Deacon, Steve Capper, linux-arm-kernel,
linux-kernel, ssradjacoumar, chromeos-krk-upstreaming,
Anshuman Khandual
On Thu, 17 Apr 2025 11:47:54 +0000, Kornel Dulęba wrote:
> When the 52-bit virtual addressing was introduced the select like
> ARCH_MMAP_RND_BITS_MAX logic was never updated to account for it.
> Because of that the rnd max bits knob is set to the default value of 18
> when ARM64_VA_BITS=52.
> Fix this by setting ARCH_MMAP_RND_BITS_MAX to the same value that would
> be used if 48-bit addressing was used. Higher values can't used here
> because 52-bit addressing is used only if the caller provides a hint to
> mmap, with a fallback to 48-bit. The knob in question is an upper bound
> for what the user can set in /proc/sys/vm/mmap_rnd_bits, which in turn
> is used to determine how many random bits can be inserted into the base
> address used for mmap allocations. Since 48-bit allocations are legal
> with ARM64_VA_BITS=52, we need to make sure that the base address is
> small enough to facilitate this.
>
> [...]
Applied to arm64 (for-next/mm), thanks!
[1/1] arm64: Support ARM64_VA_BITS=52 when setting ARCH_MMAP_RND_BITS_MAX
https://git.kernel.org/arm64/c/f101c5644771
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-29 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-17 11:47 [PATCH v2] arm64: Support ARM64_VA_BITS=52 when setting ARCH_MMAP_RND_BITS_MAX Kornel Dulęba
2025-04-29 20:27 ` Will Deacon
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®