[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201203064826.30832-2-tesheng@andestech.com>
Date: Thu, 3 Dec 2020 14:48:25 +0800
From: Eric Lin <tesheng@...estech.com>
To: <linux-kernel@...r.kernel.org>, <linux-riscv@...ts.infradead.org>,
<walken@...gle.com>, <vbabka@...e.cz>, <peterx@...hat.com>,
<akpm@...ux-foundation.org>, <penberg@...nel.org>,
<aou@...s.berkeley.edu>, <palmer@...belt.com>,
<paul.walmsley@...ive.com>, <hch@...radead.org>
CC: Eric Lin <tesheng@...estech.com>, Alan Kao <alankao@...estech.com>
Subject: [PATCH v2 1/2] riscv/mm: Introduce a die_kernel_fault() helper function
Like arm64, this patch adds a die_kernel_fault() helper
to ensure the same semantics for the different kernel faults.
Signed-off-by: Eric Lin <tesheng@...estech.com>
Cc: Alan Kao <alankao@...estech.com>
---
arch/riscv/mm/fault.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 3c8b9e433c67..0bcfd0e1b39e 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -19,6 +19,19 @@
#include "../kernel/head.h"
+static void die_kernel_fault(const char *msg, unsigned long addr,
+ struct pt_regs *regs)
+{
+ bust_spinlocks(1);
+
+ pr_alert("Unable to handle kernel %s at virtual address " REG_FMT "\n", msg,
+ addr);
+
+ bust_spinlocks(0);
+ die(regs, "Oops");
+ do_exit(SIGKILL);
+}
+
static inline void no_context(struct pt_regs *regs, unsigned long addr)
{
/* Are we prepared to handle this kernel fault? */
--
2.17.0
Powered by blists - more mailing lists