[PATCH 5/6] LoongArch: Add raw_show_trace to enable guess unwinder default

From: Jinyang He
Date: Wed Dec 14 2022 - 23:03:27 EST


Inspired by MIPS, add cmdline parameter named 'raw_show_trace' to
enable guess unwinder in prologue unwinder unwind_start() default.
In some cases the guess is more efficient than prologue.

Signed-off-by: Jinyang He <hejinyang@xxxxxxxxxxx>
---
arch/loongarch/kernel/unwind_prologue.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
index 9677e13c4b4c..441641227c10 100644
--- a/arch/loongarch/kernel/unwind_prologue.c
+++ b/arch/loongarch/kernel/unwind_prologue.c
@@ -122,11 +122,22 @@ static bool unwind_by_prologue(struct unwind_state *state)
return !!__kernel_text_address(state->pc);
}

+static int raw_show_trace;
+static int __init set_raw_show_trace(char *str)
+{
+ raw_show_trace = 1;
+ return 1;
+}
+__setup("raw_show_trace", set_raw_show_trace);
+
static void start(struct unwind_state *state, struct task_struct *task,
struct pt_regs *regs)
{
state->first = true;

+ if (raw_show_trace)
+ unwind_register_unwinder(state, guard_unwinder);
+
/*
* The current PC is not kernel text address, we cannot find its
* relative symbol. Thus, prologue analysis will be broken. Luckly,
--
2.34.3