public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.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: Fri, 27 Nov 2009 23:33:10 +0530	[thread overview]
Message-ID: <20091127180310.GA18408@in.ibm.com> (raw)
In-Reply-To: <1259294154-5197-1-git-send-regression-fweisbec@gmail.com>

On Fri, Nov 27, 2009 at 04:55:53AM +0100, Frederic Weisbecker wrote:
> In-kernel user breakpoints are created using functions in which we pass
> breakpoint parameters as individual variables: address, length and
> type.
> 
> Although it fits well for x86, this just does not scale across
> archictectures that may support this api later as these may have
> more or different needs. Pass in a perf_event_attr structure
> instead because it is meant to evolve as much as possible into
> a generic hardware breakpoint parameter structure.
>

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).

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

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

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.

Thanks,
K.Prasad


  parent reply	other threads:[~2009-11-27 18:03 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 ` K.Prasad [this message]
2009-12-01  7:12   ` [PATCH 1/2] " Frederic Weisbecker

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=20091127180310.GA18408@in.ibm.com \
    --to=prasad@linux.vnet.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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