[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQLYSk0YgK7_dUSF-5Rau10vOdDgosVhE9xmEr1dp+=2vg@mail.gmail.com>
Date: Tue, 13 Oct 2020 14:03:33 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Jiri Olsa <jolsa@...hat.com>, Andrii Nakryiko <andrii@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v2 bpf-next 3/4] selftests/bpf: Add profiler test
On Tue, Oct 13, 2020 at 12:56 PM Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Thu, Oct 08, 2020 at 06:12:39PM -0700, Alexei Starovoitov wrote:
>
> SNIP
>
> > +
> > +#ifdef UNROLL
> > +#pragma unroll
> > +#endif
> > + for (int i = 0; i < MAX_CGROUPS_PATH_DEPTH; i++) {
> > + filepart_length =
> > + bpf_probe_read_str(payload, MAX_PATH, BPF_CORE_READ(cgroup_node, name));
> > + if (!cgroup_node)
> > + return payload;
> > + if (cgroup_node == cgroup_root_node)
> > + *root_pos = payload - payload_start;
> > + if (filepart_length <= MAX_PATH) {
> > + barrier_var(filepart_length);
> > + payload += filepart_length;
> > + }
> > + cgroup_node = BPF_CORE_READ(cgroup_node, parent);
> > + }
> > + return payload;
> > +}
> > +
> > +static ino_t get_inode_from_kernfs(struct kernfs_node* node)
> > +{
> > + struct kernfs_node___52* node52 = (void*)node;
> > +
> > + if (bpf_core_field_exists(node52->id.ino)) {
> > + barrier_var(node52);
> > + return BPF_CORE_READ(node52, id.ino);
> > + } else {
> > + barrier_var(node);
> > + return (u64)BPF_CORE_READ(node, id);
> > + }
> > +}
> > +
> > +int pids_cgrp_id = 1;
>
>
> hi,
> I'm getting compilation failure with this:
>
> CLNG-LLC [test_maps] profiler2.o
> In file included from progs/profiler2.c:6:
> progs/profiler.inc.h:246:5: error: redefinition of 'pids_cgrp_id' as different kind of symbol
> int pids_cgrp_id = 1;
> ^
> /home/jolsa/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:14531:2: note: previous definition is here
> pids_cgrp_id = 11,
Interesting.
You probably have CONFIG_CGROUP_PIDS in your .config?
I don't and bpf CI doesn't have it either, so this issue wasn't spotted earlier.
I can hard code 11, of course, but
but maybe Andrii has a cool way to use co-re to deal with this?
I think
"extern bool CONFIG_CGROUP_PIDS __kconfig"
won't work.
A good opportunity to try to use bpf_core_enum_value_exists() ?
Powered by blists - more mailing lists