[PATCH] tracing: Fix trace entry and trace common fields for preempt_lazy_count

Jiri Olsa
2020-02-21T15:35:52Z

When commit 65fd07df3588 added preempt_lazy_count into 'struct trace_entry'
it did not add 4 bytes padding. Also we need to update the common fields
for tracepoint, otherwise some tools (bpftrace) stop working due to missing
common fields.

Fixes: 65fd07df3588 ("x86: Support for lazy preemption")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
include/linux/trace_events.h | 2 ++
kernel/trace/trace_events.c | 3 +++
2 files changed, 5 insertions(+)

diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index f3b1ef07e4a5..51a3f5188923 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -65,6 +65,8 @@ struct trace_entry {
unsigned short migrate_disable;
unsigned short padding;
unsigned char preempt_lazy_count;
+ unsigned char padding1;
+ unsigned short padding2;
};

#define TRACE_EVENT_TYPE_MAX \
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index accaae59a762..1fe37b7aeaff 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -183,6 +183,9 @@ static int trace_define_common_fields(void)
__common_field(int, pid);
__common_field(unsigned short, migrate_disable);
__common_field(unsigned short, padding);
+ __common_field(unsigned char, preempt_lazy_count);
+ __common_field(unsigned char, padding1);
+ __common_field(unsigned short, padding2);

return ret;
}
--
2.24.1