.. | .. |
---|
2 | 2 | /* |
---|
3 | 3 | * Stage 1 of the trace events. |
---|
4 | 4 | * |
---|
5 | | - * Override the macros in <trace/trace_events.h> to include the following: |
---|
| 5 | + * Override the macros in the event tracepoint header <trace/events/XXX.h> |
---|
| 6 | + * to include the following: |
---|
6 | 7 | * |
---|
7 | 8 | * struct trace_event_raw_<call> { |
---|
8 | 9 | * struct trace_entry ent; |
---|
.. | .. |
---|
44 | 45 | .eval_value = a \ |
---|
45 | 46 | }; \ |
---|
46 | 47 | static struct trace_eval_map __used \ |
---|
47 | | - __attribute__((section("_ftrace_eval_map"))) \ |
---|
| 48 | + __section("_ftrace_eval_map") \ |
---|
48 | 49 | *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a |
---|
49 | 50 | |
---|
50 | 51 | #undef TRACE_DEFINE_SIZEOF |
---|
.. | .. |
---|
57 | 58 | .eval_value = sizeof(a) \ |
---|
58 | 59 | }; \ |
---|
59 | 60 | static struct trace_eval_map __used \ |
---|
60 | | - __attribute__((section("_ftrace_eval_map"))) \ |
---|
| 61 | + __section("_ftrace_eval_map") \ |
---|
61 | 62 | *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a |
---|
62 | 63 | |
---|
63 | 64 | /* |
---|
.. | .. |
---|
209 | 210 | #define DEFINE_EVENT(template, name, proto, args) |
---|
210 | 211 | |
---|
211 | 212 | #undef DEFINE_EVENT_PRINT |
---|
212 | | -#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
---|
213 | | - DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |
---|
| 213 | +#define DEFINE_EVENT_PRINT(template, name, proto, args, print) |
---|
214 | 214 | |
---|
215 | 215 | #undef TRACE_EVENT_FLAGS |
---|
216 | 216 | #define TRACE_EVENT_FLAGS(event, flag) |
---|
.. | .. |
---|
223 | 223 | /* |
---|
224 | 224 | * Stage 3 of the trace events. |
---|
225 | 225 | * |
---|
226 | | - * Override the macros in <trace/trace_events.h> to include the following: |
---|
| 226 | + * Override the macros in the event tracepoint header <trace/events/XXX.h> |
---|
| 227 | + * to include the following: |
---|
227 | 228 | * |
---|
228 | 229 | * enum print_line_t |
---|
229 | 230 | * trace_raw_output_<call>(struct trace_iterator *iter, int flags) |
---|
.. | .. |
---|
340 | 341 | trace_print_array_seq(p, array, count, el_size); \ |
---|
341 | 342 | }) |
---|
342 | 343 | |
---|
| 344 | +#undef __print_hex_dump |
---|
| 345 | +#define __print_hex_dump(prefix_str, prefix_type, \ |
---|
| 346 | + rowsize, groupsize, buf, len, ascii) \ |
---|
| 347 | + trace_print_hex_dump_seq(p, prefix_str, prefix_type, \ |
---|
| 348 | + rowsize, groupsize, buf, len, ascii) |
---|
| 349 | + |
---|
343 | 350 | #undef DECLARE_EVENT_CLASS |
---|
344 | 351 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
---|
345 | 352 | static notrace enum print_line_t \ |
---|
.. | .. |
---|
393 | 400 | |
---|
394 | 401 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
---|
395 | 402 | |
---|
| 403 | +#define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;}))) |
---|
| 404 | + |
---|
396 | 405 | #undef __field_ext |
---|
397 | | -#define __field_ext(type, item, filter_type) \ |
---|
398 | | - ret = trace_define_field(event_call, #type, #item, \ |
---|
399 | | - offsetof(typeof(field), item), \ |
---|
400 | | - sizeof(field.item), \ |
---|
401 | | - is_signed_type(type), filter_type); \ |
---|
402 | | - if (ret) \ |
---|
403 | | - return ret; |
---|
| 406 | +#define __field_ext(_type, _item, _filter_type) { \ |
---|
| 407 | + .type = #_type, .name = #_item, \ |
---|
| 408 | + .size = sizeof(_type), .align = ALIGN_STRUCTFIELD(_type), \ |
---|
| 409 | + .is_signed = is_signed_type(_type), .filter_type = _filter_type }, |
---|
404 | 410 | |
---|
405 | 411 | #undef __field_struct_ext |
---|
406 | | -#define __field_struct_ext(type, item, filter_type) \ |
---|
407 | | - ret = trace_define_field(event_call, #type, #item, \ |
---|
408 | | - offsetof(typeof(field), item), \ |
---|
409 | | - sizeof(field.item), \ |
---|
410 | | - 0, filter_type); \ |
---|
411 | | - if (ret) \ |
---|
412 | | - return ret; |
---|
| 412 | +#define __field_struct_ext(_type, _item, _filter_type) { \ |
---|
| 413 | + .type = #_type, .name = #_item, \ |
---|
| 414 | + .size = sizeof(_type), .align = ALIGN_STRUCTFIELD(_type), \ |
---|
| 415 | + 0, .filter_type = _filter_type }, |
---|
413 | 416 | |
---|
414 | 417 | #undef __field |
---|
415 | 418 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) |
---|
.. | .. |
---|
418 | 421 | #define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER) |
---|
419 | 422 | |
---|
420 | 423 | #undef __array |
---|
421 | | -#define __array(type, item, len) \ |
---|
422 | | - do { \ |
---|
423 | | - char *type_str = #type"["__stringify(len)"]"; \ |
---|
424 | | - BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
---|
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); |
---|
| 424 | +#define __array(_type, _item, _len) { \ |
---|
| 425 | + .type = #_type"["__stringify(_len)"]", .name = #_item, \ |
---|
| 426 | + .size = sizeof(_type[_len]), .align = ALIGN_STRUCTFIELD(_type), \ |
---|
| 427 | + .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }, |
---|
433 | 428 | |
---|
434 | 429 | #undef __dynamic_array |
---|
435 | | -#define __dynamic_array(type, item, len) \ |
---|
436 | | - ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
---|
437 | | - offsetof(typeof(field), __data_loc_##item), \ |
---|
438 | | - sizeof(field.__data_loc_##item), \ |
---|
439 | | - is_signed_type(type), FILTER_OTHER); |
---|
| 430 | +#define __dynamic_array(_type, _item, _len) { \ |
---|
| 431 | + .type = "__data_loc " #_type "[]", .name = #_item, \ |
---|
| 432 | + .size = 4, .align = 4, \ |
---|
| 433 | + .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }, |
---|
440 | 434 | |
---|
441 | 435 | #undef __string |
---|
442 | 436 | #define __string(item, src) __dynamic_array(char, item, -1) |
---|
.. | .. |
---|
446 | 440 | |
---|
447 | 441 | #undef DECLARE_EVENT_CLASS |
---|
448 | 442 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ |
---|
449 | | -static int notrace __init \ |
---|
450 | | -trace_event_define_fields_##call(struct trace_event_call *event_call) \ |
---|
451 | | -{ \ |
---|
452 | | - struct trace_event_raw_##call field; \ |
---|
453 | | - int ret; \ |
---|
454 | | - \ |
---|
455 | | - tstruct; \ |
---|
456 | | - \ |
---|
457 | | - return ret; \ |
---|
458 | | -} |
---|
459 | | - |
---|
460 | | -#undef DEFINE_EVENT |
---|
461 | | -#define DEFINE_EVENT(template, name, proto, args) |
---|
| 443 | +static struct trace_event_fields trace_event_fields_##call[] = { \ |
---|
| 444 | + tstruct \ |
---|
| 445 | + {} }; |
---|
462 | 446 | |
---|
463 | 447 | #undef DEFINE_EVENT_PRINT |
---|
464 | | -#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
---|
465 | | - DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |
---|
| 448 | +#define DEFINE_EVENT_PRINT(template, name, proto, args, print) |
---|
466 | 449 | |
---|
467 | 450 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
---|
468 | 451 | |
---|
.. | .. |
---|
537 | 520 | return __data_size; \ |
---|
538 | 521 | } |
---|
539 | 522 | |
---|
540 | | -#undef DEFINE_EVENT |
---|
541 | | -#define DEFINE_EVENT(template, name, proto, args) |
---|
542 | | - |
---|
543 | | -#undef DEFINE_EVENT_PRINT |
---|
544 | | -#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
---|
545 | | - DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |
---|
546 | | - |
---|
547 | 523 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
---|
548 | 524 | |
---|
549 | 525 | /* |
---|
550 | 526 | * Stage 4 of the trace events. |
---|
551 | 527 | * |
---|
552 | | - * Override the macros in <trace/trace_events.h> to include the following: |
---|
| 528 | + * Override the macros in the event tracepoint header <trace/events/XXX.h> |
---|
| 529 | + * to include the following: |
---|
553 | 530 | * |
---|
554 | 531 | * For those macros defined with TRACE_EVENT: |
---|
555 | 532 | * |
---|
.. | .. |
---|
564 | 541 | * enum event_trigger_type __tt = ETT_NONE; |
---|
565 | 542 | * struct ring_buffer_event *event; |
---|
566 | 543 | * struct trace_event_raw_<call> *entry; <-- defined in stage 1 |
---|
567 | | - * struct ring_buffer *buffer; |
---|
| 544 | + * struct trace_buffer *buffer; |
---|
568 | 545 | * unsigned long irq_flags; |
---|
569 | 546 | * int __data_size; |
---|
570 | 547 | * int pc; |
---|
.. | .. |
---|
613 | 590 | * |
---|
614 | 591 | * static struct trace_event_class __used event_class_<template> = { |
---|
615 | 592 | * .system = "<system>", |
---|
616 | | - * .define_fields = trace_event_define_fields_<call>, |
---|
| 593 | + * .fields_array = trace_event_fields_<call>, |
---|
617 | 594 | * .fields = LIST_HEAD_INIT(event_class_##call.fields), |
---|
618 | 595 | * .raw_init = trace_event_raw_init, |
---|
619 | 596 | * .probe = trace_event_raw_event_##call, |
---|
.. | .. |
---|
632 | 609 | * // its only safe to use pointers when doing linker tricks to |
---|
633 | 610 | * // create an array. |
---|
634 | 611 | * static struct trace_event_call __used |
---|
635 | | - * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>; |
---|
| 612 | + * __section("_ftrace_events") *__event_<call> = &event_<call>; |
---|
636 | 613 | * |
---|
637 | 614 | */ |
---|
638 | 615 | |
---|
.. | .. |
---|
734 | 711 | check_trace_callback_type_##call(trace_event_raw_event_##template); \ |
---|
735 | 712 | } |
---|
736 | 713 | |
---|
737 | | -#undef DEFINE_EVENT_PRINT |
---|
738 | | -#define DEFINE_EVENT_PRINT(template, name, proto, args, print) |
---|
739 | | - |
---|
740 | 714 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
---|
741 | 715 | |
---|
742 | 716 | #undef __entry |
---|
.. | .. |
---|
751 | 725 | #undef __get_str |
---|
752 | 726 | #undef __get_bitmask |
---|
753 | 727 | #undef __print_array |
---|
| 728 | +#undef __print_hex_dump |
---|
754 | 729 | |
---|
755 | 730 | #undef TP_printk |
---|
756 | 731 | #define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) |
---|
.. | .. |
---|
761 | 736 | static char print_fmt_##call[] = print; \ |
---|
762 | 737 | static struct trace_event_class __used __refdata event_class_##call = { \ |
---|
763 | 738 | .system = TRACE_SYSTEM_STRING, \ |
---|
764 | | - .define_fields = trace_event_define_fields_##call, \ |
---|
| 739 | + .fields_array = trace_event_fields_##call, \ |
---|
765 | 740 | .fields = LIST_HEAD_INIT(event_class_##call.fields),\ |
---|
766 | 741 | .raw_init = trace_event_raw_init, \ |
---|
767 | 742 | .probe = trace_event_raw_event_##call, \ |
---|
.. | .. |
---|
782 | 757 | .flags = TRACE_EVENT_FL_TRACEPOINT, \ |
---|
783 | 758 | }; \ |
---|
784 | 759 | static struct trace_event_call __used \ |
---|
785 | | -__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call |
---|
| 760 | +__section("_ftrace_events") *__event_##call = &event_##call |
---|
786 | 761 | |
---|
787 | 762 | #undef DEFINE_EVENT_PRINT |
---|
788 | 763 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ |
---|
.. | .. |
---|
799 | 774 | .flags = TRACE_EVENT_FL_TRACEPOINT, \ |
---|
800 | 775 | }; \ |
---|
801 | 776 | static struct trace_event_call __used \ |
---|
802 | | -__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call |
---|
| 777 | +__section("_ftrace_events") *__event_##call = &event_##call |
---|
803 | 778 | |
---|
804 | 779 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
---|