I don't understand the /sys/devices tree much (I will read up on it),
but this idea looks good to me.
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.
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?
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
Maybe all of the "event" directories could be soft links to a common
radeon<model_number> event directory.
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?
- Corey
--