Skip to content

Commit 264c03a

Browse files
brooniewilldeacon
authored andcommitted
stacktrace: Remove reliable argument from arch_stack_walk() callback
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>
1 parent f75aef3 commit 264c03a

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

arch/s390/kernel/stacktrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
1919

2020
unwind_for_each_frame(&state, task, regs, 0) {
2121
addr = unwind_get_return_address(&state);
22-
if (!addr || !consume_entry(cookie, addr, false))
22+
if (!addr || !consume_entry(cookie, addr))
2323
break;
2424
}
2525
}
@@ -56,7 +56,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
5656
return -EINVAL;
5757
#endif
5858

59-
if (!consume_entry(cookie, addr, false))
59+
if (!consume_entry(cookie, addr))
6060
return -EINVAL;
6161
}
6262

arch/x86/kernel/stacktrace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
1818
struct unwind_state state;
1919
unsigned long addr;
2020

21-
if (regs && !consume_entry(cookie, regs->ip, false))
21+
if (regs && !consume_entry(cookie, regs->ip))
2222
return;
2323

2424
for (unwind_start(&state, task, regs, NULL); !unwind_done(&state);
2525
unwind_next_frame(&state)) {
2626
addr = unwind_get_return_address(&state);
27-
if (!addr || !consume_entry(cookie, addr, false))
27+
if (!addr || !consume_entry(cookie, addr))
2828
break;
2929
}
3030
}
@@ -72,7 +72,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
7272
if (!addr)
7373
return -EINVAL;
7474

75-
if (!consume_entry(cookie, addr, false))
75+
if (!consume_entry(cookie, addr))
7676
return -EINVAL;
7777
}
7878

@@ -114,7 +114,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
114114
{
115115
const void __user *fp = (const void __user *)regs->bp;
116116

117-
if (!consume_entry(cookie, regs->ip, false))
117+
if (!consume_entry(cookie, regs->ip))
118118
return;
119119

120120
while (1) {
@@ -128,7 +128,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
128128
break;
129129
if (!frame.ret_addr)
130130
break;
131-
if (!consume_entry(cookie, frame.ret_addr, false))
131+
if (!consume_entry(cookie, frame.ret_addr))
132132
break;
133133
fp = frame.next_fp;
134134
}

include/linux/stacktrace.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,11 @@ unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
2929
* stack_trace_consume_fn - Callback for arch_stack_walk()
3030
* @cookie: Caller supplied pointer handed back by arch_stack_walk()
3131
* @addr: The stack entry address to consume
32-
* @reliable: True when the stack entry is reliable. Required by
33-
* some printk based consumers.
3432
*
3533
* Return: True, if the entry was consumed or skipped
3634
* False, if there is no space left to store
3735
*/
38-
typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr,
39-
bool reliable);
36+
typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr);
4037
/**
4138
* arch_stack_walk - Architecture specific function to walk the stack
4239
* @consume_entry: Callback which is invoked by the architecture code for

kernel/stacktrace.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ struct stacktrace_cookie {
7878
unsigned int len;
7979
};
8080

81-
static bool stack_trace_consume_entry(void *cookie, unsigned long addr,
82-
bool reliable)
81+
static bool stack_trace_consume_entry(void *cookie, unsigned long addr)
8382
{
8483
struct stacktrace_cookie *c = cookie;
8584

@@ -94,12 +93,11 @@ static bool stack_trace_consume_entry(void *cookie, unsigned long addr,
9493
return c->len < c->size;
9594
}
9695

97-
static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long addr,
98-
bool reliable)
96+
static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long addr)
9997
{
10098
if (in_sched_functions(addr))
10199
return true;
102-
return stack_trace_consume_entry(cookie, addr, reliable);
100+
return stack_trace_consume_entry(cookie, addr);
103101
}
104102

105103
/**

0 commit comments

Comments
 (0)