| .. | .. |
|---|
| 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(); |
|---|
| .. | .. |
|---|
| 168 | 171 | { |
|---|
| 169 | 172 | if (is_graph(iter->tr)) |
|---|
| 170 | 173 | graph_trace_open(iter); |
|---|
| 174 | + else |
|---|
| 175 | + iter->private = NULL; |
|---|
| 171 | 176 | } |
|---|
| 172 | 177 | |
|---|
| 173 | 178 | static void wakeup_trace_close(struct trace_iterator *iter) |
|---|
| .. | .. |
|---|
| 214 | 219 | struct trace_array *tr = wakeup_trace; |
|---|
| 215 | 220 | struct trace_array_cpu *data; |
|---|
| 216 | 221 | unsigned long flags; |
|---|
| 217 | | - unsigned int trace_ctx; |
|---|
| 222 | + int pc; |
|---|
| 218 | 223 | |
|---|
| 219 | | - if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
|---|
| 224 | + if (!func_prolog_preempt_disable(tr, &data, &pc)) |
|---|
| 220 | 225 | return; |
|---|
| 221 | 226 | |
|---|
| 222 | 227 | local_irq_save(flags); |
|---|
| 223 | | - trace_function(tr, ip, parent_ip, trace_ctx); |
|---|
| 228 | + trace_function(tr, ip, parent_ip, flags, pc); |
|---|
| 224 | 229 | local_irq_restore(flags); |
|---|
| 225 | 230 | |
|---|
| 226 | 231 | atomic_dec(&data->disabled); |
|---|
| .. | .. |
|---|
| 300 | 305 | static void |
|---|
| 301 | 306 | __trace_function(struct trace_array *tr, |
|---|
| 302 | 307 | unsigned long ip, unsigned long parent_ip, |
|---|
| 303 | | - unsigned int trace_ctx) |
|---|
| 308 | + unsigned long flags, int pc) |
|---|
| 304 | 309 | { |
|---|
| 305 | 310 | if (is_graph(tr)) |
|---|
| 306 | | - trace_graph_function(tr, ip, parent_ip, trace_ctx); |
|---|
| 311 | + trace_graph_function(tr, ip, parent_ip, flags, pc); |
|---|
| 307 | 312 | else |
|---|
| 308 | | - trace_function(tr, ip, parent_ip, trace_ctx); |
|---|
| 313 | + trace_function(tr, ip, parent_ip, flags, pc); |
|---|
| 309 | 314 | } |
|---|
| 310 | 315 | |
|---|
| 311 | 316 | static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set) |
|---|
| .. | .. |
|---|
| 372 | 377 | tracing_sched_switch_trace(struct trace_array *tr, |
|---|
| 373 | 378 | struct task_struct *prev, |
|---|
| 374 | 379 | struct task_struct *next, |
|---|
| 375 | | - unsigned int trace_ctx) |
|---|
| 380 | + unsigned long flags, int pc) |
|---|
| 376 | 381 | { |
|---|
| 377 | 382 | struct trace_event_call *call = &event_context_switch; |
|---|
| 378 | 383 | struct trace_buffer *buffer = tr->array_buffer.buffer; |
|---|
| .. | .. |
|---|
| 380 | 385 | struct ctx_switch_entry *entry; |
|---|
| 381 | 386 | |
|---|
| 382 | 387 | event = trace_buffer_lock_reserve(buffer, TRACE_CTX, |
|---|
| 383 | | - sizeof(*entry), trace_ctx); |
|---|
| 388 | + sizeof(*entry), flags, pc); |
|---|
| 384 | 389 | if (!event) |
|---|
| 385 | 390 | return; |
|---|
| 386 | 391 | entry = ring_buffer_event_data(event); |
|---|
| .. | .. |
|---|
| 393 | 398 | entry->next_cpu = task_cpu(next); |
|---|
| 394 | 399 | |
|---|
| 395 | 400 | if (!call_filter_check_discard(call, entry, buffer, event)) |
|---|
| 396 | | - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); |
|---|
| 401 | + trace_buffer_unlock_commit(tr, buffer, event, flags, pc); |
|---|
| 397 | 402 | } |
|---|
| 398 | 403 | |
|---|
| 399 | 404 | static void |
|---|
| 400 | 405 | tracing_sched_wakeup_trace(struct trace_array *tr, |
|---|
| 401 | 406 | struct task_struct *wakee, |
|---|
| 402 | 407 | struct task_struct *curr, |
|---|
| 403 | | - unsigned int trace_ctx) |
|---|
| 408 | + unsigned long flags, int pc) |
|---|
| 404 | 409 | { |
|---|
| 405 | 410 | struct trace_event_call *call = &event_wakeup; |
|---|
| 406 | 411 | struct ring_buffer_event *event; |
|---|
| .. | .. |
|---|
| 408 | 413 | struct trace_buffer *buffer = tr->array_buffer.buffer; |
|---|
| 409 | 414 | |
|---|
| 410 | 415 | event = trace_buffer_lock_reserve(buffer, TRACE_WAKE, |
|---|
| 411 | | - sizeof(*entry), trace_ctx); |
|---|
| 416 | + sizeof(*entry), flags, pc); |
|---|
| 412 | 417 | if (!event) |
|---|
| 413 | 418 | return; |
|---|
| 414 | 419 | entry = ring_buffer_event_data(event); |
|---|
| .. | .. |
|---|
| 421 | 426 | entry->next_cpu = task_cpu(wakee); |
|---|
| 422 | 427 | |
|---|
| 423 | 428 | if (!call_filter_check_discard(call, entry, buffer, event)) |
|---|
| 424 | | - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); |
|---|
| 429 | + trace_buffer_unlock_commit(tr, buffer, event, flags, pc); |
|---|
| 425 | 430 | } |
|---|
| 426 | 431 | |
|---|
| 427 | 432 | static void notrace |
|---|
| .. | .. |
|---|
| 433 | 438 | unsigned long flags; |
|---|
| 434 | 439 | long disabled; |
|---|
| 435 | 440 | int cpu; |
|---|
| 436 | | - unsigned int trace_ctx; |
|---|
| 441 | + int pc; |
|---|
| 437 | 442 | |
|---|
| 438 | 443 | tracing_record_cmdline(prev); |
|---|
| 439 | 444 | |
|---|
| .. | .. |
|---|
| 452 | 457 | if (next != wakeup_task) |
|---|
| 453 | 458 | return; |
|---|
| 454 | 459 | |
|---|
| 460 | + pc = preempt_count(); |
|---|
| 461 | + |
|---|
| 455 | 462 | /* disable local data, not wakeup_cpu data */ |
|---|
| 456 | 463 | cpu = raw_smp_processor_id(); |
|---|
| 457 | 464 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
|---|
| .. | .. |
|---|
| 459 | 466 | goto out; |
|---|
| 460 | 467 | |
|---|
| 461 | 468 | local_irq_save(flags); |
|---|
| 462 | | - trace_ctx = tracing_gen_ctx_flags(flags); |
|---|
| 463 | | - |
|---|
| 464 | 469 | arch_spin_lock(&wakeup_lock); |
|---|
| 465 | 470 | |
|---|
| 466 | 471 | /* We could race with grabbing wakeup_lock */ |
|---|
| .. | .. |
|---|
| 470 | 475 | /* The task we are waiting for is waking up */ |
|---|
| 471 | 476 | data = per_cpu_ptr(wakeup_trace->array_buffer.data, wakeup_cpu); |
|---|
| 472 | 477 | |
|---|
| 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); |
|---|
| 478 | + __trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, flags, pc); |
|---|
| 479 | + tracing_sched_switch_trace(wakeup_trace, prev, next, flags, pc); |
|---|
| 480 | + __trace_stack(wakeup_trace, flags, 0, pc); |
|---|
| 476 | 481 | |
|---|
| 477 | 482 | T0 = data->preempt_timestamp; |
|---|
| 478 | 483 | T1 = ftrace_now(cpu); |
|---|
| .. | .. |
|---|
| 524 | 529 | { |
|---|
| 525 | 530 | struct trace_array_cpu *data; |
|---|
| 526 | 531 | int cpu = smp_processor_id(); |
|---|
| 532 | + unsigned long flags; |
|---|
| 527 | 533 | long disabled; |
|---|
| 528 | | - unsigned int trace_ctx; |
|---|
| 534 | + int pc; |
|---|
| 529 | 535 | |
|---|
| 530 | 536 | if (likely(!tracer_enabled)) |
|---|
| 531 | 537 | return; |
|---|
| .. | .. |
|---|
| 546 | 552 | (!dl_task(p) && (p->prio >= wakeup_prio || p->prio >= current->prio))) |
|---|
| 547 | 553 | return; |
|---|
| 548 | 554 | |
|---|
| 555 | + pc = preempt_count(); |
|---|
| 549 | 556 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
|---|
| 550 | 557 | if (unlikely(disabled != 1)) |
|---|
| 551 | 558 | goto out; |
|---|
| 552 | | - |
|---|
| 553 | | - trace_ctx = tracing_gen_ctx(); |
|---|
| 554 | 559 | |
|---|
| 555 | 560 | /* interrupts should be off from try_to_wake_up */ |
|---|
| 556 | 561 | arch_spin_lock(&wakeup_lock); |
|---|
| .. | .. |
|---|
| 578 | 583 | |
|---|
| 579 | 584 | wakeup_task = get_task_struct(p); |
|---|
| 580 | 585 | |
|---|
| 586 | + local_save_flags(flags); |
|---|
| 587 | + |
|---|
| 581 | 588 | data = per_cpu_ptr(wakeup_trace->array_buffer.data, wakeup_cpu); |
|---|
| 582 | 589 | 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); |
|---|
| 590 | + tracing_sched_wakeup_trace(wakeup_trace, p, current, flags, pc); |
|---|
| 591 | + __trace_stack(wakeup_trace, flags, 0, pc); |
|---|
| 585 | 592 | |
|---|
| 586 | 593 | /* |
|---|
| 587 | 594 | * We must be careful in using CALLER_ADDR2. But since wake_up |
|---|
| 588 | 595 | * is not called by an assembly function (where as schedule is) |
|---|
| 589 | 596 | * it should be safe to use it here. |
|---|
| 590 | 597 | */ |
|---|
| 591 | | - __trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, trace_ctx); |
|---|
| 598 | + __trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc); |
|---|
| 592 | 599 | |
|---|
| 593 | 600 | out_locked: |
|---|
| 594 | 601 | arch_spin_unlock(&wakeup_lock); |
|---|