From: Jiri Olsa <jolsa@redhat.com>
To: Kim Phillips <kim.phillips@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>,
ravi.bangoria@amd.com, ananth.narayan@amd.com, rrichter@amd.com,
linux-perf-users@vger.kernel.org, namhyung@kernel.org,
alexander.shishkin@linux.intel.com, mark.rutland@arm.com,
kajoljain <kjain@linux.ibm.com>,
acme@kernel.org
Subject: Re: [RFC PATCH] tools/perf/x86: Use alternative format for AMD raw events
Date: Sun, 28 Nov 2021 16:36:57 +0100 [thread overview]
Message-ID: <YaOiGUNl7V83baEL@krava> (raw)
In-Reply-To: <51cff547-4f13-bfa2-f977-75d51f0ce2ae@amd.com>
On Thu, Nov 18, 2021 at 10:51:45AM -0600, Kim Phillips wrote:
> On 11/18/21 1:28 AM, Sandipan Das wrote:
> >
> > On 11/16/2021 9:31 PM, Kim Phillips wrote:
> > > On 11/15/21 10:38 PM, kajoljain wrote:
> > > > On 11/15/21 3:28 PM, Sandipan Das wrote:
> > > > >
> > > > > On 11/14/2021 10:11 PM, Jiri Olsa wrote:
> > > > > > good question.. I see raw events as a way to put to config whatever
> > > > > > the user wants and IMO adding changes/quirks that silently changes
> > > > > > config could create confusion and angry users ;-)
> > > > > >
> > > >
> > > > I agree, making quirks in config will only going to confuse users as
> > > > It's against the encodings we had in
> > > > /sys/bus/event_source/devices/<pmu>/format/*
> > > >
> > > > > > I'd think that if user is composing/using raw events then using
> > > > > > directly r100001f8e is not such a big deal?
> > > > > >
> > > > >
> > > > > Sure. Some of the confusion may be due to the fact that the man pages
> > > > > for perf-{stat,record,top} state that raw events are "eventsel+umask".
> > > > > While that is technically true, it does not describe the encoding
> > > > > scheme (/sys/bus/event_source/devices/<pmu>/format/*)
> > > > >
> > > > > Would another option be to update the man pages with a reference to
> > > > > these sysfs files when describing raw events?
> > > > >
> > > > > Something like:
> > > > >
> > > > > diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
> > > > > index 2d7df8703cf2..5dfdfeba594b 100644
> > > > > --- a/tools/perf/Documentation/perf-record.txt
> > > > > +++ b/tools/perf/Documentation/perf-record.txt
> > > > > @@ -30,8 +30,10 @@ OPTIONS
> > > > >
> > > > > - a symbolic event name (use 'perf list' to list all events)
> > > > >
> > > > > - - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
> > > > > - hexadecimal event descriptor.
> > > > > + - a raw PMU event (eventsel+umask) in the form of rN..NN where N..NN
> > > > > + is a hexadecimal value representing the raw encoding with the layout
> > > > > + of the corresponding event control register as defined by entries in
> > > > > + /sys/bus/event_sources/devices/<pmu>/format/*
> > > >
> > > > Do we need to specify (eventsel+umask) in the raw event description? As
> > > > the format/fields totally depend on PMU and umask name convention is
> > > > specific to one arch.
> > > >
> > > > Can we just update it to:
> > > >
> > > > - a raw PMU event in the form of rNNN where NNN is a hexadecimal value
> > > > representing the raw encoding, with the layout of the corresponding
> > > > event control register as defined by entries in
> > > > /sys/bus/event_sources/devices/<pmu>/format/*
> > >
> > > The r notation is for the cpu pmu only.
> > >
> > > The triple-digit 'NNN' is what's most misleading for 12-bit
> > > event implementation users, such as AMD's core PMUs. It
> > > tells users 'see your processor's documentation's triple-
> > > hex-digit PMCx18e event? All you need to do is make that
> > > "-e r18e" on the perf stat/record command line.
> > >
> > > So all notions of what size of parameter 'r' takes, esp. 'NNN'
> > > should be removed IMO. Perhaps an AMD/12-bit-specific
> > > example can be provided.
> > >
> > > I had thought that the shorthand command line r spec alone
> > > could be modified to be smarter and more accommodating
> > > for conventional rUUEE users migrating to AMD/12-bit,
> > > which AFAICT is not what this patch does. I think it
> > > modifies even the cpu/config=0xNNNNN/ specification,
> > > which, granted, is bad.
> > >
> >
> > Sorry I didn't know that events could be programmed with "config=...".
> > Thanks for pointing that out. For basic '-e r...' usage, modifying
> > parse_events_add_numeric() and leaving parse_events_add_pmu() as is
> > should take care of it.
> >
> > I thought about using the same fixup for the pmu format i.e. cpu/r0xNNNNN/
> > but as you rightly mentioned, it breaks when using cpu/config=0xNNNNN/.
>
> I think we'd be breaking compatibility with changing -r,
> even if the two (0x100 and 0x200) event bits used for most
> three-digit AMD events are being masked.
>
> Shall we just add an AMD-specific real-world 0xE0000UUEE example
> to the {stat,record} documentation to clear the mud?
sorry for late answer, but that seems to me like good idea
jirka
prev parent reply other threads:[~2021-11-28 15:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 12:56 [RFC PATCH] tools/perf/x86: Use alternative format for AMD raw events Sandipan Das
2021-11-14 16:41 ` Jiri Olsa
2021-11-15 9:58 ` Sandipan Das
2021-11-16 4:38 ` kajoljain
2021-11-16 16:01 ` Kim Phillips
2021-11-17 14:13 ` kajoljain
2021-11-18 7:28 ` Sandipan Das
2021-11-18 16:51 ` Kim Phillips
2021-11-28 15:36 ` Jiri Olsa [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=YaOiGUNl7V83baEL@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=kim.phillips@amd.com \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=namhyung@kernel.org \
--cc=ravi.bangoria@amd.com \
--cc=rrichter@amd.com \
--cc=sandipan.das@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).