From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Ravi Bangoria <ravi.bangoria@amd.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
Stephane Eranian <eranian@google.com>,
Kim Phillips <kim.phillips@amd.com>
Subject: Re: [PATCH v3] perf evsel: Fix missing exclude_{host,guest} setting
Date: Sun, 07 Nov 2021 07:57:55 -0300 [thread overview]
Message-ID: <4F788351-0DB6-4A31-B1B5-7065BAE6C3F8@gmail.com> (raw)
In-Reply-To: <11a4cec1-8169-0891-b9c8-4d3a7b689d86@amd.com>
On November 7, 2021 7:25:45 AM GMT-03:00, Ravi Bangoria <ravi.bangoria@amd.com> wrote:
>
>
>On 07-Nov-21 12:54 AM, Arnaldo Carvalho de Melo wrote:
>> Em Fri, Nov 05, 2021 at 11:00:29AM -0700, Namhyung Kim escreveu:
>>> Hello,
>>>
>>> On Wed, Nov 3, 2021 at 12:22 AM Ravi Bangoria <ravi.bangoria@amd.com> wrote:
>>>>
>>>>> The current logic for the perf missing feature has a bug that it can
>>>>> wrongly clear some modifiers like G or H. Actually some PMUs don't
>>>>> support any filtering or exclusion while others do. But we check it
>>>>> as a global feature.
>>>>
>>>> (Sorry to pitch in bit late)
>>>>
>>>> AMD has one more problem on a similar line. On AMD, non-precise and
>>>> precise sampling are provided by core and IBS pmu respectively. Plus,
>>>> core pmu has filtering capability but IBS does not. Perf by default
>>>> sets precise_ip=3 and exclude_guest=1 and goes on decreasing precise_ip
>>>> with exclude_guest set until perf_event_open() succeeds. This is
>>>> causing perf to always fallback to core pmu (non-precise mode) even if
>>>> it's perfectly feasible to do precise sampling. Do you guys think this
>>>> problem should also be addressed while designing solution for Namhyung's
>>>> patch or solve it seperately like below patch:
>>>>
>>>> ---><---
>>>>
>>>> From 48808299679199c39ff737a30a7f387669314fd7 Mon Sep 17 00:00:00 2001
>>>> From: Ravi Bangoria <ravi.bangoria@amd.com>
>>>> Date: Tue, 2 Nov 2021 11:01:12 +0530
>>>> Subject: [PATCH] perf/amd/ibs: Don't set exclude_guest by default
>>>>
>>>> Perf tool sets exclude_guest by default while calling perf_event_open().
>>>> Because IBS does not have filtering capability, it always gets rejected
>>>> by IBS PMU driver and thus perf falls back to non-precise sampling. Fix
>>>> it by not setting exclude_guest by default on AMD.
>>>>
>>>> Before:
>>>> $ sudo ./perf record -C 0 -vvv true |& grep precise
>>>> precise_ip 3
>>>> decreasing precise_ip by one (2)
>>>> precise_ip 2
>>>> decreasing precise_ip by one (1)
>>>> precise_ip 1
>>>> decreasing precise_ip by one (0)
>>>>
>>>> After:
>>>> $ sudo ./perf record -C 0 -vvv true |& grep precise
>>>> precise_ip 3
>>>> decreasing precise_ip by one (2)
>>>> precise_ip 2
>>>>
>>>> Reported-by: Kim Phillips <kim.phillips@amd.com>
>>>> Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
>>>
>>> It'd be nice if it can cover explicit -e cycles:pp as well. Anyway,
>>
>> Ravi, please consider Namhyung's request, a patch on top as I'm adding
>> this already.
>
>For explicit :pp modifier, evsel->precise_max does not get set and thus perf
>does not try with different attr->precise_ip values while exclude_guest set.
>So no issue with explicit :pp:
>
> $ sudo ./perf record -C 0 -e cycles:pp -vvv |& grep "precise_ip\|exclude_guest"
> precise_ip 2
> exclude_guest 1
> precise_ip 2
> exclude_guest 1
> switching off exclude_guest, exclude_host
> precise_ip 2
> ^C
>
>Also, with :P modifier, evsel->precise_max gets set but exclude_guest does
>not and thus :P also works fine:
>
> $ sudo ./perf record -C 0 -e cycles:P -vvv |& grep "precise_ip\|exclude_guest"
> precise_ip 3
> decreasing precise_ip by one (2)
> precise_ip 2
> ^C
Perfect, I'll add this analysis to the cset log message.
- Arnaldo
>
>Thanks,
>Ravi
next prev parent reply other threads:[~2021-11-07 10:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 22:49 Namhyung Kim
2021-10-31 11:13 ` Jiri Olsa
2021-11-01 21:09 ` Arnaldo Carvalho de Melo
2021-11-02 23:08 ` Namhyung Kim
2021-11-02 14:10 ` Jiri Olsa
2021-11-02 23:21 ` Namhyung Kim
2021-11-03 7:24 ` Jiri Olsa
2021-11-03 7:44 ` Stephane Eranian
2021-11-03 11:32 ` Arnaldo Carvalho de Melo
2021-11-03 17:35 ` Stephane Eranian
2021-11-03 21:03 ` Arnaldo Carvalho de Melo
2021-11-03 22:29 ` Stephane Eranian
2021-11-04 17:40 ` Arnaldo Carvalho de Melo
2021-11-04 21:38 ` Namhyung Kim
2021-11-03 7:21 ` Ravi Bangoria
2021-11-05 18:00 ` Namhyung Kim
2021-11-06 19:24 ` Arnaldo Carvalho de Melo
2021-11-07 10:25 ` Ravi Bangoria
2021-11-07 10:57 ` Arnaldo Carvalho de Melo [this message]
2021-11-08 18:50 ` 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=4F788351-0DB6-4A31-B1B5-7065BAE6C3F8@gmail.com \
--to=arnaldo.melo@gmail.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kim.phillips@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®