diff options
Diffstat (limited to 'include/trace/ftrace.h')
-rw-r--r-- | include/trace/ftrace.h | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 5c38606613d8..1ee19a24cc5f 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -310,15 +310,12 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | |||
310 | #undef __array | 310 | #undef __array |
311 | #define __array(type, item, len) \ | 311 | #define __array(type, item, len) \ |
312 | do { \ | 312 | do { \ |
313 | mutex_lock(&event_storage_mutex); \ | 313 | char *type_str = #type"["__stringify(len)"]"; \ |
314 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 314 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
315 | snprintf(event_storage, sizeof(event_storage), \ | 315 | ret = trace_define_field(event_call, type_str, #item, \ |
316 | "%s[%d]", #type, len); \ | ||
317 | ret = trace_define_field(event_call, event_storage, #item, \ | ||
318 | offsetof(typeof(field), item), \ | 316 | offsetof(typeof(field), item), \ |
319 | sizeof(field.item), \ | 317 | sizeof(field.item), \ |
320 | is_signed_type(type), FILTER_OTHER); \ | 318 | is_signed_type(type), FILTER_OTHER); \ |
321 | mutex_unlock(&event_storage_mutex); \ | ||
322 | if (ret) \ | 319 | if (ret) \ |
323 | return ret; \ | 320 | return ret; \ |
324 | } while (0); | 321 | } while (0); |
@@ -418,6 +415,8 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
418 | * struct ftrace_event_file *ftrace_file = __data; | 415 | * struct ftrace_event_file *ftrace_file = __data; |
419 | * struct ftrace_event_call *event_call = ftrace_file->event_call; | 416 | * struct ftrace_event_call *event_call = ftrace_file->event_call; |
420 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; | 417 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; |
418 | * unsigned long eflags = ftrace_file->flags; | ||
419 | * enum event_trigger_type __tt = ETT_NONE; | ||
421 | * struct ring_buffer_event *event; | 420 | * struct ring_buffer_event *event; |
422 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 | 421 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 |
423 | * struct ring_buffer *buffer; | 422 | * struct ring_buffer *buffer; |
@@ -425,9 +424,12 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
425 | * int __data_size; | 424 | * int __data_size; |
426 | * int pc; | 425 | * int pc; |
427 | * | 426 | * |
428 | * if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, | 427 | * if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) { |
429 | * &ftrace_file->flags)) | 428 | * if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE) |
430 | * return; | 429 | * event_triggers_call(ftrace_file, NULL); |
430 | * if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED) | ||
431 | * return; | ||
432 | * } | ||
431 | * | 433 | * |
432 | * local_save_flags(irq_flags); | 434 | * local_save_flags(irq_flags); |
433 | * pc = preempt_count(); | 435 | * pc = preempt_count(); |
@@ -445,8 +447,17 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
445 | * { <assign>; } <-- Here we assign the entries by the __field and | 447 | * { <assign>; } <-- Here we assign the entries by the __field and |
446 | * __array macros. | 448 | * __array macros. |
447 | * | 449 | * |
448 | * if (!filter_check_discard(ftrace_file, entry, buffer, event)) | 450 | * if (eflags & FTRACE_EVENT_FL_TRIGGER_COND) |
451 | * __tt = event_triggers_call(ftrace_file, entry); | ||
452 | * | ||
453 | * if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, | ||
454 | * &ftrace_file->flags)) | ||
455 | * ring_buffer_discard_commit(buffer, event); | ||
456 | * else if (!filter_check_discard(ftrace_file, entry, buffer, event)) | ||
449 | * trace_buffer_unlock_commit(buffer, event, irq_flags, pc); | 457 | * trace_buffer_unlock_commit(buffer, event, irq_flags, pc); |
458 | * | ||
459 | * if (__tt) | ||
460 | * event_triggers_post_call(ftrace_file, __tt); | ||
450 | * } | 461 | * } |
451 | * | 462 | * |
452 | * static struct trace_event ftrace_event_type_<call> = { | 463 | * static struct trace_event ftrace_event_type_<call> = { |
@@ -539,8 +550,7 @@ ftrace_raw_event_##call(void *__data, proto) \ | |||
539 | int __data_size; \ | 550 | int __data_size; \ |
540 | int pc; \ | 551 | int pc; \ |
541 | \ | 552 | \ |
542 | if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, \ | 553 | if (ftrace_trigger_soft_disabled(ftrace_file)) \ |
543 | &ftrace_file->flags)) \ | ||
544 | return; \ | 554 | return; \ |
545 | \ | 555 | \ |
546 | local_save_flags(irq_flags); \ | 556 | local_save_flags(irq_flags); \ |
@@ -560,8 +570,8 @@ ftrace_raw_event_##call(void *__data, proto) \ | |||
560 | \ | 570 | \ |
561 | { assign; } \ | 571 | { assign; } \ |
562 | \ | 572 | \ |
563 | if (!filter_check_discard(ftrace_file, entry, buffer, event)) \ | 573 | event_trigger_unlock_commit(ftrace_file, buffer, event, entry, \ |
564 | trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \ | 574 | irq_flags, pc); \ |
565 | } | 575 | } |
566 | /* | 576 | /* |
567 | * The ftrace_test_probe is compiled out, it is only here as a build time check | 577 | * The ftrace_test_probe is compiled out, it is only here as a build time check |