arm64: stacktrace: rename unwind_next_common() -> unwind_next_frame_record()
authorMark Rutland <mark.rutland@arm.com>
Thu, 1 Sep 2022 13:06:40 +0000 (14:06 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 9 Sep 2022 11:30:07 +0000 (12:30 +0100)
The unwind_next_common() function unwinds a single frame record. There
are other unwind steps (e.g. unwinding through trampolines) which are
handled in the regular kernel unwinder, and in future there may be other
common unwind helpers.

Clarify the purpose of unwind_next_common() by renaming it to
unwind_next_frame_record(). At the same time, add commentary, and delete
the redundant comment at the top of asm/stacktrace/common.h.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Kalesh Singh <kaleshsingh@google.com>
Reviewed-by: Madhavan T. Venkataraman <madvenka@linux.microsoft.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Cc: Fuad Tabba <tabba@google.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20220901130646.1316937-4-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/stacktrace/common.h
arch/arm64/kernel/stacktrace.c
arch/arm64/kvm/hyp/nvhe/stacktrace.c
arch/arm64/kvm/stacktrace.c

index 0fbae7c78b70de1d51fee2dbee790cc75f86459e..a74fa301fe953ad694b3c64da7efa45cc3b4cee8 100644 (file)
@@ -2,13 +2,6 @@
 /*
  * Common arm64 stack unwinder code.
  *
- * To implement a new arm64 stack unwinder:
- *     1) Include this header
- *
- *     2) Call into unwind_next_common() from your top level unwind
- *        function, passing it the validation and translation callbacks
- *        (though the later can be NULL if no translation is required).
- *
  * See: arch/arm64/kernel/stacktrace.c for the reference implementation.
  *
  * Copyright (C) 2012 ARM Ltd.
@@ -145,9 +138,19 @@ typedef bool (*on_accessible_stack_fn)(const struct task_struct *tsk,
                                       unsigned long sp, unsigned long size,
                                       struct stack_info *info);
 
-static inline int unwind_next_common(struct unwind_state *state,
-                                    on_accessible_stack_fn accessible,
-                                    stack_trace_translate_fp_fn translate_fp)
+/**
+ * unwind_next_frame_record() - Unwind to the next frame record.
+ *
+ * @state:        the current unwind state.
+ * @accessible:   determines whether the frame record is accessible
+ * @translate_fp: translates the fp prior to access (may be NULL)
+ *
+ * Return: 0 upon success, an error code otherwise.
+ */
+static inline int
+unwind_next_frame_record(struct unwind_state *state,
+                        on_accessible_stack_fn accessible,
+                        stack_trace_translate_fp_fn translate_fp)
 {
        struct stack_info info;
        unsigned long fp = state->fp, kern_fp = fp;
index 056fb045d0e0c6da922453d9c6f05a59bc7a0d99..4c8865e495feabed9b63f7ae32e885ef726a9054 100644 (file)
@@ -109,7 +109,7 @@ static int notrace unwind_next(struct unwind_state *state)
        if (fp == (unsigned long)task_pt_regs(tsk)->stackframe)
                return -ENOENT;
 
-       err = unwind_next_common(state, on_accessible_stack, NULL);
+       err = unwind_next_frame_record(state, on_accessible_stack, NULL);
        if (err)
                return err;
 
index 50a1fa6b5c0440ded3c48daff8f48601088a73bd..579b46aa9a553358439eaf40a89fb788b99b73c3 100644 (file)
@@ -71,7 +71,7 @@ static bool on_accessible_stack(const struct task_struct *tsk,
 
 static int unwind_next(struct unwind_state *state)
 {
-       return unwind_next_common(state, on_accessible_stack, NULL);
+       return unwind_next_frame_record(state, on_accessible_stack, NULL);
 }
 
 static void notrace unwind(struct unwind_state *state,
index b9cf551d9d31d833be357f5a53346daedb5d8759..b69c18a26567d1cdd95774fd99a36d45b163282f 100644 (file)
@@ -97,8 +97,8 @@ static bool on_accessible_stack(const struct task_struct *tsk,
 
 static int unwind_next(struct unwind_state *state)
 {
-       return unwind_next_common(state, on_accessible_stack,
-                                 kvm_nvhe_stack_kern_va);
+       return unwind_next_frame_record(state, on_accessible_stack,
+                                       kvm_nvhe_stack_kern_va);
 }
 
 static void unwind(struct unwind_state *state,