linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Namhyung Kim <namhyung@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Kan Liang <kan.liang@linux.intel.com>, Song Liu <song@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Leo Yan <leo.yan@linaro.org>, James Clark <james.clark@arm.com>,
	Hao Luo <haoluo@google.com>, LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org, bpf@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [RFC/PATCHSET 0/9] perf record: Implement BPF sample filter (v4)
Date: Fri, 10 Mar 2023 12:10:28 +0530	[thread overview]
Message-ID: <9f692bd9-94e4-ee60-2174-561685b9b39a@amd.com> (raw)
In-Reply-To: <20230307233309.3546160-1-namhyung@kernel.org>

Hi Namhyung,

Sorry, I should have tried earlier prototypes but missed it.

> Maybe more useful example is when it deals with precise memory events.
> On AMD processors with IBS, you can filter only memory load with L1
> dTLB is missed like below.
> 
>   $ sudo ./perf record -ad -e ibs_op//p \
>   > --filter 'mem_op == load, mem_dtlb > l1_hit' sleep 1
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 1.338 MB perf.data (15 samples) ]

On my zen4 machine:

  $ sudo ./perf record -d -e ibs_op//p --filter 'mem_op == load' -c 100000 ~/test
  [ perf record: Woken up 6 times to write data ]
  [ perf record: Captured and wrote 1.436 MB perf.data (30966 samples) ]

  $ sudo ./perf mem report -F sample,mem --stdio
  #      Samples  Memory access
  # ............  ........................
           30325  L1 hit
             477  Local RAM hit
              89  L2 hit
              75  L3 hit

This looks good because IBS hw can't filter specific type of instruction
and thus unfiltered data will contain "NA" types of memory accesses, which
is absent here. So mem_op == load filter seems to be working.

However, if I add "mem_lvl == l1" (or l2 / ram) in the filter, I see mostly
all samples are getting lost:

  $ sudo ./perf record -d -e ibs_op//p --filter 'mem_op == load, mem_lvl == l1' -c 100000 ~/test
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.019 MB perf.data ]

  $ sudo ./perf report --stat | grep SAMPLE
    LOST_SAMPLES events:          1  ( 0.8%)
    LOST_SAMPLES events:     136332

What am I missing?

2nd observation, invalid expressions like 'mem_op == load, mem_dtlb == l1'
are not failing, instead recording misleading data:

  $ sudo ./perf record -d -e ibs_op//p --filter 'mem_op == load, mem_dtlb == l1' -c 100000 ~/test
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.047 MB perf.data (614 samples) ]

  $ sudo ./perf script -F data_src | grep "TLB N/A" | wc -l
  614

Thanks,
Ravi

  parent reply	other threads:[~2023-03-10  6:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 23:33 [RFC/PATCHSET 0/9] perf record: Implement BPF sample filter (v4) Namhyung Kim
2023-03-07 23:33 ` [PATCH 1/9] perf bpf filter: Introduce basic BPF filter expression Namhyung Kim
2023-03-07 23:33 ` [PATCH 2/9] perf bpf filter: Implement event sample filtering Namhyung Kim
2023-03-07 23:33 ` [PATCH 3/9] perf record: Add BPF event filter support Namhyung Kim
2023-03-07 23:33 ` [PATCH 4/9] perf record: Record dropped sample count Namhyung Kim
2023-03-14 21:42   ` Arnaldo Carvalho de Melo
2023-03-14 22:18     ` Namhyung Kim
2023-03-07 23:33 ` [PATCH 5/9] perf bpf filter: Add 'pid' sample data support Namhyung Kim
2023-03-07 23:33 ` [PATCH 6/9] perf bpf filter: Add more weight " Namhyung Kim
2023-03-07 23:33 ` [PATCH 7/9] perf bpf filter: Add data_src " Namhyung Kim
2023-03-07 23:33 ` [PATCH 8/9] perf bpf filter: Add logical OR operator Namhyung Kim
2023-03-07 23:33 ` [PATCH 9/9] perf bpf filter: Show warning for missing sample flags Namhyung Kim
2023-03-10  6:40 ` Ravi Bangoria [this message]
2023-03-10 21:52   ` [RFC/PATCHSET 0/9] perf record: Implement BPF sample filter (v4) Namhyung Kim
2023-03-13 15:51     ` Ravi Bangoria
2023-03-10  9:58 ` Ravi Bangoria
2023-03-10 15:04   ` Arnaldo Carvalho de Melo
2023-03-10 21:53     ` Namhyung Kim
2023-03-14 11:39     ` Arnaldo Carvalho de Melo
2023-03-14 15:27       ` Ravi Bangoria
2023-03-14 17:57         ` 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=9f692bd9-94e4-ee60-2174-561685b9b39a@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=eranian@google.com \
    --cc=haoluo@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@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;
as well as URLs for NNTP newsgroup(s).