public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] hw-breakpoints: Use struct perf_event_attr to define user breakpoints
Date: Tue, 1 Dec 2009 08:12:11 +0100	[thread overview]
Message-ID: <20091201071208.GC5063@nowhere> (raw)
In-Reply-To: <20091127180310.GA18408@in.ibm.com>

On Fri, Nov 27, 2009 at 11:33:10PM +0530, K.Prasad wrote:
> I suspect this further needs cleanup. Taking a quick look at all the
> exported interfaces:
> 
> struct perf_event *
> register_user_hw_breakpoint(struct perf_event_attr *attr,
>                             perf_callback_t triggered,
>                             struct task_struct *tsk);
> struct perf_event *
> modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr,
>                           perf_callback_t triggered,
>                           struct task_struct *tsk);
> 
> void unregister_hw_breakpoint(struct perf_event *bp);
> 
> struct perf_event **
> register_wide_hw_breakpoint(struct perf_event_attr *attr,
>                             perf_callback_t triggered);
> 
> void unregister_wide_hw_breakpoint(struct perf_event **cpu_events);
> 
> It could be further improved to make them more intuitive and
> symmetrical, for instance:
> 
> - Merge 'perf_callback_t triggered' with 'struct perf_event_attr' (it is
>   very much an attribute of the breakpoint) (you may also want to rename
>   'triggered' to something else...which is a pending suggestion from the
>   community - 'triggered' indicates a boolean datatype and not a
>   callback).


The perf attributes need to be a user and kernel interface (it is
a syscall parameter).
I don't we should expose what is supposed to be a kernel internal-only
address to such user interface, while it's not needed for the user.

But yeah I can rename trigger to "callback" simply.

Note: it's nice to have reviews and suggestions like you do, it makes
the things evolving, and I'll happily fix everything you reported (if
I agreed with the idea) but feel free to also send patches, it will
make it evolve faster :)

 
> - Make register_<> always return 'struct perf_event *' (just like how
>   unregister_<> always returns 'void').


That's a bit hard in the case of wide breakpoints as we are maintaining
a cpu array of breakpoints.


> - Both unregister_hw_breakpoint() and unregister_wide_hw_breakpoint()
>   can accept 'struct perf_event *' as parameters.


Same thing here.


> Would you also like to rename register_wide_hw_breakpoint() to
> register_kernel_hw_breakpoint() since a) It is used only for
> kernel-space requests b) If a per-cpu kernel-space counter is desired in
> future, register_wide_hw_breakpoint() name would shrink to
> register_hw_breakpoint() causing ambiguity (user or kernel?) and
> name-space collision.


Sure, I can rename it, unless you send a patch for that :)


      reply	other threads:[~2009-12-01  7:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  3:55 [PATCH 1/2] hw-breakpoints: Use struct perf_event_attr to define user breakpoints Frederic Weisbecker
2009-11-27  3:55 ` [PATCH 2/2] hw-breakpoints: Use struct perf_event_attr to define kernel breakpoints Frederic Weisbecker
2009-11-27  5:49   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-27  5:49 ` [tip:perf/core] hw-breakpoints: Use struct perf_event_attr to define user breakpoints tip-bot for Frederic Weisbecker
2009-11-27 18:03 ` [PATCH 1/2] " K.Prasad
2009-12-01  7:12   ` Frederic Weisbecker [this message]

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=20091201071208.GC5063@nowhere \
    --to=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.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