public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Stephane Eranian <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Lin Ming <ming.m.lin@intel.com>,
	"robert.richter" <robert.richter@amd.com>,
	fweisbec <fweisbec@gmail.com>, paulus <paulus@samba.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [RFC][PATCH] perf: sysfs type id
Date: Wed, 17 Nov 2010 12:25:28 +0100	[thread overview]
Message-ID: <1289993128.2109.714.camel@laptop> (raw)
In-Reply-To: <4CE33F86.7040403@linux.vnet.ibm.com>

On Tue, 2010-11-16 at 18:35 -0800, Corey Ashford wrote:

> I don't understand the /sys/devices tree much (I will read up on it), 
> but this idea looks good to me.

Yeah, me too.. I talked to Kay a bit earlier on and /sys/devices/system
is 'special'..

> To clarify my understanding a bit and taking the gfx example, in the 
> path /sys/class/pmu/radeon0, is the '0' here denoting the 0'th radeon 
> chip in the system, or the radeon model number?  I would assume the 0'th 
> chip.

Chip indeed.

> So if I assume that now points to a unique radeon chip in the system, 
> underneath /sys/class/pmu/radeon0 will be a structure something like:
> 
> radeon0/
> 	event/
> 		evt0
> 		..
> 		evtn
> 
> And if there is a second radeon chip, there would be a nearly identical 
> tree:
> 
> radeon1/
> 	event/
> 		evt0
> 		..
> 		evtn
> 
> Is that correct?

Yes.

> Some of these events may need modifiers / attributes / umasks... 
> whatever you want to call them.  And they may need more than one each, 
> and they may vary from event to event.  So to add to the hierarchy,
> we'd have:
> 
> radeon0/
>      type (for attr.type)
>      event/
>          evt0/
>              id (a base number for attr.config)
>              description (text file - but could be CONFIG_*'d out)
>              modifiers/
>                  mod0/
>                      formula (some ascii syntax for describing how
>                               to set .config and/or .config_extra
>                               with this modifer's value)
>                      description (text - can configure out)
>                      constraints (some ascii syntax for describing
>                                   the values mod0 can take on)
>                  ..
>                  modn/
>          ..
> 	evtn/
> 
> And this would be replicated for radeon1..n

The idea of the events dir is to provide a few frequently used/common
events, not to be an exhaustive list.

What we can do is provide a break-down of the config in the top-level
directory and refer people to the hardware documentation (they need to
read that anyway if they want to make use special events anyway).

> Maybe all of the "event" directories could be soft links to a common
> radeon<model_number> event directory.

Possibly, but I don't expect this to be a common thing, and we can
always do it later.

> When you fully specify an event, you have something like:
> 
> /sys/devices/pci0000:00/0000:00:1e.0/0000:0b:01.0/drm/card0/pmu/<event>[:<modifier>=nnn:...]
> 
> So it wouldn't end up being strictly a sysfs path anymore, and perf 
> would have a bit of parsing work to do, to evaluate the modifiers, using 
> the info from constraints, and construct the .type, .config, and 
> .config_extra fields using formula.
> 
> Or maybe you have some other structure in mind?

I wouldn't bother with modifiers and all that:
  perf record -e radeon0:r0123456789ABCDEF 

is there for people who know what they're doing, possibly we can parse
the config format and use some of that to enable things like:

[ using the x86-intel format because I actually know that, as opposed to
  the radeon case which I know absolutely nothing about. ]

# cat cpu/config_format  
event_selector:8
unit_mask:8
NULL:7
invert:1
counter_mask:8

perf record -e radeon0:event_selector=0xf;unit_mask=0x5;invert;counter_mask=1

To make it slightly easier, we could maybe event do something like:

perf record -e radeon0:instructions;invert;counter_mask=1

To take the base of the 'instructions' event and modify that with the
invert and counter_mask details.

A further attribute we can give the top level node is something like
'name', which would describe the actual PMU, ARM people want something
like that because its near impossible to figure out what PMU lives on
your chip from userspace.

# cat cpu/name
x86,Core2,PEBS

or somesuch.

  parent reply	other threads:[~2010-11-17 11:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 21:45 [RFC][PATCH] perf: sysfs type id Peter Zijlstra
2010-11-09 22:11 ` Kay Sievers
2010-11-09 22:22   ` Peter Zijlstra
2010-11-09 22:40     ` Kay Sievers
2010-11-09 22:13 ` Greg KH
2010-11-09 23:36   ` Michael Ellerman
     [not found]     ` <AANLkTi=UftgQn0ydRd2wszqFtpRrkEcW7dzfapKKix_V@mail.gmail.com>
     [not found]       ` <1289350360.22787.9.camel@concordia>
     [not found]         ` <AANLkTikGHNkUN6t9rPhdE6XOQiqb5xAzH_9eY6L9h2H2@mail.gmail.com>
2010-11-10  1:10           ` Michael Ellerman
2010-11-10  1:19             ` Kay Sievers
2010-11-10  1:45               ` Michael Ellerman
2010-11-10  1:59                 ` Kay Sievers
2010-11-10  3:37                   ` Michael Ellerman
2010-11-10  2:11                 ` Kay Sievers
2010-11-10 17:31     ` Greg KH
2010-11-10 12:27   ` Peter Zijlstra
2010-11-10 13:36     ` sysfs: Add an 'events' class. (was: Re: [RFC][PATCH] perf: sysfs type id) Ingo Molnar
2010-11-10 14:14       ` Kay Sievers
2010-11-10 15:00         ` Ingo Molnar
2010-11-11  6:39           ` Kay Sievers
2010-11-10 13:01 ` [RFC][PATCH] perf: sysfs type id Stephane Eranian
2010-11-10 14:10   ` Peter Zijlstra
2010-11-10 14:19     ` Peter Zijlstra
2010-11-10 20:08       ` Stephane Eranian
2010-11-10 20:32         ` Peter Zijlstra
2010-11-10 20:53           ` Stephane Eranian
2010-11-10 21:05             ` Peter Zijlstra
2010-11-17  2:35               ` Corey Ashford
2010-11-17  7:02                 ` Kyle Moffett
2010-11-17 11:30                   ` Peter Zijlstra
2010-11-17 11:25                 ` Peter Zijlstra [this message]
2010-11-17 19:47                   ` Corey Ashford
2010-11-17 19:57                     ` Peter Zijlstra
2010-11-17 20:01                       ` Peter Zijlstra
2010-11-17 21:39                         ` Corey Ashford
2010-11-10 14:24     ` 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=1289993128.2109.714.camel@laptop \
    --to=peterz@infradead.org \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=robert.richter@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