hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/kernel/trace/trace_events.c
....@@ -184,8 +184,6 @@
184184 __common_field(unsigned char, flags);
185185 __common_field(unsigned char, preempt_count);
186186 __common_field(int, pid);
187
- __common_field(unsigned char, migrate_disable);
188
- __common_field(unsigned char, preempt_lazy_count);
189187
190188 return ret;
191189 }
....@@ -261,19 +259,22 @@
261259 trace_event_ignore_this_pid(trace_file))
262260 return NULL;
263261
262
+ local_save_flags(fbuffer->flags);
263
+ fbuffer->pc = preempt_count();
264264 /*
265265 * If CONFIG_PREEMPTION is enabled, then the tracepoint itself disables
266266 * preemption (adding one to the preempt_count). Since we are
267267 * interested in the preempt_count at the time the tracepoint was
268268 * hit, we need to subtract one to offset the increment.
269269 */
270
- fbuffer->trace_ctx = tracing_gen_ctx_dec();
270
+ if (IS_ENABLED(CONFIG_PREEMPTION))
271
+ fbuffer->pc--;
271272 fbuffer->trace_file = trace_file;
272273
273274 fbuffer->event =
274275 trace_event_buffer_lock_reserve(&fbuffer->buffer, trace_file,
275276 event_call->event.type, len,
276
- fbuffer->trace_ctx);
277
+ fbuffer->flags, fbuffer->pc);
277278 if (!fbuffer->event)
278279 return NULL;
279280
....@@ -3698,11 +3699,12 @@
36983699 struct trace_buffer *buffer;
36993700 struct ring_buffer_event *event;
37003701 struct ftrace_entry *entry;
3701
- unsigned int trace_ctx;
3702
+ unsigned long flags;
37023703 long disabled;
37033704 int cpu;
3705
+ int pc;
37043706
3705
- trace_ctx = tracing_gen_ctx();
3707
+ pc = preempt_count();
37063708 preempt_disable_notrace();
37073709 cpu = raw_smp_processor_id();
37083710 disabled = atomic_inc_return(&per_cpu(ftrace_test_event_disable, cpu));
....@@ -3710,9 +3712,11 @@
37103712 if (disabled != 1)
37113713 goto out;
37123714
3715
+ local_save_flags(flags);
3716
+
37133717 event = trace_event_buffer_lock_reserve(&buffer, &event_trace_file,
37143718 TRACE_FN, sizeof(*entry),
3715
- trace_ctx);
3719
+ flags, pc);
37163720 if (!event)
37173721 goto out;
37183722 entry = ring_buffer_event_data(event);
....@@ -3720,7 +3724,7 @@
37203724 entry->parent_ip = parent_ip;
37213725
37223726 event_trigger_unlock_commit(&event_trace_file, buffer, event,
3723
- entry, trace_ctx);
3727
+ entry, flags, pc);
37243728 out:
37253729 atomic_dec(&per_cpu(ftrace_test_event_disable, cpu));
37263730 preempt_enable_notrace();