Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace_stack.c Create Date:2022-07-28 12:11:33
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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

Proto:static void check_stack(unsigned long ip, unsigned long *stack)

Type:void

Parameter:

TypeParameterName
unsigned longip
unsigned long *stack
159  frame_size = READ_ONCE(tracer_frame)
162  this_size = stack & THREAD_SIZE - 1
163  this_size = THREAD_SIZE - this_size
165  this_size -= frame_size
167  If this_size <= stack_trace_max_size Then Return
171  If Not object_is_on_stack(stack) Then Return
175  If in_nmi() Then Return
178  local_irq_save(flags)
179  r sched/core.c and kernel_lock.c: ( & stack_trace_max_lock)
182  If Value for the false possibility is greater at compile time(!frame_size) Then this_size -= tracer_frame
186  If this_size <= stack_trace_max_size Then Go to 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  When i < stack_trace_nr_entries cycle
197  If stack_dump_trace[i] == ip Then Break
205  If i == stack_trace_nr_entries Then i = 0
211  x = 0
212  start = stack
213  top = (start & ~(THREAD_SIZE - 1)) + THREAD_SIZE
223  When i < stack_trace_nr_entries cycle
224  found = 0
226  stack_trace_index[x] = this_size
227  p = start
229  When p < top && i < stack_trace_nr_entries cycle
236  this_size = stack_trace_index[x++] = (top - p) * sizeof(unsignedlong)
238  found = 1
240  start = p + 1
249  tracer_frame = (p - stack) * sizeof(unsignedlong)
256  If Not found Then i++
274  stack_trace_nr_entries = x
276  If task_stack_end_corrupted(current process) Then
277  print_max_stack()
278  BUG()
281  out :
282  arch_spin_unlock( & stack_trace_max_lock)
283  local_irq_restore(flags)
Caller
NameDescribe
stack_trace_call