From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Sandipan Das <sandipan.das@amd.com>,
santosh.shukla@amd.com, ravi.bangoria@amd.com,
ananth.narayan@amd.com, kim.phillips@amd.com, rrichter@amd.com,
linux-perf-users@vger.kernel.org, kjain@linux.ibm.com
Subject: Re: [PATCH v3 1/2] perf/docs: Add info on AMD raw event encoding
Date: Tue, 30 Nov 2021 12:08:34 -0300 [thread overview]
Message-ID: <YaY+cvt8JyixHvz4@kernel.org> (raw)
In-Reply-To: <YaOweUHKRlMpTOTf@krava>
Em Sun, Nov 28, 2021 at 05:38:17PM +0100, Jiri Olsa escreveu:
> On Tue, Nov 23, 2021 at 02:16:12PM +0530, Sandipan Das wrote:
> > AMD processors have events with event select codes and unit
> > masks larger than a byte. The core PMU, for example, uses
> > 12-bit event select codes split between bits 0-7 and 32-35
> > of the PERF_CTL MSRs as can be seen from
> > /sys/bus/event_sources/devices/cpu/format/*.
> >
> > The Processor Programming Reference (PPR) lists the event
> > codes as unified 12-bit hexadecimal values instead and the
> > split between the bits is not apparent to someone who is
> > not aware of the layout of the PERF_CTL MSRs.
> >
> > 8-bit event select codes continue to work as the layout
> > matches that of the PERF_CTL MSRs i.e. bits 0-7 for event
> > select and 8-15 for unit mask.
> >
> > This adds more details in the perf man pages about using
> > /sys/bus/event_sources/devices/*/format/* for determining
> > the correct raw event encoding scheme.
> >
> > E.g. the "op_cache_hit_miss.op_cache_hit" event with code
> > 0x28f and umask 0x03 can be programmed using its symbolic
> > name as:
> >
> > $ sudo perf --debug perf-event-open stat -e op_cache_hit_miss.op_cache_hit sleep 1
> > ------------------------------------------------------------
> > perf_event_attr:
> > type 4
> > size 128
> > config 0x20000038f
> > sample_type IDENTIFIER
> > read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
> > disabled 1
> > inherit 1
> > enable_on_exec 1
> > exclude_guest 1
> > ------------------------------------------------------------
> > [...]
> >
> > One might use a simple eventsel+umask combination based on
> > what the current man pages say and incorrectly program the
> > event as:
> >
> > $ sudo perf --debug perf-event-open stat -e r0328f sleep 1
> > ------------------------------------------------------------
> > perf_event_attr:
> > type 4
> > size 128
> > config 0x328f
> > sample_type IDENTIFIER
> > read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
> > disabled 1
> > inherit 1
> > enable_on_exec 1
> > exclude_guest 1
> > ------------------------------------------------------------
> > [...]
> >
> > When it should have been based on the format from sysfs:
> >
> > $ cat /sys/bus/event_source/devices/cpu/format/event
> > config:0-7,32-35
> >
> > $ sudo perf --debug perf-event-open stat -e r20000038f sleep 1
> > ------------------------------------------------------------
> > perf_event_attr:
> > type 4
> > size 128
> > config 0x20000038f
> > sample_type IDENTIFIER
> > read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
> > disabled 1
> > inherit 1
> > enable_on_exec 1
> > exclude_guest 1
> > ------------------------------------------------------------
> > [...]
> >
> > Signed-off-by: Sandipan Das <sandipan.das@amd.com>
> > ---
> > v1: https://lore.kernel.org/linux-perf-users/20211119111234.170726-1-sandipan.das@amd.com/
> > v2: https://lore.kernel.org/linux-perf-users/20211123065104.236717-1-sandipan.das@amd.com/
> >
> > v3:
> > - Mention why simple eventsel+umask combinations will not
> > work in the commit message.
>
> for both patches:
>
> Acked-by: Jiri Olsa <jolsa@redhat.com>
Thanks, applied.
- Arnaldo
prev parent reply other threads:[~2021-11-30 15:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 8:46 [PATCH v3 1/2] perf/docs: Add info on AMD raw event encoding Sandipan Das
2021-11-23 8:46 ` [PATCH v3 2/2] perf/docs: Update link to AMD documentation Sandipan Das
2021-11-23 8:50 ` [PATCH v3 1/2] perf/docs: Add info on AMD raw event encoding kajoljain
2021-11-28 16:38 ` Jiri Olsa
2021-11-30 15:08 ` Arnaldo Carvalho de Melo [this message]
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=YaY+cvt8JyixHvz4@kernel.org \
--to=acme@kernel.org \
--cc=ananth.narayan@amd.com \
--cc=jolsa@redhat.com \
--cc=kim.phillips@amd.com \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=ravi.bangoria@amd.com \
--cc=rrichter@amd.com \
--cc=sandipan.das@amd.com \
--cc=santosh.shukla@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;
as well as URLs for NNTP newsgroup(s).