[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1273573722.30322.73.camel@minggr.sh.intel.com>
Date: Tue, 11 May 2010 18:28:42 +0800
From: Lin Ming <ming.m.lin@...el.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: Peter Zijlstra <peterz@...radead.org>,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
"eranian@...il.com" <eranian@...il.com>,
"Gary.Mohr@...l.com" <Gary.Mohr@...l.com>,
"arjan@...ux.intel.com" <arjan@...ux.intel.com>,
"Zhang, Yanmin" <yanmin_zhang@...ux.intel.com>,
Paul Mackerras <paulus@...ba.org>,
"David S. Miller" <davem@...emloft.net>,
Russell King <rmk+kernel@....linux.org.uk>,
Paul Mundt <lethal@...ux-sh.org>,
lkml <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Will Deacon <will.deacon@....com>,
Maynard Johnson <mpjohn@...ibm.com>,
Carl Love <carll@...ibm.com>
Subject: Re: [RFC][PATCH 3/9] perf: export registerred pmus via sysfs
On Tue, 2010-05-11 at 17:31 +0800, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@...radead.org> wrote:
>
> > On Tue, 2010-05-11 at 11:18 +0200, Ingo Molnar wrote:
> > > * Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > > > The new PMUs will use a dynamic range that starts at PERF_TYPE_MAX.
> > >
> > > I dont think we should use a dynamic range of event sources - it's a
> > > completely useless indirection that has no meaning to humans.
> > >
> > > As far as machine interfaces go a much cleaner approach would be to allow an
> > > open fd to a sysfs file to be passed to sys_perf_event_open() - this would
> > > identify the event source. This needs a small extension of the ABI but we
> > > could thus get rid of the 'type' enumeration altogether and express _all_
> > > event sources via fds to sysfs files.
> >
> > Whatever, that's almost identical. [...]
>
> It's not identical: as we dont expose our mapping structure externally and
> dont have to have some dynamic type ID allocation layer/mechanism. Also, using
> fds is an elegant, Linuxish way of expressing some object's identity and
> passing it along.
Don't understand this well enough.
Does it need to attach pmu info to the sys file?
For example,
Does "perf top -e cycles" work as below?
1. get the pmu file of cycles events,
ie, /sys/devices/system/cpu/cpu_hw_events/event_source_id
2. fd = open("/sys/devices/system/cpu/cpu_hw_events/event_source_id")
3. perf_event_attr::type = fd | (1<<31)
4. In kernel, perf_event_lookup_pmu() finds pmu by fd -> sys file -> pmu
>
> ( It also removes the possibility to intentionally or accidentally have type
> IDs that are not reachable via the sysfs and vica verse. )
>
> > [...] What we can do is reserve perf_event_attr::type with bit 31 set for
> > fd's and use the fd->file lookup instead of the type->pmu lookup.
>
> Yeah, that sounds good.
>
> Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists