Lines Matching full:stack
3 * Generic stack depot for storing stack traces.
5 * Some debugging tools need to save stack traces of certain events which can
7 * free stacks for each object, but storing two stack traces per object
11 * Instead, stack depot maintains a hashtable of unique stacktraces. Since alloc
40 #define STACK_ALLOC_ORDER 2 /* 'Slab' size order for stack depot, 4 pages */
67 u32 size; /* Number of frames in the stack */
118 /* Allocation of a new stack in raw storage */
122 struct stack_record *stack; in depot_alloc_stack() local
123 size_t required_size = struct_size(stack, entries, size); in depot_alloc_stack()
129 WARN_ONCE(1, "Stack depot reached limit capacity"); in depot_alloc_stack()
146 stack = stack_slabs[depot_index] + depot_offset; in depot_alloc_stack()
148 stack->hash = hash; in depot_alloc_stack()
149 stack->size = size; in depot_alloc_stack()
150 stack->handle.slabindex = depot_index; in depot_alloc_stack()
151 stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN; in depot_alloc_stack()
152 stack->handle.valid = 1; in depot_alloc_stack()
153 stack->handle.extra = 0; in depot_alloc_stack()
154 memcpy(stack->entries, entries, flex_array_size(stack, entries, size)); in depot_alloc_stack()
157 return stack; in depot_alloc_stack()
179 pr_info("Stack Depot is disabled\n"); in is_stack_depot_disabled()
223 pr_err("Stack Depot hash table allocation failed, disabling\n"); in stack_depot_early_init()
258 pr_info("Stack Depot allocating hash table of %lu entries with kvcalloc\n", in stack_depot_init()
262 pr_err("Stack Depot hash table allocation failed, disabling\n"); in stack_depot_init()
273 /* Calculate hash for a stack */
296 /* Find a stack that is equal to the one stored in entries in the hash */
313 * stack_depot_snprint - print stack entries from a depot into a buffer
315 * @handle: Stack depot handle which was returned from
338 * stack_depot_print - print stack entries from a depot
340 * @stack: Stack depot handle which was returned from
344 void stack_depot_print(depot_stack_handle_t stack) in stack_depot_print() argument
349 nr_entries = stack_depot_fetch(stack, &entries); in stack_depot_print()
356 * stack_depot_fetch - Fetch stack entries from a depot
358 * @handle: Stack depot handle which was returned from
370 struct stack_record *stack; in stack_depot_fetch() local
377 WARN(1, "slab index %d out of bounds (%d) for stack id %08x\n", in stack_depot_fetch()
384 stack = slab + offset; in stack_depot_fetch()
386 *entries = stack->entries; in stack_depot_fetch()
387 return stack->size; in stack_depot_fetch()
392 * __stack_depot_save - Save a stack trace from an array
398 * @can_alloc: Allocate stack slabs (increased chance of failure if false)
400 * Saves a stack trace from @entries array of size @nr_entries. If @can_alloc is
401 * %true, is allowed to replenish the stack slab pool in case no space is left
403 * any allocations and will fail if no space is left to store the stack trace.
405 * If the stack trace in @entries is from an interrupt, only the portion up to
409 * bits of the stack handle, and retrieved using stack_depot_get_extra_bits()
417 * Return: The handle of the stack struct stored in depot, 0 on failure.
432 * If this stack trace is from an interrupt, including anything before in __stack_depot_save()
448 * Fast path: look the stack trace up without locking. in __stack_depot_save()
458 * Check if the current or the next stack slab need to be initialized. in __stack_depot_save()
496 * We didn't need to store this stack trace, but let's keep in __stack_depot_save()
518 * stack_depot_save - Save a stack trace from an array
527 * Return: The handle of the stack struct stored in depot, 0 on failure.