函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace_stack.c Create Date:2022-07-27 13:18:25
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:The stack tracer looks for a maximum stack at each call from a function. It* registers a callback from ftrace, and in that callback it examines the stack* size. It determines the stack size from the variable passed in, which is the

函数原型:static void check_stack(unsigned long ip, unsigned long *stack)

返回类型:void

参数:

类型参数名称
unsigned longip
unsigned long *stack
159  frame_size等于READ_ONCE(tracer_frame)
162  this_size等于stack按位与THREAD_SIZE减1
163  this_size等于THREAD_SIZEthis_size
165  this_size减等于frame_size
167  如果this_size小于等于stack_trace_max_size则返回
171  如果非object_is_on_stack(stack)则返回
175  如果in_nmi()则返回
178  local_irq_save(flags)
179  r sched/core.c and kernel_lock.c: ( & stack_trace_max_lock)
182  如果此条件成立可能性小(为编译器优化)(!frame_size)则this_size减等于tracer_frame
186  如果this_size小于等于stack_trace_max_size则转到:out
189  stack_trace_max_size等于this_size
191  stack_trace_nr_entries等于stack_trace_save - Save a stack trace into a storage array*@store: Pointer to storage array*@size: Size of the storage array*@skipnr: Number of entries to skip at the start of the stack trace* Return: Number of trace entries stored.
196 i小于stack_trace_nr_entries循环
197  如果stack_dump_trace[i]恒等于ip退出
205  如果i恒等于stack_trace_nr_entriesi等于0
211  x等于0
212  start等于stack
213  top等于start按位与THREAD_SIZE减1的差的反的值加THREAD_SIZE
223 i小于stack_trace_nr_entries循环
224  found等于0
226  stack_trace_index[x]等于this_size
227  p等于start
229 p小于topi小于stack_trace_nr_entries循环
236  this_size等于stack_trace_index[x++]等于topp的差乘sizeof(unsignedlong)
238  found等于1
240  start等于p加1
249  tracer_frame等于pstack的差乘sizeof(unsignedlong)
256  如果非foundi自加
274  stack_trace_nr_entries等于x
276  如果task_stack_end_corrupted(当前进程)则
277  print_max_stack()
278  BUG()
281  out :
282  arch_spin_unlock( & stack_trace_max_lock)
283  local_irq_restore(flags)
调用者
名称描述
stack_trace_call