BPF List
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Changbin Du <changbin.du@huawei.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v2 0/3] Use BPF filters for a "perf top -u" workaround
Date: Fri, 24 May 2024 10:58:04 -0700	[thread overview]
Message-ID: <ZlDVLBQ84O7fN9K4@google.com> (raw)
In-Reply-To: <CAM9d7cibAi-Xnr5HTCT6HB0sat=w5qicDrr+pcMuUF0OfNQRPQ@mail.gmail.com>

On Wed, May 22, 2024 at 09:38:57PM -0700, Namhyung Kim wrote:
> On Mon, May 20, 2024 at 6:04 PM Ian Rogers <irogers@google.com> wrote:
> >
> > Allow uid and gid to be terms in BPF filters by first breaking the
> > connection between filter terms and PERF_SAMPLE_xx values. Calculate
> > the uid and gid using the bpf_get_current_uid_gid helper, rather than
> > from a value in the sample. Allow filters to be passed to perf top, this allows:
> >
> > $ perf top -e cycles:P --filter "uid == $(id -u)"
> >
> > to work as a "perf top -u" workaround, as "perf top -u" usually fails
> > due to processes/threads terminating between the /proc scan and the
> > perf_event_open.
> >
> > v2. Allow PERF_SAMPLE_xx to be computed from the PBF_TERM_xx value
> >     using a shift as requested by Namhyung.
> >
> > Ian Rogers (3):
> >   perf bpf filter: Give terms their own enum
> >   perf bpf filter: Add uid and gid terms
> >   perf top: Allow filters on events

Hmm.. I'm seeing this.

  $ make build-test
  ...
  cd . && make GEN_VMLINUX_H=1 FEATURES_DUMP=/home/namhyung/project/linux/tools/perf/BUILD_TEST_FEATURE_DUMP -j64 O=/tmp/tmp.EeXFOfLPt5 DESTDIR=/tmp/tmp.Y0eiZKvc9D
  ...
    CLANG   /tmp/tmp.EeXFOfLPt5/util/bpf_skel/.tmp/sample_filter.bpf.o            
  In file included from util/bpf_skel/sample_filter.bpf.c:8:                      
  In file included from util/bpf_skel/sample-filter.h:4:                          
  /home/namhyung/project/linux/tools/include/uapi/linux/perf_event.h:29:6: error: redefinition of 'perf_type_id'
  enum perf_type_id {                                                             
       ^                                                                          
  /tmp/tmp.EeXFOfLPt5/util/bpf_skel/.tmp/../vmlinux.h:54086:6: note: previous definition is here
  enum perf_type_id {                                                             
       ^                                                                          
  In file included from util/bpf_skel/sample_filter.bpf.c:8:                      
  In file included from util/bpf_skel/sample-filter.h:4:                          
  /home/namhyung/project/linux/tools/include/uapi/linux/perf_event.h:30:2: error: redefinition of enumerator 'PERF_TYPE_HARDWARE'
          PERF_TYPE_HARDWARE                      = 0,                            
          ^                                                                       
  /tmp/tmp.EeXFOfLPt5/util/bpf_skel/.tmp/../vmlinux.h:54087:2: note: previous definition is here
          PERF_TYPE_HARDWARE = 0,                                                 
          ^
  ...
  make[3]: *** [Makefile.perf:264: sub-make] Error 2                              
  make[2]: *** [Makefile:70: all] Error 2                                         
  make[1]: *** [tests/make:340: make_gen_vmlinux_h_O] Error 1                     
  make: *** [Makefile:103: build-test] Error 2

Thanks,
Namhyung


  reply	other threads:[~2024-05-24 17:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21  1:04 [PATCH v2 0/3] Use BPF filters for a "perf top -u" workaround Ian Rogers
2024-05-21  1:04 ` [PATCH v2 1/3] perf bpf filter: Give terms their own enum Ian Rogers
2024-05-21  1:04 ` [PATCH v2 2/3] perf bpf filter: Add uid and gid terms Ian Rogers
2024-05-21  1:04 ` [PATCH v2 3/3] perf top: Allow filters on events Ian Rogers
2024-05-23  4:38 ` [PATCH v2 0/3] Use BPF filters for a "perf top -u" workaround Namhyung Kim
2024-05-24 17:58   ` Namhyung Kim [this message]
2024-05-24 20:22     ` Ian Rogers

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=ZlDVLBQ84O7fN9K4@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=changbin.du@huawei.com \
    --cc=irogers@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox