public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org, KP Singh <kpsingh@kernel.org>,
	Song Liu <song@kernel.org>,
	bpf@vger.kernel.org, Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH v3 1/8] perf bpf-filter: Make filters map a single entry hashmap
Date: Wed, 24 Jul 2024 13:20:27 -0700	[thread overview]
Message-ID: <ZqFiC4z_EZtsB4Su@google.com> (raw)
In-Reply-To: <ZqFWwGTvzzLPhtxs@x1>

On Wed, Jul 24, 2024 at 04:32:16PM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Jul 03, 2024 at 03:30:28PM -0700, Namhyung Kim wrote:
> > And the value is now an array.  This is to support multiple filter
> > entries in the map later.
> > 
> > No functional changes intended.
> 
> Hey how can we test this feature these days?

There's a 'perf record sample filtering (by BPF) tests'.

  $ ./perf test -vv filtering
   95: perf record sample filtering (by BPF) tests:
  --- start ---
  test child forked, pid 1042594
  Checking BPF-filter privilege
  try 'sudo perf record --setup-filter pin' first.
  bpf-filter test [Skipped permission]
  ---- end(-2) ----
   95: perf record sample filtering (by BPF) tests                     : Skip

> 
> With this first patch applied:
> 
> root@number:~# perf record -a -W -e cycles:p --filter 'period > 100 || weight > 0' sleep 1
> Error: cpu_atom/cycles/p event does not have PERF_SAMPLE_WEIGHT
>  Hint: please add -W option to perf record
> failed to set filter "BPF" on event cpu_atom/cycles/p with 95 (Operation not supported)
> root@number:~# perf record -a -W -e cpu_core/cycles/p --filter 'period > 100 || weight > 0' sleep 1
> Error: cpu_core/cycles/p event does not have PERF_SAMPLE_WEIGHT
>  Hint: please add -W option to perf record
> failed to set filter "BPF" on event cpu_core/cycles/p with 95 (Operation not supported)
> root@number:~# perf record -a -W -e cpu_atom/cycles/p --filter 'period > 100 || weight > 0' sleep 1
> Error: cpu_atom/cycles/p event does not have PERF_SAMPLE_WEIGHT
>  Hint: please add -W option to perf record
> failed to set filter "BPF" on event cpu_atom/cycles/p with 95 (Operation not supported)
> root@number:~#

Do you say it's failing after the first patch?  It looks like the atom
CPU doesn't support PERF_SAMPLE_WEIGHT and should fail already.

The above test doesn't check the weight field FYI.

> 
> Interesting, it is taking a long time on the BPF prog load:
> 
> bpf(BPF_MAP_UPDATE_ELEM, {map_fd=49, key=0x7ffcc85a545c, value=0x7fee34bc2000, flags=BPF_ANY}, 32) = 0
> bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_PERF_EVENT, insn_cnt=335, insns=0xd1e6480, license="Dual BSD/GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(6, 9, 9), prog_flags=0, prog_name="perf_sample_fil", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=50, func_info_rec_size=8, func_info=0xd1b9c80, func_info_cnt=1, line_info_rec_size=16, line_info=0xd1e5300, line_info_cnt=135, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 148^Cstrace: Process 2110180 detached
>  <detached ...>
> 
> <HERE it takes an unusual time, even returning after I cancelled the strace session>
> 
> root@number:~# 
> root@number:~# Error: cpu_atom/cycles/p event does not have PERF_SAMPLE_WEIGHT
>  Hint: please add -W option to perf record
> failed to set filter "BPF" on event cpu_atom/cycles/p with 11 (Resource temporarily unavailable)
> 
> root@number:~#
> 
> 
> root@number:~# uname -a
> Linux number 6.9.9-100.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 11 19:26:10 UTC 2024 x86_64 GNU/Linux
> root@number:~#
> 
> root@number:~# perf -v
> perf version 6.10.g5510fb5c79e9
> root@number:~# 
> 
> ⬢[acme@toolbox perf-tools-next]$ git log --oneline -10
> 5510fb5c79e9f500 (HEAD -> perf-tools-next) perf annotate: Set instruction name to be used with insn-stat when using raw instruction
> b35a86e53eb496ea perf annotate: Add support to use libcapstone in powerpc
> f2dc60d11290d53e perf annotate: Use capstone_init and remove open_capstone_handle from disasm.c
> c5bcba602eeee554 perf annotate: Make capstone_init non-static so that it can be used during symbol disassemble
> eef369c562510092 perf annotate: Update instruction tracking for powerpc
> 282701f1d77a3bdb perf annotate: Add more instructions for instruction tracking
> 758ee468ce5721e4 perf annotate: Add some of the arithmetic instructions to support instruction tracking in powerpc
> e8e7c1b6a9572bab perf annotate: Add support to identify memory instructions of opcode 31 in powerpc
> 3b3a0f04c1c6cd10 perf annotate: Add parse function for memory instructions in powerpc
> a159d2acd44e707f perf annotate: Update parameters for reg extract functions to use raw instruction on powerpc
> ⬢[acme@toolbox perf-tools-next]$ 
> 
> Ideas?

I don't know.. is it changed with this patch?

Thanks,
Namhyung

  reply	other threads:[~2024-07-24 20:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 22:30 [PATCHSET v3 0/8] perf record: Use a pinned BPF program for filter Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 1/8] perf bpf-filter: Make filters map a single entry hashmap Namhyung Kim
2024-07-24 18:55   ` Arnaldo Carvalho de Melo
2024-07-24 20:14     ` Namhyung Kim
2024-07-24 19:32   ` Arnaldo Carvalho de Melo
2024-07-24 20:20     ` Namhyung Kim [this message]
2024-07-24 21:39       ` Arnaldo Carvalho de Melo
2024-07-26  1:41         ` Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 2/8] perf bpf-filter: Pass 'target' to perf_bpf_filter__prepare() Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 3/8] perf bpf-filter: Split per-task filter use case Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 4/8] perf bpf-filter: Support pin/unpin BPF object Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 5/8] perf bpf-filter: Support separate lost counts for each filter Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 6/8] perf record: Fix a potential error handling issue Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 7/8] perf record: Add --setup-filter option Namhyung Kim
2024-07-03 22:30 ` [PATCH v3 8/8] perf test: Update sample filtering test Namhyung Kim
2024-07-31 14:10   ` Arnaldo Carvalho de Melo
2024-08-01  0:12     ` Namhyung Kim
2024-08-01 15:05       ` Arnaldo Carvalho de Melo
2024-08-01 22:22         ` Namhyung Kim
2024-08-02 17:43           ` Namhyung Kim
2024-07-23 23:48 ` [PATCHSET v3 0/8] perf record: Use a pinned BPF program for filter Namhyung Kim

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=ZqFiC4z_EZtsB4Su@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=song@kernel.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