xref: /linux-6.15/include/linux/stackdepot.h (revision 50f9481e)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * A generic stack depot implementation
4  *
5  * Author: Alexander Potapenko <[email protected]>
6  * Copyright (C) 2016 Google, Inc.
7  *
8  * Based on code by Dmitry Chernenkov.
9  */
10 
11 #ifndef _LINUX_STACKDEPOT_H
12 #define _LINUX_STACKDEPOT_H
13 
14 #include <linux/gfp.h>
15 
16 typedef u32 depot_stack_handle_t;
17 
18 depot_stack_handle_t __stack_depot_save(unsigned long *entries,
19 					unsigned int nr_entries,
20 					gfp_t gfp_flags, bool can_alloc);
21 
22 depot_stack_handle_t stack_depot_save(unsigned long *entries,
23 				      unsigned int nr_entries, gfp_t gfp_flags);
24 
25 unsigned int stack_depot_fetch(depot_stack_handle_t handle,
26 			       unsigned long **entries);
27 
28 unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
29 
30 #ifdef CONFIG_STACKDEPOT
31 int stack_depot_init(void);
32 #else
33 static inline int stack_depot_init(void)
34 {
35 	return 0;
36 }
37 #endif	/* CONFIG_STACKDEPOT */
38 
39 #endif
40