diff mbox series

[RESEND,v2] RISC-V: mm: Support huge page in vmalloc_fault()

Message ID 20230310075021.3919290-1-dylan@andestech.com (mailing list archive)
State Accepted
Commit 47dd902aaee9b9341808a3a994793199e7eddb88
Headers show
Series [RESEND,v2] RISC-V: mm: Support huge page in vmalloc_fault() | expand

Checks

Context Check Description
conchuod/cover_letter success Single patches do not need cover letters
conchuod/tree_selection success Guessed tree name to be fixes
conchuod/fixes_present success Fixes tag present in non-next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 1 and now 1
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/build_rv64_clang_allmodconfig success Errors and warnings before: 18 this patch: 18
conchuod/module_param success Was 0 now: 0
conchuod/build_rv64_gcc_allmodconfig success Errors and warnings before: 18 this patch: 18
conchuod/alphanumeric_selects success Out of order selects before the patch: 728 and now 728
conchuod/build_rv32_defconfig success Build OK
conchuod/dtb_warn_rv64 success Errors and warnings before: 3 this patch: 3
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
conchuod/source_inline success Was 0 now: 0
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success Fixes tag looks correct
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Dylan Jhong March 10, 2023, 7:50 a.m. UTC
Since RISC-V supports ioremap() with huge page (pud/pmd) mapping,
However, vmalloc_fault() assumes that the vmalloc range is limited
to pte mappings. To complete the vmalloc_fault() function by adding
huge page support.

Fixes: 310f541a027b ("riscv: Enable HAVE_ARCH_HUGE_VMAP for 64BIT")
Signed-off-by: Dylan Jhong <dylan@andestech.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

---
Changes in v2:
  - Fix format of commit message
---
 arch/riscv/mm/fault.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Palmer Dabbelt March 15, 2023, 2:15 a.m. UTC | #1
On Fri, 10 Mar 2023 15:50:21 +0800, Dylan Jhong wrote:
> Since RISC-V supports ioremap() with huge page (pud/pmd) mapping,
> However, vmalloc_fault() assumes that the vmalloc range is limited
> to pte mappings. To complete the vmalloc_fault() function by adding
> huge page support.
> 
> 

Applied, thanks!

[1/1] RISC-V: mm: Support huge page in vmalloc_fault()
      https://git.kernel.org/palmer/c/47dd902aaee9

Best regards,
patchwork-bot+linux-riscv@kernel.org March 15, 2023, 2:20 a.m. UTC | #2
Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Fri, 10 Mar 2023 15:50:21 +0800 you wrote:
> Since RISC-V supports ioremap() with huge page (pud/pmd) mapping,
> However, vmalloc_fault() assumes that the vmalloc range is limited
> to pte mappings. To complete the vmalloc_fault() function by adding
> huge page support.
> 
> Fixes: 310f541a027b ("riscv: Enable HAVE_ARCH_HUGE_VMAP for 64BIT")
> Signed-off-by: Dylan Jhong <dylan@andestech.com>
> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> 
> [...]

Here is the summary with links:
  - [RESEND,v2] RISC-V: mm: Support huge page in vmalloc_fault()
    https://git.kernel.org/riscv/c/47dd902aaee9

You are awesome, thank you!
diff mbox series

Patch

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index eb0774d9c03b..4b9953b47d81 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -143,6 +143,8 @@  static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
 		no_context(regs, addr);
 		return;
 	}
+	if (pud_leaf(*pud_k))
+		goto flush_tlb;
 
 	/*
 	 * Since the vmalloc area is global, it is unnecessary
@@ -153,6 +155,8 @@  static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
 		no_context(regs, addr);
 		return;
 	}
+	if (pmd_leaf(*pmd_k))
+		goto flush_tlb;
 
 	/*
 	 * Make sure the actual PTE exists as well to
@@ -172,6 +176,7 @@  static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
 	 * ordering constraint, not a cache flush; it is
 	 * necessary even after writing invalid entries.
 	 */
+flush_tlb:
 	local_flush_tlb_page(addr);
 }