Skip to contentSkip to conversation

perf bpf filter: Fix a broken perf sample data naming in BPF

PATCH Applied Namhyung Kim 4 participants 4 messages May 25, 2023 – May 26, 2023

Subsystems (2)
lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf bpf filter: Fix a broken perf sample data naming in BPF

BPF CO-RE requires 3 underscores for the ignored suffix rule but it mistakenly used only 2. Let's fix it.

Fixes 3a8b8fc31748 ("perf bpf filter: Support pre-5.16 kernels where 'mem_hops' isn't in 'union perf_mem_data_src'")
---
 tools/perf/util/bpf_skel/sample_filter.bpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf_skel/sample_filter.bpf.c +2 -2
index cffe493af1ed..fb94f5280626 100644
@@ -25,7 +25,7 @@ struct perf_sample_data___new {
 } __attribute__((preserve_access_index));
 
 /* new kernel perf_mem_data_src definition */
-union perf_mem_data_src__new {
+union perf_mem_data_src___new {
 	__u64 val;
 	struct {
 		__u64   mem_op:5,	/* type of opcode */
@@ -108,7 +108,7 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx,
 		if (entry->part == 7)
 			return kctx->data->data_src.mem_blk;
 		if (entry->part == 8) {
-			union perf_mem_data_src__new *data = (void *)&kctx->data->data_src;
+			union perf_mem_data_src___new *data = (void *)&kctx->data->data_src;
 
 			if (bpf_core_field_exists(data->mem_hops))
 				return data->mem_hops;
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Namhyung Kim

BPF CO-RE requires 3 underscores for the ignored suffix rule but it mistakenly used only 2. Let's fix it.

Fixes 3a8b8fc31748 ("perf bpf filter: Support pre-5.16 kernels where 'mem_hops' isn't in 'union perf_mem_data_src'")
---
 tools/perf/util/bpf_skel/sample_filter.bpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Seems like that's the only remaining case. LGTM.

Quoted 26 lines
tools/perf/util/bpf_skel/sample_filter.bpf.c +2 -3
index cffe493af1ed..fb94f5280626 100644
@@ -25,7 +25,7 @@ struct perf_sample_data___new {
 } __attribute__((preserve_access_index));
 
 /* new kernel perf_mem_data_src definition */
-union perf_mem_data_src__new {
+union perf_mem_data_src___new {
        __u64 val;
        struct {
                __u64   mem_op:5,       /* type of opcode */
@@ -108,7 +108,7 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx,
                if (entry->part == 7)
                        return kctx->data->data_src.mem_blk;
                if (entry->part == 8) {
-                       union perf_mem_data_src__new *data = (void *)&kctx->data->data_src;
+                       union perf_mem_data_src___new *data = (void *)&kctx->data->data_src;
 
                        if (bpf_core_field_exists(data->mem_hops))
                                return data->mem_hops;
--

2.41.0.rc0.172.g3f132b7071-goog

Acked-by on v1 1/1
#2 lore raw
In reply to Namhyung Kim
Quoted 35 lines · Namhyung Kim

BPF CO-RE requires 3 underscores for the ignored suffix rule but it mistakenly used only 2. Let's fix it.

Fixes 3a8b8fc31748 ("perf bpf filter: Support pre-5.16 kernels where 'mem_hops' isn't in 'union perf_mem_data_src'")
---
 tools/perf/util/bpf_skel/sample_filter.bpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf_skel/sample_filter.bpf.c +2 -2
index cffe493af1ed..fb94f5280626 100644
@@ -25,7 +25,7 @@ struct perf_sample_data___new {
 } __attribute__((preserve_access_index));
 
 /* new kernel perf_mem_data_src definition */
-union perf_mem_data_src__new {
+union perf_mem_data_src___new {
 	__u64 val;
 	struct {
 		__u64   mem_op:5,	/* type of opcode */
@@ -108,7 +108,7 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx,
 		if (entry->part == 7)
 			return kctx->data->data_src.mem_blk;
 		if (entry->part == 8) {
-			union perf_mem_data_src__new *data = (void *)&kctx->data->data_src;
+			union perf_mem_data_src___new *data = (void *)&kctx->data->data_src;
 
 			if (bpf_core_field_exists(data->mem_hops))
 				return data->mem_hops;
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog
maintainer Applied
#3 lore raw

Em Thu, May 25, 2023 at 11:53:09PM -0700, John Fastabend escreveu:

Quoted 30 lines
Quoted 29 lines · Namhyung Kim

BPF CO-RE requires 3 underscores for the ignored suffix rule but it mistakenly used only 2. Let's fix it.

Fixes 3a8b8fc31748 ("perf bpf filter: Support pre-5.16 kernels where 'mem_hops' isn't in 'union perf_mem_data_src'")
---
 tools/perf/util/bpf_skel/sample_filter.bpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf_skel/sample_filter.bpf.c +2 -2
index cffe493af1ed..fb94f5280626 100644
@@ -25,7 +25,7 @@ struct perf_sample_data___new {
 } __attribute__((preserve_access_index));
 
 /* new kernel perf_mem_data_src definition */
-union perf_mem_data_src__new {
+union perf_mem_data_src___new {
 	__u64 val;
 	struct {
 		__u64   mem_op:5,	/* type of opcode */
@@ -108,7 +108,7 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx,
 		if (entry->part == 7)
 			return kctx->data->data_src.mem_blk;
 		if (entry->part == 8) {
-			union perf_mem_data_src__new *data = (void *)&kctx->data->data_src;
+			union perf_mem_data_src___new *data = (void *)&kctx->data->data_src;
 
Quoted 8 lines
Quoted 6 lines
tools/perf/util/bpf_skel/sample_filter.bpf.c +0 -0
 			if (bpf_core_field_exists(data->mem_hops))
 				return data->mem_hops;
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog

Thanks, applied.

- Arnaldo