xref: /linux/include/linux/unwind_deferred_types.h (revision c6439bfaabf25b736154ac5640c677da2c085db4)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_UNWIND_USER_DEFERRED_TYPES_H
3 #define _LINUX_UNWIND_USER_DEFERRED_TYPES_H
4 
5 struct unwind_cache {
6 	unsigned long		unwind_completed;
7 	unsigned int		nr_entries;
8 	unsigned long		entries[];
9 };
10 
11 /*
12  * The unwind_task_id is a unique identifier that maps to a user space
13  * stacktrace. It is generated the first time a deferred user space
14  * stacktrace is requested after a task has entered the kerenl and
15  * is cleared to zero when it exits. The mapped id will be a non-zero
16  * number.
17  *
18  * To simplify the generation of the 64 bit number, 32 bits will be
19  * the CPU it was generated on, and the other 32 bits will be a per
20  * cpu counter that gets incremented by two every time a new identifier
21  * is generated. The LSB will always be set to keep the value
22  * from being zero.
23  */
24 union unwind_task_id {
25 	struct {
26 		u32		cpu;
27 		u32		cnt;
28 	};
29 	u64			id;
30 };
31 
32 struct unwind_task_info {
33 	unsigned long		unwind_mask;
34 	struct unwind_cache	*cache;
35 	struct callback_head	work;
36 	union unwind_task_id	id;
37 };
38 
39 #endif /* _LINUX_UNWIND_USER_DEFERRED_TYPES_H */
40