save_stack_trace_tsk and struct stack_trace is no longer available in Linux 5.2+ save_stack_trace_tsk and struct stack_trace is no longer available in Linux 5.2+ multithreading multithreading

save_stack_trace_tsk and struct stack_trace is no longer available in Linux 5.2+


This question seemed so tempting so I did some digging here is my findings.

TLDR; stack_trace_save() functions replaced by arch_stack_walk() interfaces*

this is part of consolidation plan and remove duplicate code.linux commit 214d8ca6ee854 provide common architecture to walking stack trace.

the new interface called arch_stack_walk.made it more generic.this happened on 25th Apr 2019. and as per Kernel release History WikiIt was last changed in 5.1. in linux commit 3599fe12a125f.

answer your last question

what should I use?

save_stack_trace_tsk -> stack_trace_save_tsk

have different function declaration.


Solved by myself:

unsigned long store[64];int len = stack_trace_save_tsk(current, store, 64, 0);for (int i = 0; i < len; i ++) {    pr_info("stack at %p\n", store[i]);}