| .. | .. |
|---|
| 136 | 136 | unsigned long ret_ip; |
|---|
| 137 | 137 | }; |
|---|
| 138 | 138 | |
|---|
| 139 | +/* |
|---|
| 140 | + * trace_flag_type is an enumeration that holds different |
|---|
| 141 | + * states when a trace occurs. These are: |
|---|
| 142 | + * IRQS_OFF - interrupts were disabled |
|---|
| 143 | + * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags |
|---|
| 144 | + * NEED_RESCHED - reschedule is requested |
|---|
| 145 | + * HARDIRQ - inside an interrupt handler |
|---|
| 146 | + * SOFTIRQ - inside a softirq handler |
|---|
| 147 | + */ |
|---|
| 148 | +enum trace_flag_type { |
|---|
| 149 | + TRACE_FLAG_IRQS_OFF = 0x01, |
|---|
| 150 | + TRACE_FLAG_IRQS_NOSUPPORT = 0x02, |
|---|
| 151 | + TRACE_FLAG_NEED_RESCHED = 0x04, |
|---|
| 152 | + TRACE_FLAG_HARDIRQ = 0x08, |
|---|
| 153 | + TRACE_FLAG_SOFTIRQ = 0x10, |
|---|
| 154 | + TRACE_FLAG_PREEMPT_RESCHED = 0x20, |
|---|
| 155 | + TRACE_FLAG_NMI = 0x40, |
|---|
| 156 | +}; |
|---|
| 157 | + |
|---|
| 139 | 158 | #define TRACE_BUF_SIZE 1024 |
|---|
| 140 | 159 | |
|---|
| 141 | 160 | struct trace_array; |
|---|
| .. | .. |
|---|
| 726 | 745 | trace_buffer_lock_reserve(struct trace_buffer *buffer, |
|---|
| 727 | 746 | int type, |
|---|
| 728 | 747 | unsigned long len, |
|---|
| 729 | | - unsigned int trace_ctx); |
|---|
| 748 | + unsigned long flags, |
|---|
| 749 | + int pc); |
|---|
| 730 | 750 | |
|---|
| 731 | 751 | struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, |
|---|
| 732 | 752 | struct trace_array_cpu *data); |
|---|
| .. | .. |
|---|
| 751 | 771 | void trace_function(struct trace_array *tr, |
|---|
| 752 | 772 | unsigned long ip, |
|---|
| 753 | 773 | unsigned long parent_ip, |
|---|
| 754 | | - unsigned int trace_ctx); |
|---|
| 774 | + unsigned long flags, int pc); |
|---|
| 755 | 775 | void trace_graph_function(struct trace_array *tr, |
|---|
| 756 | 776 | unsigned long ip, |
|---|
| 757 | 777 | unsigned long parent_ip, |
|---|
| 758 | | - unsigned int trace_ctx); |
|---|
| 778 | + unsigned long flags, int pc); |
|---|
| 759 | 779 | void trace_latency_header(struct seq_file *m); |
|---|
| 760 | 780 | void trace_default_header(struct seq_file *m); |
|---|
| 761 | 781 | void print_trace_header(struct seq_file *m, struct trace_iterator *iter); |
|---|
| .. | .. |
|---|
| 823 | 843 | #endif |
|---|
| 824 | 844 | |
|---|
| 825 | 845 | #ifdef CONFIG_STACKTRACE |
|---|
| 826 | | -void __trace_stack(struct trace_array *tr, unsigned int trace_ctx, int skip); |
|---|
| 846 | +void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
|---|
| 847 | + int pc); |
|---|
| 827 | 848 | #else |
|---|
| 828 | | -static inline void __trace_stack(struct trace_array *tr, unsigned int trace_ctx, |
|---|
| 829 | | - int skip) |
|---|
| 849 | +static inline void __trace_stack(struct trace_array *tr, unsigned long flags, |
|---|
| 850 | + int skip, int pc) |
|---|
| 830 | 851 | { |
|---|
| 831 | 852 | } |
|---|
| 832 | 853 | #endif /* CONFIG_STACKTRACE */ |
|---|
| .. | .. |
|---|
| 966 | 987 | extern void graph_trace_close(struct trace_iterator *iter); |
|---|
| 967 | 988 | extern int __trace_graph_entry(struct trace_array *tr, |
|---|
| 968 | 989 | struct ftrace_graph_ent *trace, |
|---|
| 969 | | - unsigned int trace_ctx); |
|---|
| 990 | + unsigned long flags, int pc); |
|---|
| 970 | 991 | extern void __trace_graph_return(struct trace_array *tr, |
|---|
| 971 | 992 | struct ftrace_graph_ret *trace, |
|---|
| 972 | | - unsigned int trace_ctx); |
|---|
| 993 | + unsigned long flags, int pc); |
|---|
| 973 | 994 | |
|---|
| 974 | 995 | #ifdef CONFIG_DYNAMIC_FTRACE |
|---|
| 975 | 996 | extern struct ftrace_hash __rcu *ftrace_graph_hash; |
|---|
| .. | .. |
|---|
| 1432 | 1453 | void trace_buffer_unlock_commit_regs(struct trace_array *tr, |
|---|
| 1433 | 1454 | struct trace_buffer *buffer, |
|---|
| 1434 | 1455 | struct ring_buffer_event *event, |
|---|
| 1435 | | - unsigned int trcace_ctx, |
|---|
| 1456 | + unsigned long flags, int pc, |
|---|
| 1436 | 1457 | struct pt_regs *regs); |
|---|
| 1437 | 1458 | |
|---|
| 1438 | 1459 | static inline void trace_buffer_unlock_commit(struct trace_array *tr, |
|---|
| 1439 | 1460 | struct trace_buffer *buffer, |
|---|
| 1440 | 1461 | struct ring_buffer_event *event, |
|---|
| 1441 | | - unsigned int trace_ctx) |
|---|
| 1462 | + unsigned long flags, int pc) |
|---|
| 1442 | 1463 | { |
|---|
| 1443 | | - trace_buffer_unlock_commit_regs(tr, buffer, event, trace_ctx, NULL); |
|---|
| 1464 | + trace_buffer_unlock_commit_regs(tr, buffer, event, flags, pc, NULL); |
|---|
| 1444 | 1465 | } |
|---|
| 1445 | 1466 | |
|---|
| 1446 | 1467 | DECLARE_PER_CPU(struct ring_buffer_event *, trace_buffered_event); |
|---|
| .. | .. |
|---|
| 1513 | 1534 | * @buffer: The ring buffer that the event is being written to |
|---|
| 1514 | 1535 | * @event: The event meta data in the ring buffer |
|---|
| 1515 | 1536 | * @entry: The event itself |
|---|
| 1516 | | - * @trace_ctx: The tracing context flags. |
|---|
| 1537 | + * @irq_flags: The state of the interrupts at the start of the event |
|---|
| 1538 | + * @pc: The state of the preempt count at the start of the event. |
|---|
| 1517 | 1539 | * |
|---|
| 1518 | 1540 | * This is a helper function to handle triggers that require data |
|---|
| 1519 | 1541 | * from the event itself. It also tests the event against filters and |
|---|
| .. | .. |
|---|
| 1523 | 1545 | event_trigger_unlock_commit(struct trace_event_file *file, |
|---|
| 1524 | 1546 | struct trace_buffer *buffer, |
|---|
| 1525 | 1547 | struct ring_buffer_event *event, |
|---|
| 1526 | | - void *entry, unsigned int trace_ctx) |
|---|
| 1548 | + void *entry, unsigned long irq_flags, int pc) |
|---|
| 1527 | 1549 | { |
|---|
| 1528 | 1550 | enum event_trigger_type tt = ETT_NONE; |
|---|
| 1529 | 1551 | |
|---|
| 1530 | 1552 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) |
|---|
| 1531 | | - trace_buffer_unlock_commit(file->tr, buffer, event, trace_ctx); |
|---|
| 1553 | + trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); |
|---|
| 1532 | 1554 | |
|---|
| 1533 | 1555 | if (tt) |
|---|
| 1534 | 1556 | event_triggers_post_call(file, tt); |
|---|
| .. | .. |
|---|
| 1540 | 1562 | * @buffer: The ring buffer that the event is being written to |
|---|
| 1541 | 1563 | * @event: The event meta data in the ring buffer |
|---|
| 1542 | 1564 | * @entry: The event itself |
|---|
| 1543 | | - * @trace_ctx: The tracing context flags. |
|---|
| 1565 | + * @irq_flags: The state of the interrupts at the start of the event |
|---|
| 1566 | + * @pc: The state of the preempt count at the start of the event. |
|---|
| 1544 | 1567 | * |
|---|
| 1545 | 1568 | * This is a helper function to handle triggers that require data |
|---|
| 1546 | 1569 | * from the event itself. It also tests the event against filters and |
|---|
| .. | .. |
|---|
| 1553 | 1576 | event_trigger_unlock_commit_regs(struct trace_event_file *file, |
|---|
| 1554 | 1577 | struct trace_buffer *buffer, |
|---|
| 1555 | 1578 | struct ring_buffer_event *event, |
|---|
| 1556 | | - void *entry, unsigned int trace_ctx, |
|---|
| 1579 | + void *entry, unsigned long irq_flags, int pc, |
|---|
| 1557 | 1580 | struct pt_regs *regs) |
|---|
| 1558 | 1581 | { |
|---|
| 1559 | 1582 | enum event_trigger_type tt = ETT_NONE; |
|---|
| 1560 | 1583 | |
|---|
| 1561 | 1584 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) |
|---|
| 1562 | 1585 | trace_buffer_unlock_commit_regs(file->tr, buffer, event, |
|---|
| 1563 | | - trace_ctx, regs); |
|---|
| 1586 | + irq_flags, pc, regs); |
|---|
| 1564 | 1587 | |
|---|
| 1565 | 1588 | if (tt) |
|---|
| 1566 | 1589 | event_triggers_post_call(file, tt); |
|---|