From 6778948f9de86c3cfaf36725a7c87dcff9ba247f Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 11 Dec 2023 08:20:59 +0000 Subject: [PATCH] kernel_5.10 no rt --- kernel/kernel/trace/trace.h | 57 ++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 40 insertions(+), 17 deletions(-) diff --git a/kernel/kernel/trace/trace.h b/kernel/kernel/trace/trace.h index bfb9fe2..8d67f7f 100644 --- a/kernel/kernel/trace/trace.h +++ b/kernel/kernel/trace/trace.h @@ -136,6 +136,25 @@ unsigned long ret_ip; }; +/* + * trace_flag_type is an enumeration that holds different + * states when a trace occurs. These are: + * IRQS_OFF - interrupts were disabled + * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags + * NEED_RESCHED - reschedule is requested + * HARDIRQ - inside an interrupt handler + * SOFTIRQ - inside a softirq handler + */ +enum trace_flag_type { + TRACE_FLAG_IRQS_OFF = 0x01, + TRACE_FLAG_IRQS_NOSUPPORT = 0x02, + TRACE_FLAG_NEED_RESCHED = 0x04, + TRACE_FLAG_HARDIRQ = 0x08, + TRACE_FLAG_SOFTIRQ = 0x10, + TRACE_FLAG_PREEMPT_RESCHED = 0x20, + TRACE_FLAG_NMI = 0x40, +}; + #define TRACE_BUF_SIZE 1024 struct trace_array; @@ -726,7 +745,8 @@ trace_buffer_lock_reserve(struct trace_buffer *buffer, int type, unsigned long len, - unsigned int trace_ctx); + unsigned long flags, + int pc); struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, struct trace_array_cpu *data); @@ -751,11 +771,11 @@ void trace_function(struct trace_array *tr, unsigned long ip, unsigned long parent_ip, - unsigned int trace_ctx); + unsigned long flags, int pc); void trace_graph_function(struct trace_array *tr, unsigned long ip, unsigned long parent_ip, - unsigned int trace_ctx); + unsigned long flags, int pc); void trace_latency_header(struct seq_file *m); void trace_default_header(struct seq_file *m); void print_trace_header(struct seq_file *m, struct trace_iterator *iter); @@ -823,10 +843,11 @@ #endif #ifdef CONFIG_STACKTRACE -void __trace_stack(struct trace_array *tr, unsigned int trace_ctx, int skip); +void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, + int pc); #else -static inline void __trace_stack(struct trace_array *tr, unsigned int trace_ctx, - int skip) +static inline void __trace_stack(struct trace_array *tr, unsigned long flags, + int skip, int pc) { } #endif /* CONFIG_STACKTRACE */ @@ -966,10 +987,10 @@ extern void graph_trace_close(struct trace_iterator *iter); extern int __trace_graph_entry(struct trace_array *tr, struct ftrace_graph_ent *trace, - unsigned int trace_ctx); + unsigned long flags, int pc); extern void __trace_graph_return(struct trace_array *tr, struct ftrace_graph_ret *trace, - unsigned int trace_ctx); + unsigned long flags, int pc); #ifdef CONFIG_DYNAMIC_FTRACE extern struct ftrace_hash __rcu *ftrace_graph_hash; @@ -1432,15 +1453,15 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr, struct trace_buffer *buffer, struct ring_buffer_event *event, - unsigned int trcace_ctx, + unsigned long flags, int pc, struct pt_regs *regs); static inline void trace_buffer_unlock_commit(struct trace_array *tr, struct trace_buffer *buffer, struct ring_buffer_event *event, - unsigned int trace_ctx) + unsigned long flags, int pc) { - trace_buffer_unlock_commit_regs(tr, buffer, event, trace_ctx, NULL); + trace_buffer_unlock_commit_regs(tr, buffer, event, flags, pc, NULL); } DECLARE_PER_CPU(struct ring_buffer_event *, trace_buffered_event); @@ -1513,7 +1534,8 @@ * @buffer: The ring buffer that the event is being written to * @event: The event meta data in the ring buffer * @entry: The event itself - * @trace_ctx: The tracing context flags. + * @irq_flags: The state of the interrupts at the start of the event + * @pc: The state of the preempt count at the start of the event. * * This is a helper function to handle triggers that require data * from the event itself. It also tests the event against filters and @@ -1523,12 +1545,12 @@ event_trigger_unlock_commit(struct trace_event_file *file, struct trace_buffer *buffer, struct ring_buffer_event *event, - void *entry, unsigned int trace_ctx) + void *entry, unsigned long irq_flags, int pc) { enum event_trigger_type tt = ETT_NONE; if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) - trace_buffer_unlock_commit(file->tr, buffer, event, trace_ctx); + trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); if (tt) event_triggers_post_call(file, tt); @@ -1540,7 +1562,8 @@ * @buffer: The ring buffer that the event is being written to * @event: The event meta data in the ring buffer * @entry: The event itself - * @trace_ctx: The tracing context flags. + * @irq_flags: The state of the interrupts at the start of the event + * @pc: The state of the preempt count at the start of the event. * * This is a helper function to handle triggers that require data * from the event itself. It also tests the event against filters and @@ -1553,14 +1576,14 @@ event_trigger_unlock_commit_regs(struct trace_event_file *file, struct trace_buffer *buffer, struct ring_buffer_event *event, - void *entry, unsigned int trace_ctx, + void *entry, unsigned long irq_flags, int pc, struct pt_regs *regs) { enum event_trigger_type tt = ETT_NONE; if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) trace_buffer_unlock_commit_regs(file->tr, buffer, event, - trace_ctx, regs); + irq_flags, pc, regs); if (tt) event_triggers_post_call(file, tt); -- Gitblit v1.6.2