Skip to contentSkip to conversation

perf: Fix missing raw data on tracepoint events

PATCH Applied James Clark 6 participants 6 messages Oct 12, 2022 – Oct 28, 2022 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Fix missing raw data on tracepoint events

Since commit 838d9bb62d13 ("perf: Use sample_flags for raw_data") raw data is not being output on tracepoints due to the PERF_SAMPLE_RAW field not being set. Fix this by setting it for tracepoint events.

This fixes the following test failure:

perf test "sched_switch" -vvv

35: Track with sched_switch
--- start ---
test child forked, pid 1828
...
Using CPUID 0x00000000410fd400
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
Missing sched_switch events
4613 events recorded
test child finished with -1
---- end ----
Track with sched_switch: FAILED!

Fixes 838d9bb62d13 ("perf: Use sample_flags for raw_data")
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>
---
 kernel/events/core.c | 1 +
 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
index b981b879bcd8..824c23830272 100644
@@ -9759,6 +9759,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
 
 	perf_sample_data_init(&data, 0, 0);
 	data.raw = &raw;
+	data.sample_flags |= PERF_SAMPLE_RAW;
 
 	perf_trace_buf_update(record, event_type);
 
Signature · 1 line
2.28.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 22 lines · James Clark

Since commit 838d9bb62d13 ("perf: Use sample_flags for raw_data") raw data is not being output on tracepoints due to the PERF_SAMPLE_RAW field not being set. Fix this by setting it for tracepoint events.

This fixes the following test failure:

perf test "sched_switch" -vvv

35: Track with sched_switch
--- start ---
test child forked, pid 1828
...
Using CPUID 0x00000000410fd400
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
Missing sched_switch events
4613 events recorded
test child finished with -1
---- end ----
Track with sched_switch: FAILED!

Quoted 3 lines
Fixes 838d9bb62d13 ("perf: Use sample_flags for raw_data")
Cc Peter Zijlstra (Intel) <[email protected]>

Ouch.. thanks for the fix.

Thanks,
Namhyung

Quoted 19 lines
---
 kernel/events/core.c | 1 +
 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -1
index b981b879bcd8..824c23830272 100644
@@ -9759,6 +9759,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
 
        perf_sample_data_init(&data, 0, 0);
        data.raw = &raw;
+       data.sample_flags |= PERF_SAMPLE_RAW;
 
        perf_trace_buf_update(record, event_type);
 
--

2.28.0

Tested-by on v1 1/1
#2 lore raw
In reply to James Clark
Quoted 3 lines · On Wed, 12 Oct 2022 15:38:57 +0100 James Clark <[email protected]> wrote:

Since commit 838d9bb62d13 ("perf: Use sample_flags for raw_data") raw data is not being output on tracepoints due to the PERF_SAMPLE_RAW field not being set. Fix this by setting it for tracepoint events.

I was also getting similar issue[1], and confirmed that this fixes it. Thank you for the fix! Also, thank you for pointing me to this patch, Namhyung!

Quoted 18 lines

This fixes the following test failure:

perf test "sched_switch" -vvv

35: Track with sched_switch
--- start ---
test child forked, pid 1828
...
Using CPUID 0x00000000410fd400
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
Missing sched_switch events
4613 events recorded
test child finished with -1
---- end ----
Track with sched_switch: FAILED!

Quoted 4 lines
Fixes 838d9bb62d13 ("perf: Use sample_flags for raw_data")
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>

[1] https://lore.kernel.org/bpf/[email protected]/

Thanks,
SJ

Quoted 18 lines
---
 kernel/events/core.c | 1 +
 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
index b981b879bcd8..824c23830272 100644
@@ -9759,6 +9759,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
 
 	perf_sample_data_init(&data, 0, 0);
 	data.raw = &raw;
+	data.sample_flags |= PERF_SAMPLE_RAW;
 
 	perf_trace_buf_update(record, event_type);
 
Signature · 1 line
2.28.0
Tested-by on v1 1/1
#3 lore raw
In reply to James Clark
Quoted 25 lines · James Clark

Since commit 838d9bb62d13 ("perf: Use sample_flags for raw_data") raw data is not being output on tracepoints due to the PERF_SAMPLE_RAW field not being set. Fix this by setting it for tracepoint events.

This fixes the following test failure:

perf test "sched_switch" -vvv

35: Track with sched_switch
--- start ---
test child forked, pid 1828
...
Using CPUID 0x00000000410fd400
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
Missing sched_switch events
4613 events recorded
test child finished with -1
---- end ----
Track with sched_switch: FAILED!

Quoted 4 lines
Fixes 838d9bb62d13 ("perf: Use sample_flags for raw_data")
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>

Hi James,

Thanks for the fix. I was getting similar issue with “perf trace” and it works with this fix.

Quoted 19 lines

---
kernel/events/core.c | 1 +

1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
index b981b879bcd8..824c23830272 100644
@@ -9759,6 +9759,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
 
 	perf_sample_data_init(&data, 0, 0);
 	data.raw = &raw;
+	data.sample_flags |= PERF_SAMPLE_RAW;
 
 	perf_trace_buf_update(record, event_type);
 
Signature · 1 line
2.28.0
maintainer
#4 lore raw
In reply to James Clark
Quoted 21 lines · James Clark

Since commit 838d9bb62d13 ("perf: Use sample_flags for raw_data") raw data is not being output on tracepoints due to the PERF_SAMPLE_RAW field not being set. Fix this by setting it for tracepoint events.

This fixes the following test failure:

perf test "sched_switch" -vvv

35: Track with sched_switch
--- start ---
test child forked, pid 1828
...
Using CPUID 0x00000000410fd400
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
Missing sched_switch events
4613 events recorded
test child finished with -1
---- end ----
Track with sched_switch: FAILED!

Quoted 4 lines
Fixes 838d9bb62d13 ("perf: Use sample_flags for raw_data")
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>

Thanks!

merge bot Applied
#5 lore raw
In reply to James Clark
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     4b66ff46f2e18b1d32e18c881799ef911606f3be
Gitweb:        https://git.kernel.org/tip/4b66ff46f2e18b1d32e18c881799ef911606f3be
Author:        James Clark <[email protected]>
AuthorDate:    Wed, 12 Oct 2022 15:38:57 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Thu, 27 Oct 2022 10:27:30 +02:00

perf: Fix missing raw data on tracepoint events

Since commit 838d9bb62d13 ("perf: Use sample_flags for raw_data") raw data is not being output on tracepoints due to the PERF_SAMPLE_RAW field not being set. Fix this by setting it for tracepoint events.

This fixes the following test failure:

perf test "sched_switch" -vvv

35: Track with sched_switch
--- start ---
test child forked, pid 1828
...
Using CPUID 0x00000000410fd400
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
sched_switch: cpu: 2 prev_tid -14687 next_tid 0
Missing sched_switch events
4613 events recorded
test child finished with -1
---- end ----
Track with sched_switch: FAILED!

---
 kernel/events/core.c | 1 +
 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
index 01933db..4ec3717 100644
@@ -9846,6 +9846,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
 
 	perf_sample_data_init(&data, 0, 0);
 	data.raw = &raw;
+	data.sample_flags |= PERF_SAMPLE_RAW;
 
 	perf_trace_buf_update(record, event_type);