| .. | .. |
|---|
| 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; |
|---|
| .. | .. |
|---|
| 706 | 725 | void tracing_reset_online_cpus(struct array_buffer *buf); |
|---|
| 707 | 726 | void tracing_reset_current(int cpu); |
|---|
| 708 | 727 | void tracing_reset_all_online_cpus(void); |
|---|
| 728 | +void tracing_reset_all_online_cpus_unlocked(void); |
|---|
| 709 | 729 | int tracing_open_generic(struct inode *inode, struct file *filp); |
|---|
| 710 | 730 | int tracing_open_generic_tr(struct inode *inode, struct file *filp); |
|---|
| 731 | +int tracing_open_file_tr(struct inode *inode, struct file *filp); |
|---|
| 732 | +int tracing_release_file_tr(struct inode *inode, struct file *filp); |
|---|
| 711 | 733 | bool tracing_is_disabled(void); |
|---|
| 712 | 734 | bool tracer_tracing_is_on(struct trace_array *tr); |
|---|
| 713 | 735 | void tracer_tracing_on(struct trace_array *tr); |
|---|
| .. | .. |
|---|
| 726 | 748 | trace_buffer_lock_reserve(struct trace_buffer *buffer, |
|---|
| 727 | 749 | int type, |
|---|
| 728 | 750 | unsigned long len, |
|---|
| 729 | | - unsigned int trace_ctx); |
|---|
| 751 | + unsigned long flags, |
|---|
| 752 | + int pc); |
|---|
| 730 | 753 | |
|---|
| 731 | 754 | struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, |
|---|
| 732 | 755 | struct trace_array_cpu *data); |
|---|
| .. | .. |
|---|
| 751 | 774 | void trace_function(struct trace_array *tr, |
|---|
| 752 | 775 | unsigned long ip, |
|---|
| 753 | 776 | unsigned long parent_ip, |
|---|
| 754 | | - unsigned int trace_ctx); |
|---|
| 777 | + unsigned long flags, int pc); |
|---|
| 755 | 778 | void trace_graph_function(struct trace_array *tr, |
|---|
| 756 | 779 | unsigned long ip, |
|---|
| 757 | 780 | unsigned long parent_ip, |
|---|
| 758 | | - unsigned int trace_ctx); |
|---|
| 781 | + unsigned long flags, int pc); |
|---|
| 759 | 782 | void trace_latency_header(struct seq_file *m); |
|---|
| 760 | 783 | void trace_default_header(struct seq_file *m); |
|---|
| 761 | 784 | void print_trace_header(struct seq_file *m, struct trace_iterator *iter); |
|---|
| .. | .. |
|---|
| 823 | 846 | #endif |
|---|
| 824 | 847 | |
|---|
| 825 | 848 | #ifdef CONFIG_STACKTRACE |
|---|
| 826 | | -void __trace_stack(struct trace_array *tr, unsigned int trace_ctx, int skip); |
|---|
| 849 | +void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
|---|
| 850 | + int pc); |
|---|
| 827 | 851 | #else |
|---|
| 828 | | -static inline void __trace_stack(struct trace_array *tr, unsigned int trace_ctx, |
|---|
| 829 | | - int skip) |
|---|
| 852 | +static inline void __trace_stack(struct trace_array *tr, unsigned long flags, |
|---|
| 853 | + int skip, int pc) |
|---|
| 830 | 854 | { |
|---|
| 831 | 855 | } |
|---|
| 832 | 856 | #endif /* CONFIG_STACKTRACE */ |
|---|
| .. | .. |
|---|
| 966 | 990 | extern void graph_trace_close(struct trace_iterator *iter); |
|---|
| 967 | 991 | extern int __trace_graph_entry(struct trace_array *tr, |
|---|
| 968 | 992 | struct ftrace_graph_ent *trace, |
|---|
| 969 | | - unsigned int trace_ctx); |
|---|
| 993 | + unsigned long flags, int pc); |
|---|
| 970 | 994 | extern void __trace_graph_return(struct trace_array *tr, |
|---|
| 971 | 995 | struct ftrace_graph_ret *trace, |
|---|
| 972 | | - unsigned int trace_ctx); |
|---|
| 996 | + unsigned long flags, int pc); |
|---|
| 973 | 997 | |
|---|
| 974 | 998 | #ifdef CONFIG_DYNAMIC_FTRACE |
|---|
| 975 | 999 | extern struct ftrace_hash __rcu *ftrace_graph_hash; |
|---|
| .. | .. |
|---|
| 1432 | 1456 | void trace_buffer_unlock_commit_regs(struct trace_array *tr, |
|---|
| 1433 | 1457 | struct trace_buffer *buffer, |
|---|
| 1434 | 1458 | struct ring_buffer_event *event, |
|---|
| 1435 | | - unsigned int trcace_ctx, |
|---|
| 1459 | + unsigned long flags, int pc, |
|---|
| 1436 | 1460 | struct pt_regs *regs); |
|---|
| 1437 | 1461 | |
|---|
| 1438 | 1462 | static inline void trace_buffer_unlock_commit(struct trace_array *tr, |
|---|
| 1439 | 1463 | struct trace_buffer *buffer, |
|---|
| 1440 | 1464 | struct ring_buffer_event *event, |
|---|
| 1441 | | - unsigned int trace_ctx) |
|---|
| 1465 | + unsigned long flags, int pc) |
|---|
| 1442 | 1466 | { |
|---|
| 1443 | | - trace_buffer_unlock_commit_regs(tr, buffer, event, trace_ctx, NULL); |
|---|
| 1467 | + trace_buffer_unlock_commit_regs(tr, buffer, event, flags, pc, NULL); |
|---|
| 1444 | 1468 | } |
|---|
| 1445 | 1469 | |
|---|
| 1446 | 1470 | DECLARE_PER_CPU(struct ring_buffer_event *, trace_buffered_event); |
|---|
| .. | .. |
|---|
| 1513 | 1537 | * @buffer: The ring buffer that the event is being written to |
|---|
| 1514 | 1538 | * @event: The event meta data in the ring buffer |
|---|
| 1515 | 1539 | * @entry: The event itself |
|---|
| 1516 | | - * @trace_ctx: The tracing context flags. |
|---|
| 1540 | + * @irq_flags: The state of the interrupts at the start of the event |
|---|
| 1541 | + * @pc: The state of the preempt count at the start of the event. |
|---|
| 1517 | 1542 | * |
|---|
| 1518 | 1543 | * This is a helper function to handle triggers that require data |
|---|
| 1519 | 1544 | * from the event itself. It also tests the event against filters and |
|---|
| .. | .. |
|---|
| 1523 | 1548 | event_trigger_unlock_commit(struct trace_event_file *file, |
|---|
| 1524 | 1549 | struct trace_buffer *buffer, |
|---|
| 1525 | 1550 | struct ring_buffer_event *event, |
|---|
| 1526 | | - void *entry, unsigned int trace_ctx) |
|---|
| 1551 | + void *entry, unsigned long irq_flags, int pc) |
|---|
| 1527 | 1552 | { |
|---|
| 1528 | 1553 | enum event_trigger_type tt = ETT_NONE; |
|---|
| 1529 | 1554 | |
|---|
| 1530 | 1555 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) |
|---|
| 1531 | | - trace_buffer_unlock_commit(file->tr, buffer, event, trace_ctx); |
|---|
| 1556 | + trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); |
|---|
| 1532 | 1557 | |
|---|
| 1533 | 1558 | if (tt) |
|---|
| 1534 | 1559 | event_triggers_post_call(file, tt); |
|---|
| .. | .. |
|---|
| 1540 | 1565 | * @buffer: The ring buffer that the event is being written to |
|---|
| 1541 | 1566 | * @event: The event meta data in the ring buffer |
|---|
| 1542 | 1567 | * @entry: The event itself |
|---|
| 1543 | | - * @trace_ctx: The tracing context flags. |
|---|
| 1568 | + * @irq_flags: The state of the interrupts at the start of the event |
|---|
| 1569 | + * @pc: The state of the preempt count at the start of the event. |
|---|
| 1544 | 1570 | * |
|---|
| 1545 | 1571 | * This is a helper function to handle triggers that require data |
|---|
| 1546 | 1572 | * from the event itself. It also tests the event against filters and |
|---|
| .. | .. |
|---|
| 1553 | 1579 | event_trigger_unlock_commit_regs(struct trace_event_file *file, |
|---|
| 1554 | 1580 | struct trace_buffer *buffer, |
|---|
| 1555 | 1581 | struct ring_buffer_event *event, |
|---|
| 1556 | | - void *entry, unsigned int trace_ctx, |
|---|
| 1582 | + void *entry, unsigned long irq_flags, int pc, |
|---|
| 1557 | 1583 | struct pt_regs *regs) |
|---|
| 1558 | 1584 | { |
|---|
| 1559 | 1585 | enum event_trigger_type tt = ETT_NONE; |
|---|
| 1560 | 1586 | |
|---|
| 1561 | 1587 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) |
|---|
| 1562 | 1588 | trace_buffer_unlock_commit_regs(file->tr, buffer, event, |
|---|
| 1563 | | - trace_ctx, regs); |
|---|
| 1589 | + irq_flags, pc, regs); |
|---|
| 1564 | 1590 | |
|---|
| 1565 | 1591 | if (tt) |
|---|
| 1566 | 1592 | event_triggers_post_call(file, tt); |
|---|
| .. | .. |
|---|
| 1650 | 1676 | extern void trace_event_enable_tgid_record(bool enable); |
|---|
| 1651 | 1677 | |
|---|
| 1652 | 1678 | extern int event_trace_init(void); |
|---|
| 1679 | +extern int init_events(void); |
|---|
| 1653 | 1680 | extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr); |
|---|
| 1654 | 1681 | extern int event_trace_del_tracer(struct trace_array *tr); |
|---|
| 1655 | 1682 | extern void __trace_early_add_events(struct trace_array *tr); |
|---|