public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Kyle Moffett <kyle@moffetthome.net>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	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:30:47 +0100	[thread overview]
Message-ID: <1289993447.2109.717.camel@laptop> (raw)
In-Reply-To: <AANLkTikz6+_Ue53P1DmOyZD1+0SoMsX0NwdvqiT-5Ced@mail.gmail.com>

On Wed, 2010-11-17 at 02:02 -0500, Kyle Moffett wrote:
> 
> Not quite.  I'm still a relative newbie to bits and pieces of the
> device model, but I'll explain what I believe the best representation
> would be:
> 
> Assuming you have counters on graphics cards, you would already have
> the PCI device directories for the GPUs themselves.  For example:
> /sys/devices/[...]/0000:01:00.0/
> /sys/devices/[...]/0000:02:00.0/
> 
> Those already obviously have various DRM-related device directories
> under them, but I'll assume the PMU is tied directly to the PCI device
> (although it could be put elsewhere if appropriate).
> 
> So then I believe you would create your "PMU" devices with names
> "pmu0", "pmu1", etc, and set their "parent" to point to the PCI
> device, and set their "bus" to point to the "pmu" bus.
> 
> What would happen is you would get subdirectories for your "pmu" devices
> /sys/devices/[...]/0000:01:00.0/pmu0/
> /sys/devices/[...]/0000:02:00.0/pmu1/
> 
> Each of those devices would have a "driver" symlink inside pointing to
> something like:
> /sys/subsystem/pmu/drivers/radeonpmu
> 
> There would also be symlinks:
> /sys/subsystem/pmu/devices/pmu0 => ../../../../devices/[...]/0000:01:00.0/pmu0
> /sys/subsystem/pmu/devices/pmu1 => ../../../../devices/[...]/0000:02:00.0/pmu1
> 
> So that lets you find your various PMU devices.
> 
> Then you'd have another "bus", perhaps, for "pmuevents", where the
> "pmuevent" device nodes get useful names.  Please note that including
> the PMU name in the event name is necessary as you cannot have two
> devices on the same "bus" with the exact same name.
> /sys/devices/[...]/0000:01:00.0/pmu0/pmu0:gpu_idle/
> /sys/devices/[...]/0000:01:00.0/pmu0/pmu0:gpu_throttle/
> /sys/devices/[...]/0000:02:00.0/pmu1/pmu1:gpu_idle/
> /sys/devices/[...]/0000:02:00.0/pmu1/pmu1:gpu_throttle/
> 
> Each event directory would contain other directories full of various
> registered attributes of the event.
> 
> And again the directory full of symlinks (this is what requires the
> "different names" thing as mentioned above):
> /sys/subsystem/pmuevent/devices/pmu0:gpu_idle => [......]
> /sys/subsystem/pmuevent/devices/pmu0:gpu_throttle => [......]
> /sys/subsystem/pmuevent/devices/pmu1:gpu_idle => [......]
> /sys/subsystem/pmuevent/devices/pmu1:gpu_throttle => [......]
> 
> So if you wanted to enumerate all of the "gpu_idle" events on the
> system, you could just do:
> ls /sys/subsystem/pmuevent/devices/*:gpu_idle
> 
> And then by following the symlinks into /sys/devices and traversing
> the path upwards you can examine all of the other properties the same
> way that udev does. 

I've been talking to Kay for a bit and I've settled on one bus
"event_source", I register devices to that, and each device gets an
attribute_group "events" with events in.

Implementing that is painful enough, when I get it working I'll post it
as RFC and if someone with more sysfs skill than me is willing to help
out that's nice, but implementing something like Kyle says is waaaay
beyond me, sysfs is teh crazeh.

  reply	other threads:[~2010-11-17 11:31 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 [this message]
2010-11-17 11:25                 ` Peter Zijlstra
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=1289993447.2109.717.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=kyle@moffetthome.net \
    --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