hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/kernel/trace/trace.h
....@@ -136,6 +136,25 @@
136136 unsigned long ret_ip;
137137 };
138138
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
+
139158 #define TRACE_BUF_SIZE 1024
140159
141160 struct trace_array;
....@@ -706,8 +725,11 @@
706725 void tracing_reset_online_cpus(struct array_buffer *buf);
707726 void tracing_reset_current(int cpu);
708727 void tracing_reset_all_online_cpus(void);
728
+void tracing_reset_all_online_cpus_unlocked(void);
709729 int tracing_open_generic(struct inode *inode, struct file *filp);
710730 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);
711733 bool tracing_is_disabled(void);
712734 bool tracer_tracing_is_on(struct trace_array *tr);
713735 void tracer_tracing_on(struct trace_array *tr);
....@@ -726,7 +748,8 @@
726748 trace_buffer_lock_reserve(struct trace_buffer *buffer,
727749 int type,
728750 unsigned long len,
729
- unsigned int trace_ctx);
751
+ unsigned long flags,
752
+ int pc);
730753
731754 struct trace_entry *tracing_get_trace_entry(struct trace_array *tr,
732755 struct trace_array_cpu *data);
....@@ -751,11 +774,11 @@
751774 void trace_function(struct trace_array *tr,
752775 unsigned long ip,
753776 unsigned long parent_ip,
754
- unsigned int trace_ctx);
777
+ unsigned long flags, int pc);
755778 void trace_graph_function(struct trace_array *tr,
756779 unsigned long ip,
757780 unsigned long parent_ip,
758
- unsigned int trace_ctx);
781
+ unsigned long flags, int pc);
759782 void trace_latency_header(struct seq_file *m);
760783 void trace_default_header(struct seq_file *m);
761784 void print_trace_header(struct seq_file *m, struct trace_iterator *iter);
....@@ -823,10 +846,11 @@
823846 #endif
824847
825848 #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);
827851 #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)
830854 {
831855 }
832856 #endif /* CONFIG_STACKTRACE */
....@@ -966,10 +990,10 @@
966990 extern void graph_trace_close(struct trace_iterator *iter);
967991 extern int __trace_graph_entry(struct trace_array *tr,
968992 struct ftrace_graph_ent *trace,
969
- unsigned int trace_ctx);
993
+ unsigned long flags, int pc);
970994 extern void __trace_graph_return(struct trace_array *tr,
971995 struct ftrace_graph_ret *trace,
972
- unsigned int trace_ctx);
996
+ unsigned long flags, int pc);
973997
974998 #ifdef CONFIG_DYNAMIC_FTRACE
975999 extern struct ftrace_hash __rcu *ftrace_graph_hash;
....@@ -1432,15 +1456,15 @@
14321456 void trace_buffer_unlock_commit_regs(struct trace_array *tr,
14331457 struct trace_buffer *buffer,
14341458 struct ring_buffer_event *event,
1435
- unsigned int trcace_ctx,
1459
+ unsigned long flags, int pc,
14361460 struct pt_regs *regs);
14371461
14381462 static inline void trace_buffer_unlock_commit(struct trace_array *tr,
14391463 struct trace_buffer *buffer,
14401464 struct ring_buffer_event *event,
1441
- unsigned int trace_ctx)
1465
+ unsigned long flags, int pc)
14421466 {
1443
- trace_buffer_unlock_commit_regs(tr, buffer, event, trace_ctx, NULL);
1467
+ trace_buffer_unlock_commit_regs(tr, buffer, event, flags, pc, NULL);
14441468 }
14451469
14461470 DECLARE_PER_CPU(struct ring_buffer_event *, trace_buffered_event);
....@@ -1513,7 +1537,8 @@
15131537 * @buffer: The ring buffer that the event is being written to
15141538 * @event: The event meta data in the ring buffer
15151539 * @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.
15171542 *
15181543 * This is a helper function to handle triggers that require data
15191544 * from the event itself. It also tests the event against filters and
....@@ -1523,12 +1548,12 @@
15231548 event_trigger_unlock_commit(struct trace_event_file *file,
15241549 struct trace_buffer *buffer,
15251550 struct ring_buffer_event *event,
1526
- void *entry, unsigned int trace_ctx)
1551
+ void *entry, unsigned long irq_flags, int pc)
15271552 {
15281553 enum event_trigger_type tt = ETT_NONE;
15291554
15301555 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);
15321557
15331558 if (tt)
15341559 event_triggers_post_call(file, tt);
....@@ -1540,7 +1565,8 @@
15401565 * @buffer: The ring buffer that the event is being written to
15411566 * @event: The event meta data in the ring buffer
15421567 * @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.
15441570 *
15451571 * This is a helper function to handle triggers that require data
15461572 * from the event itself. It also tests the event against filters and
....@@ -1553,14 +1579,14 @@
15531579 event_trigger_unlock_commit_regs(struct trace_event_file *file,
15541580 struct trace_buffer *buffer,
15551581 struct ring_buffer_event *event,
1556
- void *entry, unsigned int trace_ctx,
1582
+ void *entry, unsigned long irq_flags, int pc,
15571583 struct pt_regs *regs)
15581584 {
15591585 enum event_trigger_type tt = ETT_NONE;
15601586
15611587 if (!__event_trigger_test_discard(file, buffer, event, entry, &tt))
15621588 trace_buffer_unlock_commit_regs(file->tr, buffer, event,
1563
- trace_ctx, regs);
1589
+ irq_flags, pc, regs);
15641590
15651591 if (tt)
15661592 event_triggers_post_call(file, tt);
....@@ -1650,6 +1676,7 @@
16501676 extern void trace_event_enable_tgid_record(bool enable);
16511677
16521678 extern int event_trace_init(void);
1679
+extern int init_events(void);
16531680 extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr);
16541681 extern int event_trace_del_tracer(struct trace_array *tr);
16551682 extern void __trace_early_add_events(struct trace_array *tr);