[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091201071208.GC5063@nowhere>
Date: Tue, 1 Dec 2009 08:12:11 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: "K.Prasad" <prasad@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] hw-breakpoints: Use struct perf_event_attr to
define user breakpoints
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 :)
--
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