History

ftrace: Rework event_create_dir()

Rework event_create_dir() to use an array of static data instead of function pointers where possible. The problem is that it would call the function pointer on module load before parse_args(), possibly even before jump_labels were initialized. Luckily the generated functions don't use jump_labels but it still seems fragile. It also gets in the way of changing when we make the module map executable. The generated function are basically calling trace_define_field() with a bunch of static arguments. So instead of a function, capture these arguments in a static array, avoiding the function call. Now there are a number of cases where the fields are dynamic (syscall arguments, kprobes and uprobes), in which case a static array does not work, for these we preserve the function call. Luckily all these cases are not related to modules and so we can retain the function call for them. Also fix up all broken tracepoint definitions that now generate a compile error.

Peter Zijlstra committed 7 years ago

Commit 04ae87a1 parent 958de6621 files · +213 −249Browse files

Unified · Split

21 files
  1. drivers/infiniband/hw/hfi1/trace_tid.h +4 −4
  2. drivers/infiniband/hw/hfi1/trace_tx.h +1 −1
  3. drivers/lightnvm/pblk-trace.h +4 −4
  4. drivers/net/fjes/fjes_trace.h +1 −1
  5. drivers/net/wireless/ath/ath10k/trace.h +3 −3
  6. fs/xfs/scrub/trace.h +3 −3
  7. fs/xfs/xfs_trace.h +2 −2
  8. include/linux/trace_events.h +17 −1
  9. include/trace/events/filemap.h +1 −1
  10. include/trace/events/rpcrdma.h +1 −1
  11. include/trace/trace_events.h +21 −43
  12. kernel/trace/trace.h +14 −17
  13. kernel/trace/trace_entries.h +18 −48
  14. kernel/trace/trace_events.c +19 −1
  15. kernel/trace/trace_events_hist.c +7 −1
  16. kernel/trace/trace_export.c +39 −67
  17. kernel/trace/trace_kprobe.c +14 −2
  18. kernel/trace/trace_syscalls.c +20 −30
  19. kernel/trace/trace_uprobe.c +7 −2
  20. net/mac80211/trace.h +14 −14
  21. net/wireless/trace.h +3 −3
