From: Frederic Weisbecker <fweisbec@gmail.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Avi Kivity <avi@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>,
"a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>,
"acme@ghostprotocols.net" <acme@ghostprotocols.net>,
Jason Wessel <jason.wessel@windriver.com>
Subject: Re: [PATCH 1/3] perf: add context field to perf_event
Date: Mon, 4 Jul 2011 15:58:24 +0200 [thread overview]
Message-ID: <20110704135820.GD5551@somewhere> (raw)
In-Reply-To: <20110629162725.GH15521@e102144-lin.cambridge.arm.com>
On Wed, Jun 29, 2011 at 05:27:25PM +0100, Will Deacon wrote:
> Hi Frederic,
>
> Thanks for including me on CC.
>
> On Wed, Jun 29, 2011 at 05:08:45PM +0100, Frederic Weisbecker wrote:
> > On Wed, Jun 29, 2011 at 06:42:35PM +0300, Avi Kivity wrote:
> > > The perf_event overflow handler does not receive any caller-derived
> > > argument, so many callers need to resort to looking up the perf_event
> > > in their local data structure. This is ugly and doesn't scale if a
> > > single callback services many perf_events.
> > >
> > > Fix by adding a context parameter to perf_event_create_kernel_counter()
> > > (and derived hardware breakpoints APIs) and storing it in the perf_event.
> > > The field can be accessed from the callback as event->overflow_handler_context.
> > > All callers are updated.
> > >
> > > Signed-off-by: Avi Kivity <avi@redhat.com>
> >
> > I believe it can micro-optimize ptrace through register_user_hw_breakpoint() because
> > we could store the index of the breakpoint that way, instead of iterating through 4 slots.
> >
> > Perhaps it can help in arm too, adding Will in Cc.
>
> Yes, we could store the breakpoint index in there and it would save us
> walking over the breakpoints when one fires. Not sure this helps us for
> anything else though. My main gripe with the ptrace interface to
> hw_breakpoints is that we have to convert all the breakpoint information
> from ARM_BREAKPOINT_* to HW_BREAKPOINT_* and then convert it all back again
> in the hw_breakpoint code. Yuck!
Agreed, I don't like that either.
Would you like to improve that? We probably need to be able to pass some arch data
through the whole call of breakpoint creation, including perf_event_create_kernel_counter().
There can be a transition step where we can either take generic attr or arch datas, until
every archs are converted. So that you can handle the arm part and other arch developers
can relay.
Another thing I would like to do in the even longer term is to not use perf anymore
for ptrace breakpoints, because that involves a heavy dependency and few people are
happy with that. Instead we should just have a generic hook into the sched_switch()
and handle pure ptrace breakpoints there. The central breakpoint API would still be
there to reserve/schedule breakpoint resources between ptrace and perf.
But beeing able to create ptrace breakpoints without converting to generic perf attr
is a necessary first step in order to achieve this.
Thanks.
next prev parent reply other threads:[~2011-07-04 13:58 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-29 15:42 [PATCH 0/3] Preparatory perf patches for KVM PMU support Avi Kivity
2011-06-29 15:42 ` [PATCH 1/3] perf: add context field to perf_event Avi Kivity
2011-06-29 16:08 ` Frederic Weisbecker
2011-06-29 16:25 ` Avi Kivity
2011-06-29 16:27 ` Will Deacon
2011-07-04 13:58 ` Frederic Weisbecker [this message]
2011-07-04 14:10 ` Avi Kivity
2011-07-04 14:36 ` Frederic Weisbecker
2011-07-11 21:07 ` Will Deacon
2011-07-12 7:20 ` Avi Kivity
2011-07-12 8:38 ` Peter Zijlstra
2011-07-12 9:08 ` Avi Kivity
2011-07-12 9:14 ` Peter Zijlstra
2011-07-12 9:16 ` Avi Kivity
2011-07-12 9:18 ` Peter Zijlstra
2011-07-12 9:27 ` Avi Kivity
2011-07-12 9:31 ` Peter Zijlstra
2011-07-12 9:36 ` Avi Kivity
2011-07-12 9:42 ` Will Deacon
2011-07-12 9:41 ` Joerg Roedel
2011-07-12 9:44 ` Avi Kivity
2011-07-12 9:48 ` Joerg Roedel
2011-07-12 9:55 ` Avi Kivity
2011-07-12 10:03 ` Joerg Roedel
2011-07-12 10:07 ` Avi Kivity
2011-07-12 10:24 ` Joerg Roedel
2011-07-12 10:36 ` Avi Kivity
2011-07-21 15:32 ` Will Deacon
2011-07-21 15:36 ` Avi Kivity
2011-07-21 15:46 ` Will Deacon
2011-07-21 15:59 ` Avi Kivity
2011-07-21 16:37 ` Will Deacon
2011-07-05 14:30 ` Will Deacon
2011-07-05 14:34 ` Frederic Weisbecker
2011-07-01 15:24 ` [tip:perf/core] perf: Add " tip-bot for Avi Kivity
2011-06-29 15:42 ` [PATCH 2/3] x86, perf: add constraints for architectural PMU v1 Avi Kivity
2011-07-01 15:24 ` [tip:perf/core] x86, perf: Add constraints for architectural PMU tip-bot for Avi Kivity
2011-06-29 15:42 ` [PATCH 3/3] perf: export perf_event_refresh() to modules Avi Kivity
2011-07-01 15:25 ` [tip:perf/core] " tip-bot for Avi Kivity
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=20110704135820.GD5551@somewhere \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=avi@redhat.com \
--cc=jason.wessel@windriver.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=will.deacon@arm.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