All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <robert.richter@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Stephane Eranian" <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	mingo@elte.hu, "David Ahern" <dsahern@gmail.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Jiri Olsa" <jolsa@redhat.com>
Subject: Re: [BUG] perf stat: useless output for raw events with new event parser
Date: Thu, 26 Apr 2012 19:36:57 +0200	[thread overview]
Message-ID: <20120426173657.GC18810@erda.amd.com> (raw)
In-Reply-To: <1335454772.13683.101.camel@twins>

On 26.04.12 17:39:32, Peter Zijlstra wrote:
> On Thu, 2012-04-26 at 16:45 +0200, Robert Richter wrote:
> > It is totally ok to have parser support for this. I simply do not see
> > why we need to put the encoding into sysfs. We somehow know on which
> > hardware we run and the parser should already know how to setup the
> > syscall. So parsing the above finally ends in calling of something
> > like:
> > 
> >  setup_event_for_some_pmu(event, 0x4e2, 0xf8);
> > 
> > We don't need any description of bit masks in sysfs for this. 
> 
> Its the kernel side decoding perf_event_attr, so it seems sensible to
> also describe this encoding from the kernel.

For perfctr we have:

 /sys/bus/event_source/devices/cpu/format/inv: config:23
 /sys/bus/event_source/devices/cpu/format/edge: config:18
 /sys/bus/event_source/devices/cpu/format/cmask: config:24-31
 /sys/bus/event_source/devices/cpu/format/event: config:0-7,32-35
 /sys/bus/event_source/devices/cpu/format/umask: config:8-15

The kernel does not en- or decode anything in the config value. It is
directly passed to the pmu with some validation of the values.
Everything else is in userland since it composes the syscall.

The kernel must now contain code like this:

 PMU_FORMAT_ATTR(event,  "config:0-7,32-35");
 PMU_FORMAT_ATTR(umask,  "config:8-15"   );
 PMU_FORMAT_ATTR(edge,   "config:18"     );
 PMU_FORMAT_ATTR(inv,    "config:23"     );
 PMU_FORMAT_ATTR(cmask,  "config:24-31"  );

Which is unrelated to anything else, duplicates the effort to maintain
bit masks and thus is more error-prone. Besides this there is no need
for it because the values are fix and do not change. We simply know
the format of the config value already, so the format entries are of
no use.

One could argue that feeding a generic pmu setup with the format
configuration reduces the need to modify userland, we have same code
for various archs. But if I have the choice I rather update my perf
tool chain than rebooting the kernel to update perf.

> Currently we mostly match the hardware encoding, but there's no strict
> requirement to do so, we can already see some of that with the extra_reg
> stuff, perf_event_attr::config1 can mean different things depending on
> the event.

Of course the config values of the syscall could be translated into a
different hardware configuration. But its layout is always spec'ed
somewhere and needs no description in sysfs.

> Keeping all this information in two places just seems like asking for it
> to get out of sync.

All this could reside in userland at one place too. Also, the syscall
definition is sufficient as interface description and both sides must
handle any differences of kernel or userland implementations.

-Robert

-- 
Advanced Micro Devices, Inc.
Operating System Research Center


  reply	other threads:[~2012-04-26 17:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 10:45 [BUG] perf stat: useless output for raw events with new event parser Stephane Eranian
2012-04-23 10:48 ` Peter Zijlstra
2012-04-23 10:55   ` Jiri Olsa
2012-04-23 10:56   ` Robert Richter
2012-04-23 11:17   ` Stephane Eranian
2012-04-26 10:27     ` Peter Zijlstra
2012-04-26 12:53       ` Stephane Eranian
2012-04-26 14:03         ` Peter Zijlstra
2012-04-26 13:12       ` Robert Richter
2012-04-26 14:24         ` Peter Zijlstra
2012-04-26 14:45           ` Robert Richter
2012-04-26 15:39             ` Peter Zijlstra
2012-04-26 17:36               ` Robert Richter [this message]
2012-05-07 12:42                 ` Peter Zijlstra
2012-05-07 16:58                   ` Robert Richter
2012-04-23 10:57 ` Jiri Olsa
2012-05-02 11:14 ` Stephane Eranian

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=20120426173657.GC18810@erda.amd.com \
    --to=robert.richter@amd.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.