From: Lin Ming <ming.m.lin@intel.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: "greg@kroah.com" <greg@kroah.com>,
Peter Zijlstra <peterz@infradead.org>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
"eranian@gmail.com" <eranian@gmail.com>,
"Gary.Mohr@Bull.com" <Gary.Mohr@bull.com>,
"arjan@linux.intel.com" <arjan@linux.intel.com>,
"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
Paul Mackerras <paulus@samba.org>,
"David S. Miller" <davem@davemloft.net>,
Russell King <rmk+kernel@arm.linux.org.uk>,
Paul Mundt <lethal@linux-sh.org>,
lkml <linux-kernel@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Will Deacon <will.deacon@arm.com>,
Maynard Johnson <mpjohn@us.ibm.com>, Carl Love <carll@us.ibm.com>
Subject: Re: [RFC][PATCH 3/9] perf: export registerred pmus via sysfs
Date: Thu, 13 May 2010 17:22:57 +0800 [thread overview]
Message-ID: <1273742577.30322.120.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <20100513083818.GA21924@elte.hu>
On Thu, 2010-05-13 at 16:38 +0800, Ingo Molnar wrote:
> * Lin Ming <ming.m.lin@intel.com> wrote:
>
> > On Tue, 2010-05-11 at 17:18 +0800, Ingo Molnar wrote:
> > > * Peter Zijlstra <peterz@infradead.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.
> >
> > I still don't understand this sys_fd -> pmu lookup, would you please
> > explain it more detail?
> >
> > struct pmu {
> > kobject kobj;
> > ...
> > };
> >
> > What I can imagine is,
> >
> > 1. In userspace, sys_fd =
> > open("/sys/devices/system/cpu/event_source", ..), then sys_fd is passed
> > to sys_perf_event_open()
>
> Yes, open() an event_source - or rather an event itself. For raw events there
> has to be a separate event entry that can be opened.
>
> I.e. we'd have a layout like:
>
> /sys/devices/system/cpu/events/cycles/id
> /sys/devices/system/cpu/events/instructions/id
> /sys/devices/system/cpu/events/raw/id
>
> By making each event category a directory we gain the flexibility of
> integrating tracepoints as well, for example:
>
> /sys/kernel/sched/events/wakeup/id
> /sys/kernel/sched/events/wakeup/format
>
> Where 'format' describes the event record layout:
>
> # cat /debug/tracing/events/sched/sched_wakeup/format
> name: sched_wakeup
> ID: 59
> format:
> field:unsigned short common_type; offset:0; size:2; signed:0;
> field:unsigned char common_flags; offset:2; size:1; signed:0;
> field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
> field:int common_pid; offset:4; size:4; signed:1;
> field:int common_lock_depth; offset:8; size:4; signed:1;
>
> field:char comm[TASK_COMM_LEN]; offset:12; size:16; signed:1;
> field:pid_t pid; offset:28; size:4; signed:1;
> field:int prio; offset:32; size:4; signed:1;
> field:int success; offset:36; size:4; signed:1;
> field:int target_cpu; offset:40; size:4; signed:1;
>
> print fmt: "comm=%s pid=%d prio=%d success=%d target_cpu=%03d", REC->comm, REC->pid, REC->prio, REC->success, REC->target_cpu
>
> > 2. In kernel, sys_file = <find the sys file structure with sys_fd>
> >
> > 3. kobject = <retrieve the kobject from sys_file>
> >
> > 4. pmu = container_of(kobject, struct pmu, kobj)
> >
> > If my understanding is correct, then step 3 above seems strange. It's
> > not the typical usage of sys file.
>
> I dont think it's stange - we demux from the generic sysfs object to the more
> specific perf events related object. This is similar how driver specific sysfs
> functionality does the demux as well.
OK, thanks for the explanation.
next prev parent reply other threads:[~2010-05-13 9:23 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-10 9:27 Lin Ming
2010-05-10 9:40 ` Peter Zijlstra
2010-05-10 10:11 ` Lin Ming
2010-05-10 10:18 ` Peter Zijlstra
2010-05-10 10:26 ` Lin Ming
2010-05-10 10:35 ` Paul Mundt
2010-05-10 10:58 ` Lin Ming
2010-05-10 11:04 ` Peter Zijlstra
2010-05-10 11:11 ` Lin Ming
2010-05-10 11:18 ` Lin Ming
2010-05-10 11:27 ` Peter Zijlstra
2010-05-10 11:36 ` Peter Zijlstra
2010-05-10 11:48 ` Ingo Molnar
2010-05-10 11:39 ` Russell King
2010-05-10 11:42 ` Peter Zijlstra
2010-05-10 20:25 ` Will Deacon
2010-05-11 6:34 ` Peter Zijlstra
2010-05-10 11:43 ` Ingo Molnar
2010-05-10 11:49 ` Peter Zijlstra
2010-05-10 11:53 ` Ingo Molnar
2010-05-10 23:13 ` Corey Ashford
2010-05-11 6:46 ` Peter Zijlstra
2010-05-11 7:21 ` Ingo Molnar
2010-05-11 8:20 ` Lin Ming
2010-05-11 8:50 ` Peter Zijlstra
2010-05-11 9:03 ` Lin Ming
2010-05-11 9:05 ` Lin Ming
2010-05-11 9:12 ` Peter Zijlstra
2010-05-11 9:18 ` Ingo Molnar
2010-05-11 9:24 ` Peter Zijlstra
2010-05-11 9:31 ` Ingo Molnar
2010-05-11 10:28 ` Lin Ming
2010-05-13 8:28 ` Lin Ming
2010-05-13 8:38 ` Ingo Molnar
2010-05-13 9:22 ` Lin Ming [this message]
2010-05-11 9:40 ` Lin Ming
2010-05-11 9:48 ` Peter Zijlstra
2010-05-11 9:53 ` Lin Ming
2010-05-11 15:17 ` Greg KH
2010-05-12 5:51 ` Paul Mundt
2010-05-12 8:37 ` Peter Zijlstra
2010-05-14 7:04 ` Paul Mundt
2010-05-11 10:09 ` stephane eranian
2010-05-11 14:15 ` Borislav Petkov
2010-05-11 14:25 ` Peter Zijlstra
2010-05-11 15:37 ` Borislav Petkov
2010-05-11 15:46 ` Peter Zijlstra
2010-05-10 23:54 ` Corey Ashford
2010-05-11 6:50 ` Peter Zijlstra
2010-05-11 2:43 ` Lin Ming
2010-05-11 6:35 ` Peter Zijlstra
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=1273742577.30322.120.camel@minggr.sh.intel.com \
--to=ming.m.lin@intel.com \
--cc=Gary.Mohr@bull.com \
--cc=acme@redhat.com \
--cc=arjan@linux.intel.com \
--cc=carll@us.ibm.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=fweisbec@gmail.com \
--cc=greg@kroah.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mpjohn@us.ibm.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=will.deacon@arm.com \
--cc=yanmin_zhang@linux.intel.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
all inboxes | Powered by JetHome®