.. | .. |
---|
184 | 184 | __common_field(unsigned char, flags); |
---|
185 | 185 | __common_field(unsigned char, preempt_count); |
---|
186 | 186 | __common_field(int, pid); |
---|
187 | | - __common_field(unsigned char, migrate_disable); |
---|
188 | | - __common_field(unsigned char, preempt_lazy_count); |
---|
189 | 187 | |
---|
190 | 188 | return ret; |
---|
191 | 189 | } |
---|
.. | .. |
---|
261 | 259 | trace_event_ignore_this_pid(trace_file)) |
---|
262 | 260 | return NULL; |
---|
263 | 261 | |
---|
| 262 | + local_save_flags(fbuffer->flags); |
---|
| 263 | + fbuffer->pc = preempt_count(); |
---|
264 | 264 | /* |
---|
265 | 265 | * If CONFIG_PREEMPTION is enabled, then the tracepoint itself disables |
---|
266 | 266 | * preemption (adding one to the preempt_count). Since we are |
---|
267 | 267 | * interested in the preempt_count at the time the tracepoint was |
---|
268 | 268 | * hit, we need to subtract one to offset the increment. |
---|
269 | 269 | */ |
---|
270 | | - fbuffer->trace_ctx = tracing_gen_ctx_dec(); |
---|
| 270 | + if (IS_ENABLED(CONFIG_PREEMPTION)) |
---|
| 271 | + fbuffer->pc--; |
---|
271 | 272 | fbuffer->trace_file = trace_file; |
---|
272 | 273 | |
---|
273 | 274 | fbuffer->event = |
---|
274 | 275 | trace_event_buffer_lock_reserve(&fbuffer->buffer, trace_file, |
---|
275 | 276 | event_call->event.type, len, |
---|
276 | | - fbuffer->trace_ctx); |
---|
| 277 | + fbuffer->flags, fbuffer->pc); |
---|
277 | 278 | if (!fbuffer->event) |
---|
278 | 279 | return NULL; |
---|
279 | 280 | |
---|
.. | .. |
---|
370 | 371 | { |
---|
371 | 372 | struct trace_event_call *call = file->event_call; |
---|
372 | 373 | struct trace_array *tr = file->tr; |
---|
373 | | - unsigned long file_flags = file->flags; |
---|
374 | 374 | int ret = 0; |
---|
375 | 375 | int disable; |
---|
376 | 376 | |
---|
.. | .. |
---|
394 | 394 | break; |
---|
395 | 395 | disable = file->flags & EVENT_FILE_FL_SOFT_DISABLED; |
---|
396 | 396 | clear_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags); |
---|
| 397 | + /* Disable use of trace_buffered_event */ |
---|
| 398 | + trace_buffered_event_disable(); |
---|
397 | 399 | } else |
---|
398 | 400 | disable = !(file->flags & EVENT_FILE_FL_SOFT_MODE); |
---|
399 | 401 | |
---|
.. | .. |
---|
432 | 434 | if (atomic_inc_return(&file->sm_ref) > 1) |
---|
433 | 435 | break; |
---|
434 | 436 | set_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags); |
---|
| 437 | + /* Enable use of trace_buffered_event */ |
---|
| 438 | + trace_buffered_event_enable(); |
---|
435 | 439 | } |
---|
436 | 440 | |
---|
437 | 441 | if (!(file->flags & EVENT_FILE_FL_ENABLED)) { |
---|
.. | .. |
---|
469 | 473 | set_bit(EVENT_FILE_FL_WAS_ENABLED_BIT, &file->flags); |
---|
470 | 474 | } |
---|
471 | 475 | break; |
---|
472 | | - } |
---|
473 | | - |
---|
474 | | - /* Enable or disable use of trace_buffered_event */ |
---|
475 | | - if ((file_flags & EVENT_FILE_FL_SOFT_DISABLED) != |
---|
476 | | - (file->flags & EVENT_FILE_FL_SOFT_DISABLED)) { |
---|
477 | | - if (file->flags & EVENT_FILE_FL_SOFT_DISABLED) |
---|
478 | | - trace_buffered_event_enable(); |
---|
479 | | - else |
---|
480 | | - trace_buffered_event_disable(); |
---|
481 | 476 | } |
---|
482 | 477 | |
---|
483 | 478 | return ret; |
---|
.. | .. |
---|
1860 | 1855 | }; |
---|
1861 | 1856 | |
---|
1862 | 1857 | static const struct file_operations ftrace_enable_fops = { |
---|
1863 | | - .open = tracing_open_generic, |
---|
| 1858 | + .open = tracing_open_file_tr, |
---|
1864 | 1859 | .read = event_enable_read, |
---|
1865 | 1860 | .write = event_enable_write, |
---|
| 1861 | + .release = tracing_release_file_tr, |
---|
1866 | 1862 | .llseek = default_llseek, |
---|
1867 | 1863 | }; |
---|
1868 | 1864 | |
---|
.. | .. |
---|
1879 | 1875 | }; |
---|
1880 | 1876 | |
---|
1881 | 1877 | static const struct file_operations ftrace_event_filter_fops = { |
---|
1882 | | - .open = tracing_open_generic, |
---|
| 1878 | + .open = tracing_open_file_tr, |
---|
1883 | 1879 | .read = event_filter_read, |
---|
1884 | 1880 | .write = event_filter_write, |
---|
| 1881 | + .release = tracing_release_file_tr, |
---|
1885 | 1882 | .llseek = default_llseek, |
---|
1886 | 1883 | }; |
---|
1887 | 1884 | |
---|
.. | .. |
---|
2660 | 2657 | * over from this module may be passed to the new module events and |
---|
2661 | 2658 | * unexpected results may occur. |
---|
2662 | 2659 | */ |
---|
2663 | | - tracing_reset_all_online_cpus(); |
---|
| 2660 | + tracing_reset_all_online_cpus_unlocked(); |
---|
2664 | 2661 | } |
---|
2665 | 2662 | |
---|
2666 | 2663 | static int trace_module_notify(struct notifier_block *self, |
---|
.. | .. |
---|
3698 | 3695 | struct trace_buffer *buffer; |
---|
3699 | 3696 | struct ring_buffer_event *event; |
---|
3700 | 3697 | struct ftrace_entry *entry; |
---|
3701 | | - unsigned int trace_ctx; |
---|
| 3698 | + unsigned long flags; |
---|
3702 | 3699 | long disabled; |
---|
3703 | 3700 | int cpu; |
---|
| 3701 | + int pc; |
---|
3704 | 3702 | |
---|
3705 | | - trace_ctx = tracing_gen_ctx(); |
---|
| 3703 | + pc = preempt_count(); |
---|
3706 | 3704 | preempt_disable_notrace(); |
---|
3707 | 3705 | cpu = raw_smp_processor_id(); |
---|
3708 | 3706 | disabled = atomic_inc_return(&per_cpu(ftrace_test_event_disable, cpu)); |
---|
.. | .. |
---|
3710 | 3708 | if (disabled != 1) |
---|
3711 | 3709 | goto out; |
---|
3712 | 3710 | |
---|
| 3711 | + local_save_flags(flags); |
---|
| 3712 | + |
---|
3713 | 3713 | event = trace_event_buffer_lock_reserve(&buffer, &event_trace_file, |
---|
3714 | 3714 | TRACE_FN, sizeof(*entry), |
---|
3715 | | - trace_ctx); |
---|
| 3715 | + flags, pc); |
---|
3716 | 3716 | if (!event) |
---|
3717 | 3717 | goto out; |
---|
3718 | 3718 | entry = ring_buffer_event_data(event); |
---|
.. | .. |
---|
3720 | 3720 | entry->parent_ip = parent_ip; |
---|
3721 | 3721 | |
---|
3722 | 3722 | event_trigger_unlock_commit(&event_trace_file, buffer, event, |
---|
3723 | | - entry, trace_ctx); |
---|
| 3723 | + entry, flags, pc); |
---|
3724 | 3724 | out: |
---|
3725 | 3725 | atomic_dec(&per_cpu(ftrace_test_event_disable, cpu)); |
---|
3726 | 3726 | preempt_enable_notrace(); |
---|