Skip to contentSkip to conversation

riscv: Remove redundant restriction on memory size

PATCH Applied Stuart Menefy 3 participants 3 messages Jun 24, 2024 – Sep 17, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: Remove redundant restriction on memory size

The original reason for reserving the top 4GiB of the direct map (space for modules/BPF/kernel) hasn't applied since the address map was reworked for KASAN.

---
 arch/riscv/mm/init.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/mm/init.c +1 -7
index 7e25606f858a..3998d1ca369c 100644
@@ -1130,13 +1130,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
 				0UL : PAGE_OFFSET - kernel_map.phys_addr;
 	kernel_map.va_kernel_pa_offset = kernel_map.virt_addr - kernel_map.phys_addr;
 
-	/*
-	 * The default maximal physical memory size is KERN_VIRT_SIZE for 32-bit
-	 * kernel, whereas for 64-bit kernel, the end of the virtual address
-	 * space is occupied by the modules/BPF/kernel mappings which reduces
-	 * the available size of the linear mapping.
-	 */
-	memory_limit = KERN_VIRT_SIZE - (IS_ENABLED(CONFIG_64BIT) ? SZ_4G : 0);
+	memory_limit = KERN_VIRT_SIZE;
 
 	/* Sanity check alignment and size */
 	BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0);
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Stuart,

Quoted 18 lines · Stuart Menefy

The original reason for reserving the top 4GiB of the direct map (space for modules/BPF/kernel) hasn't applied since the address map was reworked for KASAN.

---
  arch/riscv/mm/init.c | 8 +-------
  1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/mm/init.c +0 -1
index 7e25606f858a..3998d1ca369c 100644
@@ -1130,13 +1130,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
  				0UL : PAGE_OFFSET - kernel_map.phys_addr;
  	kernel_map.va_kernel_pa_offset = kernel_map.virt_addr - kernel_map.phys_addr;
 
-	/*

arch/riscv/mm/init.c asmlinkage void __init setup_vm(uintptr_t dtb_pa) · line 1136

Quoted 10 lines
arch/riscv/mm/init.c +1 -6
-	 * The default maximal physical memory size is KERN_VIRT_SIZE for 32-bit
-	 * kernel, whereas for 64-bit kernel, the end of the virtual address
-	 * space is occupied by the modules/BPF/kernel mappings which reduces
-	 * the available size of the linear mapping.
-	 */
-	memory_limit = KERN_VIRT_SIZE - (IS_ENABLED(CONFIG_64BIT) ? SZ_4G : 0);
+	memory_limit = KERN_VIRT_SIZE;
 
  	/* Sanity check alignment and size */
  	BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0);

I somehow totally missed this one, I guess this is the third fix you mentioned earlier right?

This is correct so you can add:

Thanks,

Alex

#2 lore raw
In reply to Stuart Menefy
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Mon, 24 Jun 2024 13:17:23 +0100 you wrote:

The original reason for reserving the top 4GiB of the direct map (space for modules/BPF/kernel) hasn't applied since the address map was reworked for KASAN.

---
 arch/riscv/mm/init.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Here is the summary with links:
- riscv: Remove redundant restriction on memory size

    https://git.kernel.org/riscv/c/d6a1928134a1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html