.. | .. |
---|
67 | 67 | static int |
---|
68 | 68 | func_prolog_preempt_disable(struct trace_array *tr, |
---|
69 | 69 | struct trace_array_cpu **data, |
---|
70 | | - unsigned int *trace_ctx) |
---|
| 70 | + int *pc) |
---|
71 | 71 | { |
---|
72 | 72 | long disabled; |
---|
73 | 73 | int cpu; |
---|
.. | .. |
---|
75 | 75 | if (likely(!wakeup_task)) |
---|
76 | 76 | return 0; |
---|
77 | 77 | |
---|
78 | | - *trace_ctx = tracing_gen_ctx(); |
---|
| 78 | + *pc = preempt_count(); |
---|
79 | 79 | preempt_disable_notrace(); |
---|
80 | 80 | |
---|
81 | 81 | cpu = raw_smp_processor_id(); |
---|
.. | .. |
---|
116 | 116 | { |
---|
117 | 117 | struct trace_array *tr = wakeup_trace; |
---|
118 | 118 | struct trace_array_cpu *data; |
---|
119 | | - unsigned int trace_ctx; |
---|
120 | | - int ret = 0; |
---|
| 119 | + unsigned long flags; |
---|
| 120 | + int pc, ret = 0; |
---|
121 | 121 | |
---|
122 | 122 | if (ftrace_graph_ignore_func(trace)) |
---|
123 | 123 | return 0; |
---|
.. | .. |
---|
131 | 131 | if (ftrace_graph_notrace_addr(trace->func)) |
---|
132 | 132 | return 1; |
---|
133 | 133 | |
---|
134 | | - if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
---|
| 134 | + if (!func_prolog_preempt_disable(tr, &data, &pc)) |
---|
135 | 135 | return 0; |
---|
136 | 136 | |
---|
137 | | - ret = __trace_graph_entry(tr, trace, trace_ctx); |
---|
| 137 | + local_save_flags(flags); |
---|
| 138 | + ret = __trace_graph_entry(tr, trace, flags, pc); |
---|
138 | 139 | atomic_dec(&data->disabled); |
---|
139 | 140 | preempt_enable_notrace(); |
---|
140 | 141 | |
---|
.. | .. |
---|
145 | 146 | { |
---|
146 | 147 | struct trace_array *tr = wakeup_trace; |
---|
147 | 148 | struct trace_array_cpu *data; |
---|
148 | | - unsigned int trace_ctx; |
---|
| 149 | + unsigned long flags; |
---|
| 150 | + int pc; |
---|
149 | 151 | |
---|
150 | 152 | ftrace_graph_addr_finish(trace); |
---|
151 | 153 | |
---|
152 | | - if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
---|
| 154 | + if (!func_prolog_preempt_disable(tr, &data, &pc)) |
---|
153 | 155 | return; |
---|
154 | 156 | |
---|
155 | | - __trace_graph_return(tr, trace, trace_ctx); |
---|
| 157 | + local_save_flags(flags); |
---|
| 158 | + __trace_graph_return(tr, trace, flags, pc); |
---|
156 | 159 | atomic_dec(&data->disabled); |
---|
157 | 160 | |
---|
158 | 161 | preempt_enable_notrace(); |
---|
.. | .. |
---|
214 | 217 | struct trace_array *tr = wakeup_trace; |
---|
215 | 218 | struct trace_array_cpu *data; |
---|
216 | 219 | unsigned long flags; |
---|
217 | | - unsigned int trace_ctx; |
---|
| 220 | + int pc; |
---|
218 | 221 | |
---|
219 | | - if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
---|
| 222 | + if (!func_prolog_preempt_disable(tr, &data, &pc)) |
---|
220 | 223 | return; |
---|
221 | 224 | |
---|
222 | 225 | local_irq_save(flags); |
---|
223 | | - trace_function(tr, ip, parent_ip, trace_ctx); |
---|
| 226 | + trace_function(tr, ip, parent_ip, flags, pc); |
---|
224 | 227 | local_irq_restore(flags); |
---|
225 | 228 | |
---|
226 | 229 | atomic_dec(&data->disabled); |
---|
.. | .. |
---|
300 | 303 | static void |
---|
301 | 304 | __trace_function(struct trace_array *tr, |
---|
302 | 305 | unsigned long ip, unsigned long parent_ip, |
---|
303 | | - unsigned int trace_ctx) |
---|
| 306 | + unsigned long flags, int pc) |
---|
304 | 307 | { |
---|
305 | 308 | if (is_graph(tr)) |
---|
306 | | - trace_graph_function(tr, ip, parent_ip, trace_ctx); |
---|
| 309 | + trace_graph_function(tr, ip, parent_ip, flags, pc); |
---|
307 | 310 | else |
---|
308 | | - trace_function(tr, ip, parent_ip, trace_ctx); |
---|
| 311 | + trace_function(tr, ip, parent_ip, flags, pc); |
---|
309 | 312 | } |
---|
310 | 313 | |
---|
311 | 314 | static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set) |
---|
.. | .. |
---|
372 | 375 | tracing_sched_switch_trace(struct trace_array *tr, |
---|
373 | 376 | struct task_struct *prev, |
---|
374 | 377 | struct task_struct *next, |
---|
375 | | - unsigned int trace_ctx) |
---|
| 378 | + unsigned long flags, int pc) |
---|
376 | 379 | { |
---|
377 | 380 | struct trace_event_call *call = &event_context_switch; |
---|
378 | 381 | struct trace_buffer *buffer = tr->array_buffer.buffer; |
---|
.. | .. |
---|
380 | 383 | struct ctx_switch_entry *entry; |
---|
381 | 384 | |
---|
382 | 385 | event = trace_buffer_lock_reserve(buffer, TRACE_CTX, |
---|
383 | | - sizeof(*entry), trace_ctx); |
---|
| 386 | + sizeof(*entry), flags, pc); |
---|
384 | 387 | if (!event) |
---|
385 | 388 | return; |
---|
386 | 389 | entry = ring_buffer_event_data(event); |
---|
.. | .. |
---|
393 | 396 | entry->next_cpu = task_cpu(next); |
---|
394 | 397 | |
---|
395 | 398 | if (!call_filter_check_discard(call, entry, buffer, event)) |
---|
396 | | - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); |
---|
| 399 | + trace_buffer_unlock_commit(tr, buffer, event, flags, pc); |
---|
397 | 400 | } |
---|
398 | 401 | |
---|
399 | 402 | static void |
---|
400 | 403 | tracing_sched_wakeup_trace(struct trace_array *tr, |
---|
401 | 404 | struct task_struct *wakee, |
---|
402 | 405 | struct task_struct *curr, |
---|
403 | | - unsigned int trace_ctx) |
---|
| 406 | + unsigned long flags, int pc) |
---|
404 | 407 | { |
---|
405 | 408 | struct trace_event_call *call = &event_wakeup; |
---|
406 | 409 | struct ring_buffer_event *event; |
---|
.. | .. |
---|
408 | 411 | struct trace_buffer *buffer = tr->array_buffer.buffer; |
---|
409 | 412 | |
---|
410 | 413 | event = trace_buffer_lock_reserve(buffer, TRACE_WAKE, |
---|
411 | | - sizeof(*entry), trace_ctx); |
---|
| 414 | + sizeof(*entry), flags, pc); |
---|
412 | 415 | if (!event) |
---|
413 | 416 | return; |
---|
414 | 417 | entry = ring_buffer_event_data(event); |
---|
.. | .. |
---|
421 | 424 | entry->next_cpu = task_cpu(wakee); |
---|
422 | 425 | |
---|
423 | 426 | if (!call_filter_check_discard(call, entry, buffer, event)) |
---|
424 | | - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); |
---|
| 427 | + trace_buffer_unlock_commit(tr, buffer, event, flags, pc); |
---|
425 | 428 | } |
---|
426 | 429 | |
---|
427 | 430 | static void notrace |
---|
.. | .. |
---|
433 | 436 | unsigned long flags; |
---|
434 | 437 | long disabled; |
---|
435 | 438 | int cpu; |
---|
436 | | - unsigned int trace_ctx; |
---|
| 439 | + int pc; |
---|
437 | 440 | |
---|
438 | 441 | tracing_record_cmdline(prev); |
---|
439 | 442 | |
---|
.. | .. |
---|
452 | 455 | if (next != wakeup_task) |
---|
453 | 456 | return; |
---|
454 | 457 | |
---|
| 458 | + pc = preempt_count(); |
---|
| 459 | + |
---|
455 | 460 | /* disable local data, not wakeup_cpu data */ |
---|
456 | 461 | cpu = raw_smp_processor_id(); |
---|
457 | 462 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
---|
.. | .. |
---|
459 | 464 | goto out; |
---|
460 | 465 | |
---|
461 | 466 | local_irq_save(flags); |
---|
462 | | - trace_ctx = tracing_gen_ctx_flags(flags); |
---|
463 | | - |
---|
464 | 467 | arch_spin_lock(&wakeup_lock); |
---|
465 | 468 | |
---|
466 | 469 | /* We could race with grabbing wakeup_lock */ |
---|
.. | .. |
---|
470 | 473 | /* The task we are waiting for is waking up */ |
---|
471 | 474 | data = per_cpu_ptr(wakeup_trace->array_buffer.data, wakeup_cpu); |
---|
472 | 475 | |
---|
473 | | - __trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, trace_ctx); |
---|
474 | | - tracing_sched_switch_trace(wakeup_trace, prev, next, trace_ctx); |
---|
475 | | - __trace_stack(wakeup_trace, trace_ctx, 0); |
---|
| 476 | + __trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, flags, pc); |
---|
| 477 | + tracing_sched_switch_trace(wakeup_trace, prev, next, flags, pc); |
---|
| 478 | + __trace_stack(wakeup_trace, flags, 0, pc); |
---|
476 | 479 | |
---|
477 | 480 | T0 = data->preempt_timestamp; |
---|
478 | 481 | T1 = ftrace_now(cpu); |
---|
.. | .. |
---|
524 | 527 | { |
---|
525 | 528 | struct trace_array_cpu *data; |
---|
526 | 529 | int cpu = smp_processor_id(); |
---|
| 530 | + unsigned long flags; |
---|
527 | 531 | long disabled; |
---|
528 | | - unsigned int trace_ctx; |
---|
| 532 | + int pc; |
---|
529 | 533 | |
---|
530 | 534 | if (likely(!tracer_enabled)) |
---|
531 | 535 | return; |
---|
.. | .. |
---|
546 | 550 | (!dl_task(p) && (p->prio >= wakeup_prio || p->prio >= current->prio))) |
---|
547 | 551 | return; |
---|
548 | 552 | |
---|
| 553 | + pc = preempt_count(); |
---|
549 | 554 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
---|
550 | 555 | if (unlikely(disabled != 1)) |
---|
551 | 556 | goto out; |
---|
552 | | - |
---|
553 | | - trace_ctx = tracing_gen_ctx(); |
---|
554 | 557 | |
---|
555 | 558 | /* interrupts should be off from try_to_wake_up */ |
---|
556 | 559 | arch_spin_lock(&wakeup_lock); |
---|
.. | .. |
---|
578 | 581 | |
---|
579 | 582 | wakeup_task = get_task_struct(p); |
---|
580 | 583 | |
---|
| 584 | + local_save_flags(flags); |
---|
| 585 | + |
---|
581 | 586 | data = per_cpu_ptr(wakeup_trace->array_buffer.data, wakeup_cpu); |
---|
582 | 587 | data->preempt_timestamp = ftrace_now(cpu); |
---|
583 | | - tracing_sched_wakeup_trace(wakeup_trace, p, current, trace_ctx); |
---|
584 | | - __trace_stack(wakeup_trace, trace_ctx, 0); |
---|
| 588 | + tracing_sched_wakeup_trace(wakeup_trace, p, current, flags, pc); |
---|
| 589 | + __trace_stack(wakeup_trace, flags, 0, pc); |
---|
585 | 590 | |
---|
586 | 591 | /* |
---|
587 | 592 | * We must be careful in using CALLER_ADDR2. But since wake_up |
---|
588 | 593 | * is not called by an assembly function (where as schedule is) |
---|
589 | 594 | * it should be safe to use it here. |
---|
590 | 595 | */ |
---|
591 | | - __trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, trace_ctx); |
---|
| 596 | + __trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc); |
---|
592 | 597 | |
---|
593 | 598 | out_locked: |
---|
594 | 599 | arch_spin_unlock(&wakeup_lock); |
---|