All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Song Liu <songliubraving@fb.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v2 bpf-next 3/4] selftests/bpf: Add profiler test
Date: Wed, 4 Nov 2020 17:45:53 +0100	[thread overview]
Message-ID: <20201104164215.GH3861143@krava> (raw)
In-Reply-To: <561A9F0C-BDAE-406A-8B93-011ECAB22B1C@fb.com>

On Thu, Oct 15, 2020 at 06:09:14AM +0000, Song Liu wrote:
> 
> 
> > On Oct 13, 2020, at 2:56 PM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> 
> [...]
> 
> > 
> > I'd go with Kconfig + bpf_core_enum_value(), as it's shorter and
> > nicer. This compiles and works with my Kconfig, but I haven't checked
> > with CONFIG_CGROUP_PIDS defined.
> 
> Tested with CONFIG_CGROUP_PIDS, it looks good. 
> 
> Tested-by: Song Liu <songliubraving@fb.com>

hi,
I still need to apply my workaround to compile tests,
so I wonder this fell through cracks

thanks,
jirka

> 
> > 
> > 
> > diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h
> > b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > index 00578311a423..79b8d2860a5c 100644
> > --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> > +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > @@ -243,7 +243,11 @@ static ino_t get_inode_from_kernfs(struct
> > kernfs_node* node)
> >        }
> > }
> > 
> > -int pids_cgrp_id = 1;
> > +extern bool CONFIG_CGROUP_PIDS __kconfig __weak;
> > +
> > +enum cgroup_subsys_id___local {
> > +       pids_cgrp_id___local = 1, /* anything but zero */
> > +};
> > 
> > static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> >                                         struct task_struct* task,
> > @@ -253,7 +257,9 @@ static INLINE void* populate_cgroup_info(struct
> > cgroup_data_t* cgroup_data,
> >                BPF_CORE_READ(task, nsproxy, cgroup_ns, root_cset,
> > dfl_cgrp, kn);
> >        struct kernfs_node* proc_kernfs = BPF_CORE_READ(task, cgroups,
> > dfl_cgrp, kn);
> > 
> > -       if (ENABLE_CGROUP_V1_RESOLVER) {
> > +       if (ENABLE_CGROUP_V1_RESOLVER && CONFIG_CGROUP_PIDS) {
> > +               int cgrp_id = bpf_core_enum_value(enum
> > cgroup_subsys_id___local, pids_cgrp_id___local);
> > +
> > #ifdef UNROLL
> > #pragma unroll
> > #endif
> > @@ -262,7 +268,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 == cgrp_id) {
> >                                        proc_kernfs =
> > BPF_CORE_READ(subsys, cgroup, kn);
> >                                        root_kernfs =
> > BPF_CORE_READ(subsys, ss, root, kf_root, kn);
> >                                        break;
> 


  reply	other threads:[~2020-11-04 16:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09  1:12 [PATCH v2 bpf-next 0/4] bpf: Make the verifier recognize llvm register allocation patterns Alexei Starovoitov
2020-10-09  1:12 ` [PATCH v2 bpf-next 1/4] bpf: Propagate scalar ranges through register assignments Alexei Starovoitov
2020-10-09 19:42   ` John Fastabend
2020-10-09  1:12 ` [PATCH v2 bpf-next 2/4] bpf: Track spill/fill of bounded scalars Alexei Starovoitov
2020-10-09 19:49   ` John Fastabend
2020-10-09  1:12 ` [PATCH v2 bpf-next 3/4] selftests/bpf: Add profiler test Alexei Starovoitov
2020-10-09  6:49   ` Yonghong Song
2020-10-09 15:08     ` Alexei Starovoitov
2020-10-09 15:13       ` Yonghong Song
2020-10-13 19:56   ` Jiri Olsa
2020-10-13 21:03     ` Alexei Starovoitov
2020-10-13 21:56       ` Andrii Nakryiko
2020-10-15  6:09         ` Song Liu
2020-11-04 16:45           ` Jiri Olsa [this message]
2020-11-04 20:50             ` Andrii Nakryiko
2020-11-04 21:57               ` Jiri Olsa
2020-10-13 21:59       ` Jiri Olsa
2020-10-14  0:21     ` Song Liu
2020-10-09  1:12 ` [PATCH v2 bpf-next 4/4] selftests/bpf: Asm tests for the verifier regalloc tracking Alexei Starovoitov
2020-10-09 20:06   ` John Fastabend
2020-10-09 20:10 ` [PATCH v2 bpf-next 0/4] bpf: Make the verifier recognize llvm register allocation patterns patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104164215.GH3861143@krava \
    --to=jolsa@redhat.com \
    --cc=Kernel-team@fb.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.