]> git.baikalelectronics.ru Git - kernel.git/commitdiff
stacktrace: Remove reliable argument from arch_stack_walk() callback
authorMark Brown <broonie@kernel.org>
Mon, 14 Sep 2020 15:34:07 +0000 (16:34 +0100)
committerWill Deacon <will@kernel.org>
Fri, 18 Sep 2020 13:24:16 +0000 (14:24 +0100)
Currently the callback passed to arch_stack_walk() has an argument called
reliable passed to it to indicate if the stack entry is reliable, a comment
says that this is used by some printk() consumers. However in the current
kernel none of the arch_stack_walk() implementations ever set this flag to
true and the only callback implementation we have is in the generic
stacktrace code which ignores the flag. It therefore appears that this
flag is redundant so we can simplify and clarify things by removing it.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Link: https://lore.kernel.org/r/20200914153409.25097-2-broonie@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/s390/kernel/stacktrace.c
arch/x86/kernel/stacktrace.c
include/linux/stacktrace.h
kernel/stacktrace.c

index fc5419ac64c8a5a4b7cf8d695e3f734beb2f9dac..7f1266c24f6bc1af2a4351b8f1210ec5f8b05128 100644 (file)
@@ -19,7 +19,7 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
 
        unwind_for_each_frame(&state, task, regs, 0) {
                addr = unwind_get_return_address(&state);
-               if (!addr || !consume_entry(cookie, addr, false))
+               if (!addr || !consume_entry(cookie, addr))
                        break;
        }
 }
@@ -56,7 +56,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
                        return -EINVAL;
 #endif
 
-               if (!consume_entry(cookie, addr, false))
+               if (!consume_entry(cookie, addr))
                        return -EINVAL;
        }
 
index 2fd698e28e4d5d23629fbcdbbd2ce40b89c9baef..8627fda8d9930dd553d8fef0576f01b581109fdf 100644 (file)
@@ -18,13 +18,13 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
        struct unwind_state state;
        unsigned long addr;
 
-       if (regs && !consume_entry(cookie, regs->ip, false))
+       if (regs && !consume_entry(cookie, regs->ip))
                return;
 
        for (unwind_start(&state, task, regs, NULL); !unwind_done(&state);
             unwind_next_frame(&state)) {
                addr = unwind_get_return_address(&state);
-               if (!addr || !consume_entry(cookie, addr, false))
+               if (!addr || !consume_entry(cookie, addr))
                        break;
        }
 }
@@ -72,7 +72,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
                if (!addr)
                        return -EINVAL;
 
-               if (!consume_entry(cookie, addr, false))
+               if (!consume_entry(cookie, addr))
                        return -EINVAL;
        }
 
@@ -114,7 +114,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
 {
        const void __user *fp = (const void __user *)regs->bp;
 
-       if (!consume_entry(cookie, regs->ip, false))
+       if (!consume_entry(cookie, regs->ip))
                return;
 
        while (1) {
@@ -128,7 +128,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
                        break;
                if (!frame.ret_addr)
                        break;
-               if (!consume_entry(cookie, frame.ret_addr, false))
+               if (!consume_entry(cookie, frame.ret_addr))
                        break;
                fp = frame.next_fp;
        }
index b7af8cc13eda4fcd543f89f054de57a3e75f3c5d..50e2df30b0aa316d056953710852c2b4d8caed59 100644 (file)
@@ -29,14 +29,11 @@ unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
  * stack_trace_consume_fn - Callback for arch_stack_walk()
  * @cookie:    Caller supplied pointer handed back by arch_stack_walk()
  * @addr:      The stack entry address to consume
- * @reliable:  True when the stack entry is reliable. Required by
- *             some printk based consumers.
  *
  * Return:     True, if the entry was consumed or skipped
  *             False, if there is no space left to store
  */
-typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr,
-                                      bool reliable);
+typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr);
 /**
  * arch_stack_walk - Architecture specific function to walk the stack
  * @consume_entry:     Callback which is invoked by the architecture code for
index 946f44a9e86afb77edbfe7e10eaca00020021eca..9f8117c7cfddee066477b27b6bafc397155da03a 100644 (file)
@@ -78,8 +78,7 @@ struct stacktrace_cookie {
        unsigned int    len;
 };
 
-static bool stack_trace_consume_entry(void *cookie, unsigned long addr,
-                                     bool reliable)
+static bool stack_trace_consume_entry(void *cookie, unsigned long addr)
 {
        struct stacktrace_cookie *c = cookie;
 
@@ -94,12 +93,11 @@ static bool stack_trace_consume_entry(void *cookie, unsigned long addr,
        return c->len < c->size;
 }
 
-static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long addr,
-                                             bool reliable)
+static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long addr)
 {
        if (in_sched_functions(addr))
                return true;
-       return stack_trace_consume_entry(cookie, addr, reliable);
+       return stack_trace_consume_entry(cookie, addr);
 }
 
 /**