]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/trace/perf.h
btrfs: Get rid of the confusing btrfs_file_extent_inline_len
[mirror_ubuntu-bionic-kernel.git] / include / trace / perf.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
ee53bbd1
SRRH
2
3#undef TRACE_SYSTEM_VAR
4
5#ifdef CONFIG_PERF_EVENTS
6
7#undef __entry
8#define __entry entry
9
10#undef __get_dynamic_array
11#define __get_dynamic_array(field) \
12 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
13
14#undef __get_dynamic_array_len
15#define __get_dynamic_array_len(field) \
16 ((__entry->__data_loc_##field >> 16) & 0xffff)
17
18#undef __get_str
934de5f2 19#define __get_str(field) ((char *)__get_dynamic_array(field))
ee53bbd1
SRRH
20
21#undef __get_bitmask
22#define __get_bitmask(field) (char *)__get_dynamic_array(field)
23
ee53bbd1
SRRH
24#undef __perf_count
25#define __perf_count(c) (__count = (c))
26
27#undef __perf_task
28#define __perf_task(t) (__task = (t))
29
30#undef DECLARE_EVENT_CLASS
31#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
32static notrace void \
33perf_trace_##call(void *__data, proto) \
34{ \
2425bcb9 35 struct trace_event_call *event_call = __data; \
62323a14 36 struct trace_event_data_offsets_##call __maybe_unused __data_offsets;\
a7237765 37 struct trace_event_raw_##call *entry; \
ee53bbd1 38 struct pt_regs *__regs; \
e93735be 39 u64 __count = 1; \
ee53bbd1
SRRH
40 struct task_struct *__task = NULL; \
41 struct hlist_head *head; \
42 int __entry_size; \
43 int __data_size; \
44 int rctx; \
45 \
d0ee8f4a 46 __data_size = trace_event_get_offsets_##call(&__data_offsets, args); \
ee53bbd1
SRRH
47 \
48 head = this_cpu_ptr(event_call->perf_events); \
e87c6bc3
YS
49 if (!bpf_prog_array_valid(event_call) && \
50 __builtin_constant_p(!__task) && !__task && \
51 hlist_empty(head)) \
ee53bbd1
SRRH
52 return; \
53 \
54 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
55 sizeof(u64)); \
56 __entry_size -= sizeof(u32); \
57 \
1e1dcd93 58 entry = perf_trace_buf_alloc(__entry_size, &__regs, &rctx); \
ee53bbd1
SRRH
59 if (!entry) \
60 return; \
61 \
62 perf_fetch_caller_regs(__regs); \
63 \
64 tstruct \
65 \
66 { assign; } \
67 \
85b67bcb
AS
68 perf_trace_run_bpf_submit(entry, __entry_size, rctx, \
69 event_call, __count, __regs, \
70 head, __task); \
ee53bbd1
SRRH
71}
72
73/*
74 * This part is compiled out, it is only here as a build time check
75 * to make sure that if the tracepoint handling changes, the
76 * perf probe will fail to compile unless it too is updated.
77 */
78#undef DEFINE_EVENT
79#define DEFINE_EVENT(template, call, proto, args) \
80static inline void perf_test_probe_##call(void) \
81{ \
82 check_trace_callback_type_##call(perf_trace_##template); \
83}
84
85
86#undef DEFINE_EVENT_PRINT
87#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
88 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
89
90#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
91#endif /* CONFIG_PERF_EVENTS */