Lines Matching defs:stack
3 * thread-stack.c: Synthesize a thread's stack using call / return events
22 #include "thread-stack.h"
40 * struct thread_stack_entry - thread stack entry.
68 * struct thread_stack - thread stack constructed from 'call' and 'return'
70 * @stack: array that holds the stack
71 * @cnt: number of entries in the stack
72 * @sz: current maximum stack size
83 * @br_stack_rb: branch stack (ring buffer)
84 * @br_stack_sz: maximum branch stack size
89 struct thread_stack_entry *stack;
111 * and therefore requires a stack for each cpu.
126 new_stack = realloc(ts->stack, sz);
130 ts->stack = new_stack;
201 if (!ts->stack &&
220 if (!ts->stack)
246 pr_warning("Out of memory: discarding thread stack\n");
251 ts->stack[ts->cnt].trace_end = trace_end;
252 ts->stack[ts->cnt++].ret_addr = ret_addr;
266 * further down the stack. If the return address is not found at all,
268 * seen for some reason) and leave the stack alone.
271 if (ts->stack[--i].ret_addr == ret_addr) {
283 if (ts->stack[--i].trace_end)
295 return ts->stack[ts->cnt - 1].cp->in_kernel;
311 tse = &ts->stack[idx];
355 pr_err("Error flushing thread stack!\n");
418 pr_warning("Out of memory: no thread stack\n");
427 * the stack might be completely invalid. Better to report nothing than
428 * to report something misleading, so flush the stack.
441 * stack.
459 * have flushed the stack) then try to make sense of the stack.
490 zfree(&ts->stack);
546 ip = ts->stack[ts->cnt - j].ret_addr;
587 ip = ts->stack[ts->cnt - j].ret_addr;
597 ip = ts->stack[ts->cnt - j].ret_addr;
676 * have subsequent addresses removed from the branch stack.
798 tse = &ts->stack[ts->cnt++];
824 struct thread_stack_entry *tse = &ts->stack[0];
831 if (ts->stack[ts->cnt - 1].ret_addr == ret_addr &&
832 !ts->stack[ts->cnt - 1].non_call) {
839 if (ts->stack[i].ret_addr != ret_addr ||
840 ts->stack[i].non_call)
926 /* If the stack is empty, push the userspace address */
940 parent = ts->stack[ts->cnt - 1].cp;
946 * At the bottom of the stack, assume the missing 'call' was
972 ts->stack[ts->cnt - 1].non_call = true;
1008 tse = &ts->stack[ts->cnt - 1];
1026 /* No point having 'trace end' on the bottom of the stack */
1027 if (!ts->cnt || (ts->cnt == 1 && ts->stack[0].ref == ref))
1030 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 1].cp, NULL, 0,
1053 struct thread_stack_entry *tse = &ts->stack[ts->cnt - 1];
1063 * not itself mean anything. Here the top-of-stack is removed,
1064 * by decrementing the stack count, and then further down, the
1065 * resulting top-of-stack is replaced with the actual target.
1071 sym = ts->stack[ts->cnt - 2].cp->sym;
1090 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 2].cp, tsym,
1095 /* Replace the top-of-stack with the actual target */
1096 ts->stack[ts->cnt - 1].cp = cp;
1128 /* Flush stack on exec */
1136 /* If the stack is empty, put the current symbol on the stack */
1161 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 1].cp,
1184 /* Pop kernel stack */
1191 /* x86 retpoline 'return' doesn't match the stack */
1193 ts->stack[ts->cnt - 1].ret_addr != sample->addr)
1216 * it a jmp. Make that visible by recording on the stack a
1218 * when a ret pops the stack, all jmps must be popped off first.
1220 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 1].cp,
1226 ts->stack[ts->cnt - 1].non_call = true;