Skip to contentSkip to conversation

riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault()

PATCH In review Pekka Enberg 2 participants 2 messages Sep 5, 2020 – Sep 9, 2020 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault()

If the page fault "cause" is EXC_INST_PAGE_FAULT, set the FAULT_FLAG_INSTRUCTION flag to let handle_mm_fault() and friends know about it. This has no functional changes because RISC-V uses the default arch_vma_access_permitted() implementation, which always returns true. However, dax_pmd_fault(), for example, has a tracepoint that uses FAULT_FLAG_INSTRUCTION, so we might as well set it.

---
 arch/riscv/mm/fault.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/fault.c +2 -1
index a173432ccf82..1359e21c0c62 100644
@@ -234,7 +234,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
 
 	if (cause == EXC_STORE_PAGE_FAULT)
 		flags |= FAULT_FLAG_WRITE;
-
+	else if (cause == EXC_INST_PAGE_FAULT)
+		flags |= FAULT_FLAG_INSTRUCTION;
 retry:
 	mmap_read_lock(mm);
 	vma = find_vma(mm, addr);
Signature · 7 lines
2.26.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#1 lore raw
Quoted 17 lines · On Fri, 04 Sep 2020 23:07:26 PDT (-0700), [email protected] wrote:

If the page fault "cause" is EXC_INST_PAGE_FAULT, set the FAULT_FLAG_INSTRUCTION flag to let handle_mm_fault() and friends know about it. This has no functional changes because RISC-V uses the default arch_vma_access_permitted() implementation, which always returns true. However, dax_pmd_fault(), for example, has a tracepoint that uses FAULT_FLAG_INSTRUCTION, so we might as well set it.

---
 arch/riscv/mm/fault.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/fault.c +0 -0
index a173432ccf82..1359e21c0c62 100644

arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 241

Quoted 9 lines
arch/riscv/mm/fault.c +2 -1
@@ -234,7 +234,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
 
 	if (cause == EXC_STORE_PAGE_FAULT)
 		flags |= FAULT_FLAG_WRITE;
-
+	else if (cause == EXC_INST_PAGE_FAULT)
+		flags |= FAULT_FLAG_INSTRUCTION;
 retry:
 	mmap_read_lock(mm);
 	vma = find_vma(mm, addr);

Thanks, this is on for-next.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv