netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h
@ 2020-10-14  4:36 Song Liu
  2020-10-14 16:01 ` Song Liu
  2020-10-15  4:29 ` Alexei Starovoitov
  0 siblings, 2 replies; 6+ messages in thread
From: Song Liu @ 2020-10-14  4:36 UTC (permalink / raw)
  To: netdev, bpf; +Cc: kernel-team, ast, daniel, john.fastabend, kpsingh, Song Liu

Fix the following error when compiling selftests/bpf

progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol

pids_cgrp_id is used in cgroup code, and included in vmlinux.h. Fix the
error by renaming pids_cgrp_id as pids_cgroup_id.

Fixes: 03d4d13fab3f ("selftests/bpf: Add profiler test")
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 tools/testing/selftests/bpf/progs/profiler.inc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
index 00578311a4233..b554c1e40b9fb 100644
--- a/tools/testing/selftests/bpf/progs/profiler.inc.h
+++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
@@ -243,7 +243,7 @@ static ino_t get_inode_from_kernfs(struct kernfs_node* node)
 	}
 }
 
-int pids_cgrp_id = 1;
+int pids_cgroup_id = 1;
 
 static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
 					 struct task_struct* task,
@@ -262,7 +262,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
 				BPF_CORE_READ(task, cgroups, subsys[i]);
 			if (subsys != NULL) {
 				int subsys_id = BPF_CORE_READ(subsys, ss, id);
-				if (subsys_id == pids_cgrp_id) {
+				if (subsys_id == pids_cgroup_id) {
 					proc_kernfs = BPF_CORE_READ(subsys, cgroup, kn);
 					root_kernfs = BPF_CORE_READ(subsys, ss, root, kf_root, kn);
 					break;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h
  2020-10-14  4:36 [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h Song Liu
@ 2020-10-14 16:01 ` Song Liu
  2020-10-15  4:24   ` John Fastabend
  2020-10-15  4:29 ` Alexei Starovoitov
  1 sibling, 1 reply; 6+ messages in thread
From: Song Liu @ 2020-10-14 16:01 UTC (permalink / raw)
  To: Network Development, bpf, Jiri Olsa, Jiri Olsa
  Cc: Kernel Team, ast, daniel, john.fastabend, kpsingh



> On Oct 13, 2020, at 9:36 PM, Song Liu <songliubraving@fb.com> wrote:
> 
> Fix the following error when compiling selftests/bpf
> 
> progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol
> 
> pids_cgrp_id is used in cgroup code, and included in vmlinux.h. Fix the
> error by renaming pids_cgrp_id as pids_cgroup_id.
> 
> Fixes: 03d4d13fab3f ("selftests/bpf: Add profiler test")
> Signed-off-by: Song Liu <songliubraving@fb.com>

I forgot to mention

Reported-by: Jiri Olsa <jolsa@kernel.org>

> ---
> tools/testing/selftests/bpf/progs/profiler.inc.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
> index 00578311a4233..b554c1e40b9fb 100644
> --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> @@ -243,7 +243,7 @@ static ino_t get_inode_from_kernfs(struct kernfs_node* node)
> 	}
> }
> 
> -int pids_cgrp_id = 1;
> +int pids_cgroup_id = 1;
> 
> static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> 					 struct task_struct* task,
> @@ -262,7 +262,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> 				BPF_CORE_READ(task, cgroups, subsys[i]);
> 			if (subsys != NULL) {
> 				int subsys_id = BPF_CORE_READ(subsys, ss, id);
> -				if (subsys_id == pids_cgrp_id) {
> +				if (subsys_id == pids_cgroup_id) {
> 					proc_kernfs = BPF_CORE_READ(subsys, cgroup, kn);
> 					root_kernfs = BPF_CORE_READ(subsys, ss, root, kf_root, kn);
> 					break;
> -- 
> 2.24.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h
  2020-10-14 16:01 ` Song Liu
@ 2020-10-15  4:24   ` John Fastabend
  0 siblings, 0 replies; 6+ messages in thread
From: John Fastabend @ 2020-10-15  4:24 UTC (permalink / raw)
  To: Song Liu, Network Development, bpf, Jiri Olsa, Jiri Olsa
  Cc: Kernel Team, ast, daniel, john.fastabend, kpsingh

Song Liu wrote:
> 
> 
> > On Oct 13, 2020, at 9:36 PM, Song Liu <songliubraving@fb.com> wrote:
> > 
> > Fix the following error when compiling selftests/bpf
> > 
> > progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol
> > 
> > pids_cgrp_id is used in cgroup code, and included in vmlinux.h. Fix the
> > error by renaming pids_cgrp_id as pids_cgroup_id.
> > 
> > Fixes: 03d4d13fab3f ("selftests/bpf: Add profiler test")
> > Signed-off-by: Song Liu <songliubraving@fb.com>
> 
> I forgot to mention
> 
> Reported-by: Jiri Olsa <jolsa@kernel.org>

Acked-by: John Fastabend <john.fastabend@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h
  2020-10-14  4:36 [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h Song Liu
  2020-10-14 16:01 ` Song Liu
@ 2020-10-15  4:29 ` Alexei Starovoitov
  2020-10-15  5:50   ` Song Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Alexei Starovoitov @ 2020-10-15  4:29 UTC (permalink / raw)
  To: Song Liu; +Cc: netdev, bpf, kernel-team, ast, daniel, john.fastabend, kpsingh

On Tue, Oct 13, 2020 at 09:36:38PM -0700, Song Liu wrote:
> Fix the following error when compiling selftests/bpf
> 
> progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol
> 
> pids_cgrp_id is used in cgroup code, and included in vmlinux.h. Fix the
> error by renaming pids_cgrp_id as pids_cgroup_id.
> 
> Fixes: 03d4d13fab3f ("selftests/bpf: Add profiler test")
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  tools/testing/selftests/bpf/progs/profiler.inc.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
> index 00578311a4233..b554c1e40b9fb 100644
> --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> @@ -243,7 +243,7 @@ static ino_t get_inode_from_kernfs(struct kernfs_node* node)
>  	}
>  }
>  
> -int pids_cgrp_id = 1;
> +int pids_cgroup_id = 1;

I would prefer to try one of three options that Andrii suggested.

>  static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
>  					 struct task_struct* task,
> @@ -262,7 +262,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
>  				BPF_CORE_READ(task, cgroups, subsys[i]);
>  			if (subsys != NULL) {
>  				int subsys_id = BPF_CORE_READ(subsys, ss, id);
> -				if (subsys_id == pids_cgrp_id) {
> +				if (subsys_id == pids_cgroup_id) {
>  					proc_kernfs = BPF_CORE_READ(subsys, cgroup, kn);
>  					root_kernfs = BPF_CORE_READ(subsys, ss, root, kf_root, kn);
>  					break;
> -- 
> 2.24.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h
  2020-10-15  4:29 ` Alexei Starovoitov
@ 2020-10-15  5:50   ` Song Liu
  2020-10-15 19:02     ` Daniel Borkmann
  0 siblings, 1 reply; 6+ messages in thread
From: Song Liu @ 2020-10-15  5:50 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Network Development, bpf, Kernel Team, Alexei Starovoitov,
	Daniel Borkmann, john.fastabend, kpsingh



> On Oct 14, 2020, at 9:29 PM, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> 
> On Tue, Oct 13, 2020 at 09:36:38PM -0700, Song Liu wrote:
>> Fix the following error when compiling selftests/bpf
>> 
>> progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol
>> 
>> pids_cgrp_id is used in cgroup code, and included in vmlinux.h. Fix the
>> error by renaming pids_cgrp_id as pids_cgroup_id.
>> 
>> Fixes: 03d4d13fab3f ("selftests/bpf: Add profiler test")
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> ---
>> tools/testing/selftests/bpf/progs/profiler.inc.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
>> index 00578311a4233..b554c1e40b9fb 100644
>> --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
>> +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
>> @@ -243,7 +243,7 @@ static ino_t get_inode_from_kernfs(struct kernfs_node* node)
>> 	}
>> }
>> 
>> -int pids_cgrp_id = 1;
>> +int pids_cgroup_id = 1;
> 
> I would prefer to try one of three options that Andrii suggested.

Ah, I missed that email (because of vger lag, I guess). Just verified 
Andrii's version works. 

Thanks,
Song

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h
  2020-10-15  5:50   ` Song Liu
@ 2020-10-15 19:02     ` Daniel Borkmann
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2020-10-15 19:02 UTC (permalink / raw)
  To: Song Liu, Alexei Starovoitov
  Cc: Network Development, bpf, Kernel Team, Alexei Starovoitov,
	john.fastabend, kpsingh

On 10/15/20 7:50 AM, Song Liu wrote:
>> On Oct 14, 2020, at 9:29 PM, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>> On Tue, Oct 13, 2020 at 09:36:38PM -0700, Song Liu wrote:
>>> Fix the following error when compiling selftests/bpf
>>>
>>> progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol
>>>
>>> pids_cgrp_id is used in cgroup code, and included in vmlinux.h. Fix the
>>> error by renaming pids_cgrp_id as pids_cgroup_id.
>>>
>>> Fixes: 03d4d13fab3f ("selftests/bpf: Add profiler test")
>>> Signed-off-by: Song Liu <songliubraving@fb.com>
>>> ---
>>> tools/testing/selftests/bpf/progs/profiler.inc.h | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
>>> index 00578311a4233..b554c1e40b9fb 100644
>>> --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
>>> +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
>>> @@ -243,7 +243,7 @@ static ino_t get_inode_from_kernfs(struct kernfs_node* node)
>>> 	}
>>> }
>>>
>>> -int pids_cgrp_id = 1;
>>> +int pids_cgroup_id = 1;
>>
>> I would prefer to try one of three options that Andrii suggested.
> 
> Ah, I missed that email (because of vger lag, I guess). Just verified
> Andrii's version works.

Pls either you or Andrii respin in that case.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-15 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  4:36 [PATCH bpf-next] selftests/bpf: fix compilation error in progs/profiler.inc.h Song Liu
2020-10-14 16:01 ` Song Liu
2020-10-15  4:24   ` John Fastabend
2020-10-15  4:29 ` Alexei Starovoitov
2020-10-15  5:50   ` Song Liu
2020-10-15 19:02     ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).