drivers/infiniband/hw/hfi1/trace_tid.h+4−4
@@ -138,10 +138,10 @@ TRACE_EVENT(/* put_tid */ · 137 unmodified lines
138 TP_ARGS(dd, index, type, pa, order),138 TP_ARGS(dd, index, type, pa, order),
139 TP_STRUCT__entry(/* entry */139 TP_STRUCT__entry(/* entry */
140 DD_DEV_ENTRY(dd)140 DD_DEV_ENTRY(dd)
141 __field(unsigned long, pa);141 __field(unsigned long, pa)
142 __field(u32, index);142 __field(u32, index)
143 __field(u32, type);143 __field(u32, type)
144 __field(u16, order);144 __field(u16, order)
145 ),145 ),
146 TP_fast_assign(/* assign */146 TP_fast_assign(/* assign */
147 DD_DEV_ASSIGN(dd);147 DD_DEV_ASSIGN(dd);
drivers/infiniband/hw/hfi1/trace_tx.h+1−1
@@ -588,7 +588,7 @@ TRACE_EVENT(hfi1_sdma_user_reqinfo, · 587 unmodified lines
588 TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 *i),588 TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 *i),
589 TP_ARGS(dd, ctxt, subctxt, i),589 TP_ARGS(dd, ctxt, subctxt, i),
590 TP_STRUCT__entry(590 TP_STRUCT__entry(
591 DD_DEV_ENTRY(dd);591 DD_DEV_ENTRY(dd)
592 __field(u16, ctxt)592 __field(u16, ctxt)
593 __field(u8, subctxt)593 __field(u8, subctxt)
594 __field(u8, ver_opcode)594 __field(u8, ver_opcode)
drivers/lightnvm/pblk-trace.h+4−4
@@ -46,7 +46,7 @@ TRACE_EVENT(pblk_chunk_reset, · 45 unmodified lines
46 TP_STRUCT__entry(46 TP_STRUCT__entry(
47 __string(name, name)47 __string(name, name)
48 __field(u64, ppa)48 __field(u64, ppa)
49 __field(int, state);49 __field(int, state)
50 ),50 ),
51 51
52 TP_fast_assign(52 TP_fast_assign(
@@ -72,7 +72,7 @@ TRACE_EVENT(pblk_chunk_state, · 19 unmodified lines
72 TP_STRUCT__entry(72 TP_STRUCT__entry(
73 __string(name, name)73 __string(name, name)
74 __field(u64, ppa)74 __field(u64, ppa)
75 __field(int, state);75 __field(int, state)
76 ),76 ),
77 77
78 TP_fast_assign(78 TP_fast_assign(
@@ -98,7 +98,7 @@ TRACE_EVENT(pblk_line_state, · 19 unmodified lines
98 TP_STRUCT__entry(98 TP_STRUCT__entry(
99 __string(name, name)99 __string(name, name)
100 __field(int, line)100 __field(int, line)
101 __field(int, state);101 __field(int, state)
102 ),102 ),
103 103
104 TP_fast_assign(104 TP_fast_assign(
@@ -121,7 +121,7 @@ TRACE_EVENT(pblk_state, · 16 unmodified lines
121 121
122 TP_STRUCT__entry(122 TP_STRUCT__entry(
123 __string(name, name)123 __string(name, name)
124 __field(int, state);124 __field(int, state)
125 ),125 ),
126 126
127 TP_fast_assign(127 TP_fast_assign(
drivers/net/fjes/fjes_trace.h+1−1
@@ -28,7 +28,7 @@ TRACE_EVENT(fjes_hw_issue_request_command, · 27 unmodified lines
28 __field(u8, cs_busy)28 __field(u8, cs_busy)
29 __field(u8, cs_complete)29 __field(u8, cs_complete)
30 __field(int, timeout)30 __field(int, timeout)
31 __field(int, ret);31 __field(int, ret)
32 ),32 ),
33 TP_fast_assign(33 TP_fast_assign(
34 __entry->cr_req = cr->bits.req_code;34 __entry->cr_req = cr->bits.req_code;
drivers/net/wireless/ath/ath10k/trace.h+3−3
@@ -239,7 +239,7 @@ TRACE_EVENT(ath10k_wmi_dbglog, · 238 unmodified lines
239 TP_STRUCT__entry(239 TP_STRUCT__entry(
240 __string(device, dev_name(ar->dev))240 __string(device, dev_name(ar->dev))
241 __string(driver, dev_driver_string(ar->dev))241 __string(driver, dev_driver_string(ar->dev))
242 __field(u8, hw_type);242 __field(u8, hw_type)
243 __field(size_t, buf_len)243 __field(size_t, buf_len)
244 __dynamic_array(u8, buf, buf_len)244 __dynamic_array(u8, buf, buf_len)
245 ),245 ),
@@ -269,7 +269,7 @@ TRACE_EVENT(ath10k_htt_pktlog, · 23 unmodified lines
269 TP_STRUCT__entry(269 TP_STRUCT__entry(
270 __string(device, dev_name(ar->dev))270 __string(device, dev_name(ar->dev))
271 __string(driver, dev_driver_string(ar->dev))271 __string(driver, dev_driver_string(ar->dev))
272 __field(u8, hw_type);272 __field(u8, hw_type)
273 __field(u16, buf_len)273 __field(u16, buf_len)
274 __dynamic_array(u8, pktlog, buf_len)274 __dynamic_array(u8, pktlog, buf_len)
275 ),275 ),
@@ -435,7 +435,7 @@ TRACE_EVENT(ath10k_htt_rx_desc, · 159 unmodified lines
435 TP_STRUCT__entry(435 TP_STRUCT__entry(
436 __string(device, dev_name(ar->dev))436 __string(device, dev_name(ar->dev))
437 __string(driver, dev_driver_string(ar->dev))437 __string(driver, dev_driver_string(ar->dev))
438 __field(u8, hw_type);438 __field(u8, hw_type)
439 __field(u16, len)439 __field(u16, len)
440 __dynamic_array(u8, rxdesc, len)440 __dynamic_array(u8, rxdesc, len)
441 ),441 ),
fs/xfs/scrub/trace.h+3−3
@@ -329,7 +329,7 @@ TRACE_EVENT(xchk_btree_op_error, · 328 unmodified lines
329 __field(int, level)329 __field(int, level)
330 __field(xfs_agnumber_t, agno)330 __field(xfs_agnumber_t, agno)
331 __field(xfs_agblock_t, bno)331 __field(xfs_agblock_t, bno)
332 __field(int, ptr);332 __field(int, ptr)
333 __field(int, error)333 __field(int, error)
334 __field(void *, ret_ip)334 __field(void *, ret_ip)
335 ),335 ),
@@ -414,7 +414,7 @@ TRACE_EVENT(xchk_btree_error, · 78 unmodified lines
414 __field(int, level)414 __field(int, level)
415 __field(xfs_agnumber_t, agno)415 __field(xfs_agnumber_t, agno)
416 __field(xfs_agblock_t, bno)416 __field(xfs_agblock_t, bno)
417 __field(int, ptr);417 __field(int, ptr)
418 __field(void *, ret_ip)418 __field(void *, ret_ip)
419 ),419 ),
420 TP_fast_assign(420 TP_fast_assign(
@@ -452,7 +452,7 @@ TRACE_EVENT(xchk_ifork_btree_error, · 31 unmodified lines
452 __field(int, level)452 __field(int, level)
453 __field(xfs_agnumber_t, agno)453 __field(xfs_agnumber_t, agno)
454 __field(xfs_agblock_t, bno)454 __field(xfs_agblock_t, bno)
455 __field(int, ptr);455 __field(int, ptr)
456 __field(void *, ret_ip)456 __field(void *, ret_ip)
457 ),457 ),
458 TP_fast_assign(458 TP_fast_assign(
fs/xfs/xfs_trace.h+2−2
@@ -218,8 +218,8 @@ DECLARE_EVENT_CLASS(xfs_bmap_class, · 217 unmodified lines
218 TP_STRUCT__entry(218 TP_STRUCT__entry(
219 __field(dev_t, dev)219 __field(dev_t, dev)
220 __field(xfs_ino_t, ino)220 __field(xfs_ino_t, ino)
221 __field(void *, leaf);221 __field(void *, leaf)
222 __field(int, pos);222 __field(int, pos)
223 __field(xfs_fileoff_t, startoff)223 __field(xfs_fileoff_t, startoff)
224 __field(xfs_fsblock_t, startblock)224 __field(xfs_fsblock_t, startblock)
225 __field(xfs_filblks_t, blockcount)225 __field(xfs_filblks_t, blockcount)
include/linux/trace_events.h+17−1
@@ -187,6 +187,22 @@ enum trace_reg { · 186 unmodified lines
187 187
188struct trace_event_call;188struct trace_event_call;
189 189
190#define TRACE_FUNCTION_TYPE ((const char *)~0UL)
191
192struct trace_event_fields {
193 const char *type;
194 union {
195 struct {
196 const char *name;
197 const int size;
198 const int align;
199 const int is_signed;
200 const int filter_type;
201 };
202 int (*define_fields)(struct trace_event_call *);
203 };
204};
205
190struct trace_event_class {206struct trace_event_class {
191 const char *system;207 const char *system;
192 void *probe;208 void *probe;
@@ -195,7 +211,7 @@ struct trace_event_class { · 2 unmodified lines
195#endif211#endif
196 int (*reg)(struct trace_event_call *event,212 int (*reg)(struct trace_event_call *event,
197 enum trace_reg type, void *data);213 enum trace_reg type, void *data);
198 int (*define_fields)(struct trace_event_call *);214 struct trace_event_fields *fields_array;
199 struct list_head *(*get_fields)(struct trace_event_call *);215 struct list_head *(*get_fields)(struct trace_event_call *);
200 struct list_head fields;216 struct list_head fields;
201 int (*raw_init)(struct trace_event_call *);217 int (*raw_init)(struct trace_event_call *);
include/trace/events/filemap.h+1−1
@@ -85,7 +85,7 @@ TRACE_EVENT(file_check_and_advance_wb_err, · 84 unmodified lines
85 TP_ARGS(file, old),85 TP_ARGS(file, old),
86 86
87 TP_STRUCT__entry(87 TP_STRUCT__entry(
88 __field(struct file *, file);88 __field(struct file *, file)
89 __field(unsigned long, i_ino)89 __field(unsigned long, i_ino)
90 __field(dev_t, s_dev)90 __field(dev_t, s_dev)
91 __field(errseq_t, old)91 __field(errseq_t, old)
include/trace/events/rpcrdma.h+1−1
@@ -1507,7 +1507,7 @@ TRACE_EVENT(svcrdma_dma_map_page, · 1506 unmodified lines
1507 TP_ARGS(rdma, page),1507 TP_ARGS(rdma, page),
1508 1508
1509 TP_STRUCT__entry(1509 TP_STRUCT__entry(
1510 __field(const void *, page);1510 __field(const void *, page)
1511 __string(device, rdma->sc_cm_id->device->name)1511 __string(device, rdma->sc_cm_id->device->name)
1512 __string(addr, rdma->sc_xprt.xpt_remotebuf)1512 __string(addr, rdma->sc_xprt.xpt_remotebuf)
1513 ),1513 ),
include/trace/trace_events.h+21−43
@@ -394,22 +394,16 @@ static struct trace_event_functions trace_event_type_funcs_##call = { \ · 393 unmodified lines
394#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)394#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
395 395
396#undef __field_ext396#undef __field_ext
397#define __field_ext(type, item, filter_type) \397#define __field_ext(_type, _item, _filter_type) { \
398 ret = trace_define_field(event_call, #type, #item, \398 .type = #_type, .name = #_item, \
399 offsetof(typeof(field), item), \399 .size = sizeof(_type), .align = __alignof__(_type), \
400 sizeof(field.item), \400 .is_signed = is_signed_type(_type), .filter_type = _filter_type },
401 is_signed_type(type), filter_type); \
402 if (ret) \
403 return ret;
404 401
405#undef __field_struct_ext402#undef __field_struct_ext
406#define __field_struct_ext(type, item, filter_type) \403#define __field_struct_ext(_type, _item, _filter_type) { \
407 ret = trace_define_field(event_call, #type, #item, \404 .type = #_type, .name = #_item, \
408 offsetof(typeof(field), item), \405 .size = sizeof(_type), .align = __alignof__(_type), \
409 sizeof(field.item), \406 0, .filter_type = _filter_type },
410 0, filter_type); \
411 if (ret) \
412 return ret;
413 407
414#undef __field408#undef __field
415#define __field(type, item) __field_ext(type, item, FILTER_OTHER)409#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
@@ -418,25 +412,16 @@ static struct trace_event_functions trace_event_type_funcs_##call = { \ · 2 unmodified lines
418#define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER)412#define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER)
419 413
420#undef __array414#undef __array
421#define __array(type, item, len) \415#define __array(_type, _item, _len) { \
422 do { \416 .type = #_type"["__stringify(_len)"]", .name = #_item, \
423 char *type_str = #type"["__stringify(len)"]"; \417 .size = sizeof(_type[_len]), .align = __alignof__(_type), \
424 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \418 .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER },
425 BUILD_BUG_ON(len <= 0); \
426 ret = trace_define_field(event_call, type_str, #item, \
427 offsetof(typeof(field), item), \
428 sizeof(field.item), \
429 is_signed_type(type), FILTER_OTHER); \
430 if (ret) \
431 return ret; \
432 } while (0);
433 419
434#undef __dynamic_array420#undef __dynamic_array
435#define __dynamic_array(type, item, len) \421#define __dynamic_array(_type, _item, _len) { \
436 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \422 .type = "__data_loc " #_type "[]", .name = #_item, \
437 offsetof(typeof(field), __data_loc_##item), \423 .size = 4, .align = 4, \
438 sizeof(field.__data_loc_##item), \424 .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER },
439 is_signed_type(type), FILTER_OTHER);
440 425
441#undef __string426#undef __string
442#define __string(item, src) __dynamic_array(char, item, -1)427#define __string(item, src) __dynamic_array(char, item, -1)
@@ -446,16 +431,9 @@ static struct trace_event_functions trace_event_type_funcs_##call = { \ · 3 unmodified lines
446 431
447#undef DECLARE_EVENT_CLASS432#undef DECLARE_EVENT_CLASS
448#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \433#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
449static int notrace __init \434static struct trace_event_fields trace_event_fields_##call[] = { \
450trace_event_define_fields_##call(struct trace_event_call *event_call) \435 tstruct \
451{ \436 {} };
452 struct trace_event_raw_##call field; \
453 int ret; \
454 \
455 tstruct; \
456 \
457 return ret; \
458}
459 437
460#undef DEFINE_EVENT438#undef DEFINE_EVENT
461#define DEFINE_EVENT(template, name, proto, args)439#define DEFINE_EVENT(template, name, proto, args)
@@ -613,7 +591,7 @@ static inline notrace int trace_event_get_offsets_##call( \ · 151 unmodified lines
613 *591 *
614 * static struct trace_event_class __used event_class_<template> = {592 * static struct trace_event_class __used event_class_<template> = {
615 * .system = "<system>",593 * .system = "<system>",
616 * .define_fields = trace_event_define_fields_<call>,594 * .fields_array = trace_event_fields_<call>,
617 * .fields = LIST_HEAD_INIT(event_class_##call.fields),595 * .fields = LIST_HEAD_INIT(event_class_##call.fields),
618 * .raw_init = trace_event_raw_init,596 * .raw_init = trace_event_raw_init,
619 * .probe = trace_event_raw_event_##call,597 * .probe = trace_event_raw_event_##call,
@@ -761,7 +739,7 @@ _TRACE_PERF_PROTO(call, PARAMS(proto)); \ · 141 unmodified lines
761static char print_fmt_##call[] = print; \739static char print_fmt_##call[] = print; \
762static struct trace_event_class __used __refdata event_class_##call = { \740static struct trace_event_class __used __refdata event_class_##call = { \
763 .system = TRACE_SYSTEM_STRING, \741 .system = TRACE_SYSTEM_STRING, \
764 .define_fields = trace_event_define_fields_##call, \742 .fields_array = trace_event_fields_##call, \
765 .fields = LIST_HEAD_INIT(event_class_##call.fields),\743 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
766 .raw_init = trace_event_raw_init, \744 .raw_init = trace_event_raw_init, \
767 .probe = trace_event_raw_event_##call, \745 .probe = trace_event_raw_event_##call, \
kernel/trace/trace.h+14−17
@@ -49,6 +49,9 @@ enum trace_type { · 48 unmodified lines
49#undef __field49#undef __field
50#define __field(type, item) type item;50#define __field(type, item) type item;
51 51
52#undef __field_fn
53#define __field_fn(type, item) type item;
54
52#undef __field_struct55#undef __field_struct
53#define __field_struct(type, item) __field(type, item)56#define __field_struct(type, item) __field(type, item)
54 57
@@ -68,26 +71,22 @@ enum trace_type { · 13 unmodified lines
68#define F_STRUCT(args...) args71#define F_STRUCT(args...) args
69 72
70#undef FTRACE_ENTRY73#undef FTRACE_ENTRY
71#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \74#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
72 struct struct_name { \75 struct struct_name { \
73 struct trace_entry ent; \76 struct trace_entry ent; \
74 tstruct \77 tstruct \
75 }78 }
76 79
77#undef FTRACE_ENTRY_DUP80#undef FTRACE_ENTRY_DUP
78#define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk, filter)81#define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk)
79 82
80#undef FTRACE_ENTRY_REG83#undef FTRACE_ENTRY_REG
81#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, \84#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
82 filter, regfn) \85 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
83 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
84 filter)
85 86
86#undef FTRACE_ENTRY_PACKED87#undef FTRACE_ENTRY_PACKED
87#define FTRACE_ENTRY_PACKED(name, struct_name, id, tstruct, print, \88#define FTRACE_ENTRY_PACKED(name, struct_name, id, tstruct, print) \
88 filter) \89 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print)) __packed
89 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
90 filter) __packed
91 90
92#include "trace_entries.h"91#include "trace_entries.h"
93 92
@@ -1899,17 +1898,15 @@ extern void tracing_log_err(struct trace_array *tr, · 1805 unmodified lines
1899#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str, strlen(str))1898#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str, strlen(str))
1900 1899
1901#undef FTRACE_ENTRY1900#undef FTRACE_ENTRY
1902#define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \1901#define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \
1903 extern struct trace_event_call \1902 extern struct trace_event_call \
1904 __aligned(4) event_##call;1903 __aligned(4) event_##call;
1905#undef FTRACE_ENTRY_DUP1904#undef FTRACE_ENTRY_DUP
1906#define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print, filter) \1905#define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \
1907 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print), \1906 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))
1908 filter)
1909#undef FTRACE_ENTRY_PACKED1907#undef FTRACE_ENTRY_PACKED
1910#define FTRACE_ENTRY_PACKED(call, struct_name, id, tstruct, print, filter) \1908#define FTRACE_ENTRY_PACKED(call, struct_name, id, tstruct, print) \
1911 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print), \1909 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))
1912 filter)
1913 1910
1914#include "trace_entries.h"1911#include "trace_entries.h"
1915 1912
kernel/trace/trace_entries.h+18−48
@@ -61,15 +61,13 @@ FTRACE_ENTRY_REG(function, ftrace_entry, · 60 unmodified lines
61 TRACE_FN,61 TRACE_FN,
62 62
63 F_STRUCT(63 F_STRUCT(
64 __field( unsigned long, ip )64 __field_fn( unsigned long, ip )
65 __field( unsigned long, parent_ip )65 __field_fn( unsigned long, parent_ip )
66 ),66 ),
67 67
68 F_printk(" %ps <-- %ps",68 F_printk(" %ps <-- %ps",
69 (void *)__entry->ip, (void *)__entry->parent_ip),69 (void *)__entry->ip, (void *)__entry->parent_ip),
70 70
71 FILTER_TRACE_FN,
72
73 perf_ftrace_event_register71 perf_ftrace_event_register
74);72);
75 73
@@ -84,9 +82,7 @@ FTRACE_ENTRY_PACKED(funcgraph_entry, ftrace_graph_ent_entry, · 8 unmodified lines
84 __field_desc( int, graph_ent, depth )82 __field_desc( int, graph_ent, depth )
85 ),83 ),
86 84
87 F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth),85 F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth)
88
89 FILTER_OTHER
90);86);
91 87
92/* Function return entry */88/* Function return entry */
@@ -97,18 +93,16 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry, · 4 unmodified lines
97 F_STRUCT(93 F_STRUCT(
98 __field_struct( struct ftrace_graph_ret, ret )94 __field_struct( struct ftrace_graph_ret, ret )
99 __field_desc( unsigned long, ret, func )95 __field_desc( unsigned long, ret, func )
96 __field_desc( unsigned long, ret, overrun )
100 __field_desc( unsigned long long, ret, calltime)97 __field_desc( unsigned long long, ret, calltime)
101 __field_desc( unsigned long long, ret, rettime )98 __field_desc( unsigned long long, ret, rettime )
102 __field_desc( unsigned long, ret, overrun )
103 __field_desc( int, ret, depth )99 __field_desc( int, ret, depth )
104 ),100 ),
105 101
106 F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d",102 F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d",
107 (void *)__entry->func, __entry->depth,103 (void *)__entry->func, __entry->depth,
108 __entry->calltime, __entry->rettime,104 __entry->calltime, __entry->rettime,
109 __entry->depth),105 __entry->depth)
110
111 FILTER_OTHER
112);106);
113 107
114/*108/*
@@ -137,9 +131,7 @@ FTRACE_ENTRY(context_switch, ctx_switch_entry, · 22 unmodified lines
137 F_printk("%u:%u:%u ==> %u:%u:%u [%03u]",131 F_printk("%u:%u:%u ==> %u:%u:%u [%03u]",
138 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,132 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
139 __entry->next_pid, __entry->next_prio, __entry->next_state,133 __entry->next_pid, __entry->next_prio, __entry->next_state,
140 __entry->next_cpu),134 __entry->next_cpu)
141
142 FILTER_OTHER
143);135);
144 136
145/*137/*
@@ -157,9 +149,7 @@ FTRACE_ENTRY_DUP(wakeup, ctx_switch_entry, · 11 unmodified lines
157 F_printk("%u:%u:%u ==+ %u:%u:%u [%03u]",149 F_printk("%u:%u:%u ==+ %u:%u:%u [%03u]",
158 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,150 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
159 __entry->next_pid, __entry->next_prio, __entry->next_state,151 __entry->next_pid, __entry->next_prio, __entry->next_state,
160 __entry->next_cpu),152 __entry->next_cpu)
161
162 FILTER_OTHER
163);153);
164 154
165/*155/*
@@ -183,9 +173,7 @@ FTRACE_ENTRY(kernel_stack, stack_entry, · 17 unmodified lines
183 (void *)__entry->caller[0], (void *)__entry->caller[1],173 (void *)__entry->caller[0], (void *)__entry->caller[1],
184 (void *)__entry->caller[2], (void *)__entry->caller[3],174 (void *)__entry->caller[2], (void *)__entry->caller[3],
185 (void *)__entry->caller[4], (void *)__entry->caller[5],175 (void *)__entry->caller[4], (void *)__entry->caller[5],
186 (void *)__entry->caller[6], (void *)__entry->caller[7]),176 (void *)__entry->caller[6], (void *)__entry->caller[7])
187
188 FILTER_OTHER
189);177);
190 178
191FTRACE_ENTRY(user_stack, userstack_entry,179FTRACE_ENTRY(user_stack, userstack_entry,
@@ -203,9 +191,7 @@ FTRACE_ENTRY(user_stack, userstack_entry, · 11 unmodified lines
203 (void *)__entry->caller[0], (void *)__entry->caller[1],191 (void *)__entry->caller[0], (void *)__entry->caller[1],
204 (void *)__entry->caller[2], (void *)__entry->caller[3],192 (void *)__entry->caller[2], (void *)__entry->caller[3],
205 (void *)__entry->caller[4], (void *)__entry->caller[5],193 (void *)__entry->caller[4], (void *)__entry->caller[5],
206 (void *)__entry->caller[6], (void *)__entry->caller[7]),194 (void *)__entry->caller[6], (void *)__entry->caller[7])
207
208 FILTER_OTHER
209);195);
210 196
211/*197/*
@@ -222,9 +208,7 @@ FTRACE_ENTRY(bprint, bprint_entry, · 10 unmodified lines
222 ),208 ),
223 209
224 F_printk("%ps: %s",210 F_printk("%ps: %s",
225 (void *)__entry->ip, __entry->fmt),211 (void *)__entry->ip, __entry->fmt)
226
227 FILTER_OTHER
228);212);
229 213
230FTRACE_ENTRY_REG(print, print_entry,214FTRACE_ENTRY_REG(print, print_entry,
@@ -239,8 +223,6 @@ FTRACE_ENTRY_REG(print, print_entry, · 8 unmodified lines
239 F_printk("%ps: %s",223 F_printk("%ps: %s",
240 (void *)__entry->ip, __entry->buf),224 (void *)__entry->ip, __entry->buf),
241 225
242 FILTER_OTHER,
243
244 ftrace_event_register226 ftrace_event_register
245);227);
246 228
@@ -254,9 +236,7 @@ FTRACE_ENTRY(raw_data, raw_data_entry, · 7 unmodified lines
254 ),236 ),
255 237
256 F_printk("id:%04x %08x",238 F_printk("id:%04x %08x",
257 __entry->id, (int)__entry->buf[0]),239 __entry->id, (int)__entry->buf[0])
258
259 FILTER_OTHER
260);240);
261 241
262FTRACE_ENTRY(bputs, bputs_entry,242FTRACE_ENTRY(bputs, bputs_entry,
@@ -269,9 +249,7 @@ FTRACE_ENTRY(bputs, bputs_entry, · 6 unmodified lines
269 ),249 ),
270 250
271 F_printk("%ps: %s",251 F_printk("%ps: %s",
272 (void *)__entry->ip, __entry->str),252 (void *)__entry->ip, __entry->str)
273
274 FILTER_OTHER
275);253);
276 254
277FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw,255FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw,
@@ -283,16 +261,14 @@ FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw, · 5 unmodified lines
283 __field_desc( resource_size_t, rw, phys )261 __field_desc( resource_size_t, rw, phys )
284 __field_desc( unsigned long, rw, value )262 __field_desc( unsigned long, rw, value )
285 __field_desc( unsigned long, rw, pc )263 __field_desc( unsigned long, rw, pc )
286 __field_desc( int, rw, map_id )264 __field_desc( int, rw, map_id )
287 __field_desc( unsigned char, rw, opcode )265 __field_desc( unsigned char, rw, opcode )
288 __field_desc( unsigned char, rw, width )266 __field_desc( unsigned char, rw, width )
289 ),267 ),
290 268
291 F_printk("%lx %lx %lx %d %x %x",269 F_printk("%lx %lx %lx %d %x %x",
292 (unsigned long)__entry->phys, __entry->value, __entry->pc,270 (unsigned long)__entry->phys, __entry->value, __entry->pc,
293 __entry->map_id, __entry->opcode, __entry->width),271 __entry->map_id, __entry->opcode, __entry->width)
294
295 FILTER_OTHER
296);272);
297 273
298FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map,274FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map,
@@ -304,15 +280,13 @@ FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map, · 5 unmodified lines
304 __field_desc( resource_size_t, map, phys )280 __field_desc( resource_size_t, map, phys )
305 __field_desc( unsigned long, map, virt )281 __field_desc( unsigned long, map, virt )
306 __field_desc( unsigned long, map, len )282 __field_desc( unsigned long, map, len )
307 __field_desc( int, map, map_id )283 __field_desc( int, map, map_id )
308 __field_desc( unsigned char, map, opcode )284 __field_desc( unsigned char, map, opcode )
309 ),285 ),
310 286
311 F_printk("%lx %lx %lx %d %x",287 F_printk("%lx %lx %lx %d %x",
312 (unsigned long)__entry->phys, __entry->virt, __entry->len,288 (unsigned long)__entry->phys, __entry->virt, __entry->len,
313 __entry->map_id, __entry->opcode),289 __entry->map_id, __entry->opcode)
314
315 FILTER_OTHER
316);290);
317 291
318 292
@@ -334,9 +308,7 @@ FTRACE_ENTRY(branch, trace_branch, · 15 unmodified lines
334 F_printk("%u:%s:%s (%u)%s",308 F_printk("%u:%s:%s (%u)%s",
335 __entry->line,309 __entry->line,
336 __entry->func, __entry->file, __entry->correct,310 __entry->func, __entry->file, __entry->correct,
337 __entry->constant ? " CONSTANT" : ""),311 __entry->constant ? " CONSTANT" : "")
338
339 FILTER_OTHER
340);312);
341 313
342 314
@@ -362,7 +334,5 @@ FTRACE_ENTRY(hwlat, hwlat_entry, · 19 unmodified lines
362 __entry->duration,334 __entry->duration,
363 __entry->outer_duration,335 __entry->outer_duration,
364 __entry->nmi_total_ts,336 __entry->nmi_total_ts,
365 __entry->nmi_count),337 __entry->nmi_count)
366
367 FILTER_OTHER
368);338);
kernel/trace/trace_events.c+19−1
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#include <linux/delay.h>24#include <linux/delay.h>
25 25
26#include <trace/events/sched.h>26#include <trace/events/sched.h>
27#include <trace/syscall.h>
27 28
28#include <asm/setup.h>29#include <asm/setup.h>
29 30
@@ -1990,7 +1991,24 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file) · 1960 unmodified lines
1990 */1991 */
1991 head = trace_get_fields(call);1992 head = trace_get_fields(call);
1992 if (list_empty(head)) {1993 if (list_empty(head)) {
1993 ret = call->class->define_fields(call);1994 struct trace_event_fields *field = call->class->fields_array;
1995 unsigned int offset = sizeof(struct trace_entry);
1996
1997 for (; field->type; field++) {
1998 if (field->type == TRACE_FUNCTION_TYPE) {
1999 ret = field->define_fields(call);
2000 break;
2001 }
2002
2003 offset = ALIGN(offset, field->align);
2004 ret = trace_define_field(call, field->type, field->name,
2005 offset, field->size,
2006 field->is_signed, field->filter_type);
2007 if (ret)
2008 break;
2009
2010 offset += field->size;
2011 }
1994 if (ret < 0) {2012 if (ret < 0) {
1995 pr_warn("Could not initialize trace point events/%s\n",2013 pr_warn("Could not initialize trace point events/%s\n",
1996 name);2014 name);
kernel/trace/trace_events_hist.c+7−1
@@ -1135,6 +1135,12 @@ static struct synth_event *find_synth_event(const char *name) · 1134 unmodified lines
1135 return NULL;1135 return NULL;
1136}1136}
1137 1137
1138static struct trace_event_fields synth_event_fields_array[] = {
1139 { .type = TRACE_FUNCTION_TYPE,
1140 .define_fields = synth_event_define_fields },
1141 {}
1142};
1143
1138static int register_synth_event(struct synth_event *event)1144static int register_synth_event(struct synth_event *event)
1139{1145{
1140 struct trace_event_call *call = &event->call;1146 struct trace_event_call *call = &event->call;
@@ -1156,7 +1162,7 @@ static int register_synth_event(struct synth_event *event) · 15 unmodified lines
1156 1162
1157 INIT_LIST_HEAD(&call->class->fields);1163 INIT_LIST_HEAD(&call->class->fields);
1158 call->event.funcs = &synth_event_funcs;1164 call->event.funcs = &synth_event_funcs;
1159 call->class->define_fields = synth_event_define_fields;1165 call->class->fields_array = synth_event_fields_array;
1160 1166
1161 ret = register_trace_event(&call->event);1167 ret = register_trace_event(&call->event);
1162 if (!ret) {1168 if (!ret) {
kernel/trace/trace_export.c+39−67
@@ -29,10 +29,8 @@ static int ftrace_event_register(struct trace_event_call *call, · 28 unmodified lines
29 * function and thus become accesible via perf.29 * function and thus become accesible via perf.
30 */30 */
31#undef FTRACE_ENTRY_REG31#undef FTRACE_ENTRY_REG
32#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, \32#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
33 filter, regfn) \33 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
34 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
35 filter)
36 34
37/* not needed for this file */35/* not needed for this file */
38#undef __field_struct36#undef __field_struct
@@ -41,6 +39,9 @@ static int ftrace_event_register(struct trace_event_call *call, · 2 unmodified lines
41#undef __field39#undef __field
42#define __field(type, item) type item;40#define __field(type, item) type item;
43 41
42#undef __field_fn
43#define __field_fn(type, item) type item;
44
44#undef __field_desc45#undef __field_desc
45#define __field_desc(type, container, item) type item;46#define __field_desc(type, container, item) type item;
46 47
@@ -60,7 +61,7 @@ static int ftrace_event_register(struct trace_event_call *call, · 13 unmodified lines
60#define F_printk(fmt, args...) fmt, args61#define F_printk(fmt, args...) fmt, args
61 62
62#undef FTRACE_ENTRY63#undef FTRACE_ENTRY
63#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \64#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
64struct ____ftrace_##name { \65struct ____ftrace_##name { \
65 tstruct \66 tstruct \
66}; \67}; \
@@ -73,76 +74,46 @@ static void __always_unused ____ftrace_check_##name(void) \ · 6 unmodified lines
73}74}
74 75
75#undef FTRACE_ENTRY_DUP76#undef FTRACE_ENTRY_DUP
76#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print, filter) \77#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
77 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \78 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
78 filter)
79 79
80#include "trace_entries.h"80#include "trace_entries.h"
81 81
82#undef __field_ext
83#define __field_ext(_type, _item, _filter_type) { \
84 .type = #_type, .name = #_item, \
85 .size = sizeof(_type), .align = __alignof__(_type), \
86 is_signed_type(_type), .filter_type = _filter_type },
87
82#undef __field88#undef __field
83#define __field(type, item) \89#define __field(_type, _item) __field_ext(_type, _item, FILTER_OTHER)
84 ret = trace_define_field(event_call, #type, #item, \90
85 offsetof(typeof(field), item), \91#undef __field_fn
86 sizeof(field.item), \92#define __field_fn(_type, _item) __field_ext(_type, _item, FILTER_TRACE_FN)
87 is_signed_type(type), filter_type); \
88 if (ret) \
89 return ret;
90 93
91#undef __field_desc94#undef __field_desc
92#define __field_desc(type, container, item) \95#define __field_desc(_type, _container, _item) __field_ext(_type, _item, FILTER_OTHER)
93 ret = trace_define_field(event_call, #type, #item, \
94 offsetof(typeof(field), \
95 container.item), \
96 sizeof(field.container.item), \
97 is_signed_type(type), filter_type); \
98 if (ret) \
99 return ret;
100 96
101#undef __array97#undef __array
102#define __array(type, item, len) \98#define __array(_type, _item, _len) { \
103 do { \99 .type = #_type"["__stringify(_len)"]", .name = #_item, \
104 char *type_str = #type"["__stringify(len)"]"; \100 .size = sizeof(_type[_len]), .align = __alignof__(_type), \
105 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \101 is_signed_type(_type), .filter_type = FILTER_OTHER },
106 ret = trace_define_field(event_call, type_str, #item, \
107 offsetof(typeof(field), item), \
108 sizeof(field.item), \
109 is_signed_type(type), filter_type); \
110 if (ret) \
111 return ret; \
112 } while (0);
113 102
114#undef __array_desc103#undef __array_desc
115#define __array_desc(type, container, item, len) \104#define __array_desc(_type, _container, _item, _len) __array(_type, _item, _len)
116 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
117 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
118 offsetof(typeof(field), \
119 container.item), \
120 sizeof(field.container.item), \
121 is_signed_type(type), filter_type); \
122 if (ret) \
123 return ret;
124 105
125#undef __dynamic_array106#undef __dynamic_array
126#define __dynamic_array(type, item) \107#define __dynamic_array(_type, _item) { \
127 ret = trace_define_field(event_call, #type "[]", #item, \108 .type = #_type "[]", .name = #_item, \
128 offsetof(typeof(field), item), \109 .size = 0, .align = __alignof__(_type), \
129 0, is_signed_type(type), filter_type);\110 is_signed_type(_type), .filter_type = FILTER_OTHER },
130 if (ret) \
131 return ret;
132 111
133#undef FTRACE_ENTRY112#undef FTRACE_ENTRY
134#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \113#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
135static int __init \114static struct trace_event_fields ftrace_event_fields_##name[] = { \
136ftrace_define_fields_##name(struct trace_event_call *event_call) \115 tstruct \
137{ \116 {} };
138 struct struct_name field; \
139 int ret; \
140 int filter_type = filter; \
141 \
142 tstruct; \
143 \
144 return ret; \
145}
146 117
147#include "trace_entries.h"118#include "trace_entries.h"
148 119
@@ -152,6 +123,9 @@ ftrace_define_fields_##name(struct trace_event_call *event_call) \ · 3 unmodified lines
152#undef __field123#undef __field
153#define __field(type, item)124#define __field(type, item)
154 125
126#undef __field_fn
127#define __field_fn(type, item)
128
155#undef __field_desc129#undef __field_desc
156#define __field_desc(type, container, item)130#define __field_desc(type, container, item)
157 131
@@ -168,12 +142,10 @@ ftrace_define_fields_##name(struct trace_event_call *event_call) \ · 10 unmodified lines
168#define F_printk(fmt, args...) __stringify(fmt) ", " __stringify(args)142#define F_printk(fmt, args...) __stringify(fmt) ", " __stringify(args)
169 143
170#undef FTRACE_ENTRY_REG144#undef FTRACE_ENTRY_REG
171#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, filter,\145#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, regfn) \
172 regfn) \
173 \
174struct trace_event_class __refdata event_class_ftrace_##call = { \146struct trace_event_class __refdata event_class_ftrace_##call = { \
175 .system = __stringify(TRACE_SYSTEM), \147 .system = __stringify(TRACE_SYSTEM), \
176 .define_fields = ftrace_define_fields_##call, \148 .fields_array = ftrace_event_fields_##call, \
177 .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\149 .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\
178 .reg = regfn, \150 .reg = regfn, \
179}; \151}; \
@@ -191,9 +163,9 @@ struct trace_event_call __used \ · 11 unmodified lines
191__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;163__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
192 164
193#undef FTRACE_ENTRY165#undef FTRACE_ENTRY
194#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print, filter) \166#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \
195 FTRACE_ENTRY_REG(call, struct_name, etype, \167 FTRACE_ENTRY_REG(call, struct_name, etype, \
196 PARAMS(tstruct), PARAMS(print), filter, NULL)168 PARAMS(tstruct), PARAMS(print), NULL)
197 169
198bool ftrace_event_is_function(struct trace_event_call *call)170bool ftrace_event_is_function(struct trace_event_call *call)
199{171{
kernel/trace/trace_kprobe.c+14−2
@@ -1534,16 +1534,28 @@ static struct trace_event_functions kprobe_funcs = { · 1533 unmodified lines
1534 .trace = print_kprobe_event1534 .trace = print_kprobe_event
1535};1535};
1536 1536
1537static struct trace_event_fields kretprobe_fields_array[] = {
1538 { .type = TRACE_FUNCTION_TYPE,
1539 .define_fields = kretprobe_event_define_fields },
1540 {}
1541};
1542
1543static struct trace_event_fields kprobe_fields_array[] = {
1544 { .type = TRACE_FUNCTION_TYPE,
1545 .define_fields = kprobe_event_define_fields },
1546 {}
1547};
1548
1537static inline void init_trace_event_call(struct trace_kprobe *tk)1549static inline void init_trace_event_call(struct trace_kprobe *tk)
1538{1550{
1539 struct trace_event_call *call = trace_probe_event_call(&tk->tp);1551 struct trace_event_call *call = trace_probe_event_call(&tk->tp);
1540 1552
1541 if (trace_kprobe_is_return(tk)) {1553 if (trace_kprobe_is_return(tk)) {
1542 call->event.funcs = &kretprobe_funcs;1554 call->event.funcs = &kretprobe_funcs;
1543 call->class->define_fields = kretprobe_event_define_fields;1555 call->class->fields_array = kretprobe_fields_array;
1544 } else {1556 } else {
1545 call->event.funcs = &kprobe_funcs;1557 call->event.funcs = &kprobe_funcs;
1546 call->class->define_fields = kprobe_event_define_fields;1558 call->class->fields_array = kprobe_fields_array;
1547 }1559 }
1548 1560
1549 call->flags = TRACE_EVENT_FL_KPROBE;1561 call->flags = TRACE_EVENT_FL_KPROBE;
kernel/trace/trace_syscalls.c+20−30
@@ -198,11 +198,10 @@ print_syscall_exit(struct trace_iterator *iter, int flags, · 197 unmodified lines
198 198
199extern char *__bad_type_size(void);199extern char *__bad_type_size(void);
200 200
201#define SYSCALL_FIELD(type, field, name) \201#define SYSCALL_FIELD(_type, _name) { \
202 sizeof(type) != sizeof(trace.field) ? \202 .type = #_type, .name = #_name, \
203 __bad_type_size() : \203 .size = sizeof(_type), .align = __alignof__(_type), \
204 #type, #name, offsetof(typeof(trace), field), \204 .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }
205 sizeof(trace.field), is_signed_type(type)
206 205
207static int __init206static int __init
208__set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)207__set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)
@@ -269,42 +268,22 @@ static int __init syscall_enter_define_fields(struct trace_event_call *call) · 60 unmodified lines
269{268{
270 struct syscall_trace_enter trace;269 struct syscall_trace_enter trace;
271 struct syscall_metadata *meta = call->data;270 struct syscall_metadata *meta = call->data;
272 int ret;
273 int i;
274 int offset = offsetof(typeof(trace), args);271 int offset = offsetof(typeof(trace), args);
275 272 int ret, i;
276 ret = trace_define_field(call, SYSCALL_FIELD(int, nr, __syscall_nr),
277 FILTER_OTHER);
278 if (ret)
279 return ret;
280 273
281 for (i = 0; i < meta->nb_args; i++) {274 for (i = 0; i < meta->nb_args; i++) {
282 ret = trace_define_field(call, meta->types[i],275 ret = trace_define_field(call, meta->types[i],
283 meta->args[i], offset,276 meta->args[i], offset,
284 sizeof(unsigned long), 0,277 sizeof(unsigned long), 0,
285 FILTER_OTHER);278 FILTER_OTHER);
279 if (ret)
280 break;
286 offset += sizeof(unsigned long);281 offset += sizeof(unsigned long);
287 }282 }
288 283
289 return ret;284 return ret;
290}285}
291 286
292static int __init syscall_exit_define_fields(struct trace_event_call *call)
293{
294 struct syscall_trace_exit trace;
295 int ret;
296
297 ret = trace_define_field(call, SYSCALL_FIELD(int, nr, __syscall_nr),
298 FILTER_OTHER);
299 if (ret)
300 return ret;
301
302 ret = trace_define_field(call, SYSCALL_FIELD(long, ret, ret),
303 FILTER_OTHER);
304
305 return ret;
306}
307
308static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)287static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
309{288{
310 struct trace_array *tr = data;289 struct trace_array *tr = data;
@@ -502,6 +481,13 @@ static int __init init_syscall_trace(struct trace_event_call *call) · 191 unmodified lines
502 return id;481 return id;
503}482}
504 483
484static struct trace_event_fields __refdata syscall_enter_fields_array[] = {
485 SYSCALL_FIELD(int, __syscall_nr),
486 { .type = TRACE_FUNCTION_TYPE,
487 .define_fields = syscall_enter_define_fields },
488 {}
489};
490
505struct trace_event_functions enter_syscall_print_funcs = {491struct trace_event_functions enter_syscall_print_funcs = {
506 .trace = print_syscall_enter,492 .trace = print_syscall_enter,
507};493};
@@ -513,7 +499,7 @@ struct trace_event_functions exit_syscall_print_funcs = { · 5 unmodified lines
513struct trace_event_class __refdata event_class_syscall_enter = {499struct trace_event_class __refdata event_class_syscall_enter = {
514 .system = "syscalls",500 .system = "syscalls",
515 .reg = syscall_enter_register,501 .reg = syscall_enter_register,
516 .define_fields = syscall_enter_define_fields,502 .fields_array = syscall_enter_fields_array,
517 .get_fields = syscall_get_enter_fields,503 .get_fields = syscall_get_enter_fields,
518 .raw_init = init_syscall_trace,504 .raw_init = init_syscall_trace,
519};505};
@@ -521,7 +507,11 @@ struct trace_event_class __refdata event_class_syscall_enter = { · 1 unmodified line
521struct trace_event_class __refdata event_class_syscall_exit = {507struct trace_event_class __refdata event_class_syscall_exit = {
522 .system = "syscalls",508 .system = "syscalls",
523 .reg = syscall_exit_register,509 .reg = syscall_exit_register,
524 .define_fields = syscall_exit_define_fields,510 .fields_array = (struct trace_event_fields[]){
511 SYSCALL_FIELD(int, __syscall_nr),
512 SYSCALL_FIELD(long, ret),
513 {}
514 },
525 .fields = LIST_HEAD_INIT(event_class_syscall_exit.fields),515 .fields = LIST_HEAD_INIT(event_class_syscall_exit.fields),
526 .raw_init = init_syscall_trace,516 .raw_init = init_syscall_trace,
527};517};
kernel/trace/trace_uprobe.c+7−2
@@ -1507,12 +1507,17 @@ static struct trace_event_functions uprobe_funcs = { · 1506 unmodified lines
1507 .trace = print_uprobe_event1507 .trace = print_uprobe_event
1508};1508};
1509 1509
1510static struct trace_event_fields uprobe_fields_array[] = {
1511 { .type = TRACE_FUNCTION_TYPE,
1512 .define_fields = uprobe_event_define_fields },
1513 {}
1514};
1515
1510static inline void init_trace_event_call(struct trace_uprobe *tu)1516static inline void init_trace_event_call(struct trace_uprobe *tu)
1511{1517{
1512 struct trace_event_call *call = trace_probe_event_call(&tu->tp);1518 struct trace_event_call *call = trace_probe_event_call(&tu->tp);
1513
1514 call->event.funcs = &uprobe_funcs;1519 call->event.funcs = &uprobe_funcs;
1515 call->class->define_fields = uprobe_event_define_fields;1520 call->class->fields_array = uprobe_fields_array;
1516 1521
1517 call->flags = TRACE_EVENT_FL_UPROBE | TRACE_EVENT_FL_CAP_ANY;1522 call->flags = TRACE_EVENT_FL_UPROBE | TRACE_EVENT_FL_CAP_ANY;
1518 call->class->reg = trace_uprobe_register;1523 call->class->reg = trace_uprobe_register;
net/mac80211/trace.h+14−14
@@ -408,20 +408,20 @@ TRACE_EVENT(drv_bss_info_changed, · 407 unmodified lines
408 __field(u32, basic_rates)408 __field(u32, basic_rates)
409 __array(int, mcast_rate, NUM_NL80211_BANDS)409 __array(int, mcast_rate, NUM_NL80211_BANDS)
410 __field(u16, ht_operation_mode)410 __field(u16, ht_operation_mode)
411 __field(s32, cqm_rssi_thold);411 __field(s32, cqm_rssi_thold)
412 __field(s32, cqm_rssi_hyst);412 __field(s32, cqm_rssi_hyst)
413 __field(u32, channel_width);413 __field(u32, channel_width)
414 __field(u32, channel_cfreq1);414 __field(u32, channel_cfreq1)
415 __dynamic_array(u32, arp_addr_list,415 __dynamic_array(u32, arp_addr_list,
416 info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?416 info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?
417 IEEE80211_BSS_ARP_ADDR_LIST_LEN :417 IEEE80211_BSS_ARP_ADDR_LIST_LEN :
418 info->arp_addr_cnt);418 info->arp_addr_cnt)
419 __field(int, arp_addr_cnt);419 __field(int, arp_addr_cnt)
420 __field(bool, qos);420 __field(bool, qos)
421 __field(bool, idle);421 __field(bool, idle)
422 __field(bool, ps);422 __field(bool, ps)
423 __dynamic_array(u8, ssid, info->ssid_len);423 __dynamic_array(u8, ssid, info->ssid_len)
424 __field(bool, hidden_ssid);424 __field(bool, hidden_ssid)
425 __field(int, txpower)425 __field(int, txpower)
426 __field(u8, p2p_oppps_ctwindow)426 __field(u8, p2p_oppps_ctwindow)
427 ),427 ),
@@ -1672,8 +1672,8 @@ TRACE_EVENT(drv_start_ap, · 1244 unmodified lines
1672 VIF_ENTRY1672 VIF_ENTRY
1673 __field(u8, dtimper)1673 __field(u8, dtimper)
1674 __field(u16, bcnint)1674 __field(u16, bcnint)
1675 __dynamic_array(u8, ssid, info->ssid_len);1675 __dynamic_array(u8, ssid, info->ssid_len)
1676 __field(bool, hidden_ssid);1676 __field(bool, hidden_ssid)
1677 ),1677 ),
1678 1678
1679 TP_fast_assign(1679 TP_fast_assign(
@@ -1739,7 +1739,7 @@ TRACE_EVENT(drv_join_ibss, · 59 unmodified lines
1739 VIF_ENTRY1739 VIF_ENTRY
1740 __field(u8, dtimper)1740 __field(u8, dtimper)
1741 __field(u16, bcnint)1741 __field(u16, bcnint)
1742 __dynamic_array(u8, ssid, info->ssid_len);1742 __dynamic_array(u8, ssid, info->ssid_len)
1743 ),1743 ),
1744 1744
1745 TP_fast_assign(1745 TP_fast_assign(
net/wireless/trace.h+3−3
@@ -2009,7 +2009,7 @@ TRACE_EVENT(rdev_start_nan, · 2008 unmodified lines
2009 WIPHY_ENTRY2009 WIPHY_ENTRY
2010 WDEV_ENTRY2010 WDEV_ENTRY
2011 __field(u8, master_pref)2011 __field(u8, master_pref)
2012 __field(u8, bands);2012 __field(u8, bands)
2013 ),2013 ),
2014 TP_fast_assign(2014 TP_fast_assign(
2015 WIPHY_ASSIGN;2015 WIPHY_ASSIGN;
@@ -2031,8 +2031,8 @@ TRACE_EVENT(rdev_nan_change_conf, · 15 unmodified lines
2031 WIPHY_ENTRY2031 WIPHY_ENTRY
2032 WDEV_ENTRY2032 WDEV_ENTRY
2033 __field(u8, master_pref)2033 __field(u8, master_pref)
2034 __field(u8, bands);2034 __field(u8, bands)
2035 __field(u32, changes);2035 __field(u32, changes)
2036 ),2036 ),
2037 TP_fast_assign(2037 TP_fast_assign(
2038 WIPHY_ASSIGN;2038 WIPHY_ASSIGN;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t