All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault()
@ 2020-09-05  6:07 Pekka Enberg
  2020-09-09  3:14 ` Palmer Dabbelt
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka Enberg @ 2020-09-05  6:07 UTC (permalink / raw)
  To: linux-riscv; +Cc: Pekka Enberg, palmer

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.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 arch/riscv/mm/fault.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index a173432ccf82..1359e21c0c62 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -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);
-- 
2.26.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for-next] riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault()
  2020-09-05  6:07 [PATCH for-next] riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault() Pekka Enberg
@ 2020-09-09  3:14 ` Palmer Dabbelt
  0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2020-09-09  3:14 UTC (permalink / raw)
  To: penberg; +Cc: penberg, linux-riscv

On Fri, 04 Sep 2020 23:07:26 PDT (-0700), penberg@kernel.org 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.
>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>
> ---
>  arch/riscv/mm/fault.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
> index a173432ccf82..1359e21c0c62 100644
> --- a/arch/riscv/mm/fault.c
> +++ b/arch/riscv/mm/fault.c
> @@ -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
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-09  3:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05  6:07 [PATCH for-next] riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault() Pekka Enberg
2020-09-09  3:14 ` Palmer Dabbelt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.