arm64: stacktrace: Factor out on_accessible_stack_common()
authorKalesh Singh <kaleshsingh@google.com>
Tue, 26 Jul 2022 07:37:35 +0000 (00:37 -0700)
committerMarc Zyngier <maz@kernel.org>
Tue, 26 Jul 2022 09:48:09 +0000 (10:48 +0100)
Move common on_accessible_stack checks to stacktrace/common.h. This is
used in the implementation of the nVHE hypervisor unwinder later in
this series.

Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Tested-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220726073750.3219117-3-kaleshsingh@google.com
arch/arm64/include/asm/stacktrace.h
arch/arm64/include/asm/stacktrace/common.h

index 79f455b37c84df9472536b5168ec2e24c3ad7a87..43f4b4a6d38377c84893e9adfdb84eda6cec6b71 100644 (file)
@@ -65,8 +65,8 @@ static inline bool on_accessible_stack(const struct task_struct *tsk,
                                       unsigned long sp, unsigned long size,
                                       struct stack_info *info)
 {
-       if (info)
-               info->type = STACK_TYPE_UNKNOWN;
+       if (on_accessible_stack_common(tsk, sp, size, info))
+               return true;
 
        if (on_task_stack(tsk, sp, size, info))
                return true;
@@ -74,8 +74,6 @@ static inline bool on_accessible_stack(const struct task_struct *tsk,
                return false;
        if (on_irq_stack(sp, size, info))
                return true;
-       if (on_overflow_stack(sp, size, info))
-               return true;
        if (on_sdei_stack(sp, size, info))
                return true;
 
index 64ae4f6b06fe7a757e053d65e44d4e0ec553819e..f58b786460d33c2272f04c4dc85aceb7ab3cfcc0 100644 (file)
@@ -62,6 +62,9 @@ struct unwind_state {
        struct task_struct *task;
 };
 
+static inline bool on_overflow_stack(unsigned long sp, unsigned long size,
+                                    struct stack_info *info);
+
 static inline bool on_stack(unsigned long sp, unsigned long size,
                            unsigned long low, unsigned long high,
                            enum stack_type type, struct stack_info *info)
@@ -80,6 +83,21 @@ static inline bool on_stack(unsigned long sp, unsigned long size,
        return true;
 }
 
+static inline bool on_accessible_stack_common(const struct task_struct *tsk,
+                                             unsigned long sp,
+                                             unsigned long size,
+                                             struct stack_info *info)
+{
+       if (info)
+               info->type = STACK_TYPE_UNKNOWN;
+
+       /*
+        * Both the kernel and nvhe hypervisor make use of
+        * an overflow_stack
+        */
+       return on_overflow_stack(sp, size, info);
+}
+
 static inline void unwind_init_common(struct unwind_state *state,
                                      struct task_struct *task)
 {