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>,
Li Zefan <lizf@cn.fujitsu.com>,
Alan Stern <stern@rowland.harvard.edu>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Jan Kiszka <jan.kiszka@web.de>, Jiri Slaby <jirislaby@gmail.com>,
Avi Kivity <avi@redhat.com>, Paul Mackerras <paulus@samba.org>,
Mike Galbraith <efault@gmx.de>,
Masami Hiramatsu <mhiramat@redhat.com>,
Paul Mundt <lethal@linux-sh.org>,
Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [GIT PULL v6] hw-breakpoints: Rewrite on top of perf events v6
Date: Thu, 26 Nov 2009 06:59:05 +0100 [thread overview]
Message-ID: <20091126055903.GB5649@nowhere> (raw)
In-Reply-To: <20091124132127.GA5355@in.ibm.com>
On Tue, Nov 24, 2009 at 06:51:27PM +0530, K.Prasad wrote:
> On Tue, Nov 24, 2009 at 11:13:42AM +0100, Ingo Molnar wrote:
> >
> > * K.Prasad <prasad@linux.vnet.ibm.com> wrote:
> >
> > >
> > > Hi Frederic, Ingo,
> > > Here are a few concerns (roughly in decreasing order of
> > > priority) about the perf-events integrated hw-breakpoint feature.
> > >
> > > - Freeze the breakpoint interfaces: Owing to the many
> > > current/potential users of hw-breakpoint feature it is important to
> > > provide a stable interface to the end-user. Changes underneath the
> > > interface can be done in due course in a manner that does not affect
> > > the end-user's behaviour or function signature. The present breakpoint
> > > interface requires parameters that are best embedded in a structure
> > > for extensibility.
> >
> > Well we have PERF_TYPE_BREAKPOINT right now. I agree that it should be
> > finalized in some sort of extensible ABI real soon - we dont want (and
> > dont need to) add all features that might be possible in the future.
> >
>
> It is not about implementing futuristic features, but provide an
> interface which we know isn't going to change in the near future and
> will be flexible to accommodate arch-specific requirements. For
> instance the register_wide_hw_breakpoint() has an interface as below:
>
> struct perf_event **
> register_wide_hw_breakpoint(unsigned long addr,
> int len,
> int type,
> perf_callback_t triggered,
> bool active)
>
> Given the diversity seen in debug registers across processors, it isn't
> prudent to demand/limit the parameters required to those seen above.
> It can be made a part of one of perf-events' structures (with some fields
> in arch-specific structures) and the ABI can accept a pointer to one
> such structure.
>
> In this way it would be easy to bring-in arch-specific quirks without
> altering the interface's signature.
Sure, I plan to convert all these parameters into a single one:
perf_event_attr.
> > > - Proposed migration of register allocation logic to arch-specific
> > > files from kernel/hw_breakpoint.c. This is best done early to help
> > > easy porting of code to other architectures (we have an active
> > > interest in bringing support for PPC64 and S390). If done later, it
> > > will entail additional effort in porting for each architecture.
> >
> > I think the general direction should be towards librarized common
> > frameworks.
> >
> > If an architecture wants to do something special it should either extend
> > the core code, or, if it's too weird to be added to the core, override
> > it via its own implementation.
> >
>
> Given the feeling that the generic set of constraints in the re-written
> kernel/hw_breakpoint.c cannot accommodate the needs of various
> processors (LKML ref:20091117013959.GG5293@nowher) and that
> the register allocation logic should move to arch-specific code, it is
> best done early to help easy porting for other archs. For instance
> there's already a port to PPC64 against the layered hw-breakpoint
> (found here: 20090903183930.GA4590@in.ibm.com) and one from the
> community for SH (20091018062558.GA20535@linux-sh.org).
>
> If such code migration is done while porting of a new architecture, then
> it involves making changes to every other arch on which it is previously
> implemented (or workaround using #ifdef).
As I said, we can probably workaround it by keeping the most part
in the generic code and delegate special arch things to arch
constraints.
> > > - Fix ptrace bugs that potentially alter the semantics of ptrace.
> >
> > Is there a specific list of these bugs?
> >
>
> As pointed out in 20091111130207.GA5676@in.ibm.com and
> 20091112042502.GA3145@in.ibm.com, ptrace requests can a) lose register
> slots when modifying the breakpoint addresses and b) new implementation
> assumes that every DR7 write to be preceded by a write on DR0-DR3 which
> need not be true.
The a) case is going to be fixed.
But the b) situation must be reported as a user mistake (which is what is
done currently): -EINVAL, -EIO or whatever. Enabling a breakpoint without
having given an address is a userland bug.
> > > - Bring either true system_wide support or atleast workaround the
> > > side-effects of iterative per-cpu registration using single atomic
> > > enablement of all per-cpu breakpoints. This can avoid stray exceptions
> > > which would get delivered to the end-user even for failed breakpoint
> > > requests.
> >
> > That can certainly be done when users of such facilities emerge. Right
> > now we have perf and ptrace as the two users - are they affected by
> > these problems?
> >
>
> ksym_tracer - the ftrace plugin (kernel/trace/trace_ksym.c) using
> hw-breakpoints will be affected. Spurious exceptions due to partially
> registered breakpoint requests can be dangerous here.
Will be fixed too.
next prev parent reply other threads:[~2009-11-26 5:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-08 15:28 [GIT PULL v6] hw-breakpoints: Rewrite on top of perf events v6 Frederic Weisbecker
2009-11-08 15:28 ` [PATCH 1/7 v6] perf/core: Provide a kernel-internal interface to get to performance counters Frederic Weisbecker
2009-11-08 15:28 ` [PATCH 2/7 v6] x86/hw-breakpoints: Actually flush thread breakpoints in flush_thread() Frederic Weisbecker
2009-11-08 15:28 ` [PATCH 3/7 v6] perf/core: Add a callback to perf events Frederic Weisbecker
2009-11-17 11:28 ` Peter Zijlstra
2009-11-18 0:18 ` Frederic Weisbecker
2009-11-18 9:31 ` Peter Zijlstra
2009-11-19 15:43 ` Frederic Weisbecker
2009-11-19 22:40 ` Peter Zijlstra
2009-11-08 15:28 ` [PATCH 4/7 v6] hw-breakpoint: Move asm-generic/hw_breakpoint.h to linux/hw_breakpoint.h Frederic Weisbecker
2009-11-08 15:28 ` [PATCH 5/7 v6] hw-breakpoints: Rewrite the hw-breakpoints layer on top of perf events Frederic Weisbecker
2009-11-08 17:24 ` Jan Kiszka
2009-11-12 14:32 ` Frederic Weisbecker
2009-11-11 13:02 ` K.Prasad
2009-11-12 4:25 ` K.Prasad
2009-11-17 1:36 ` Frederic Weisbecker
2009-11-17 1:31 ` Frederic Weisbecker
2009-11-17 11:30 ` Peter Zijlstra
2009-11-18 0:19 ` Frederic Weisbecker
2009-11-08 15:29 ` [PATCH 6/7 v6] hw-breakpoints: Arbitrate access to pmu following registers constraints Frederic Weisbecker
2009-11-08 15:29 ` [PATCH 7/7 v6] ksym_tracer: Remove KSYM_SELFTEST_ENTRY Frederic Weisbecker
2009-11-08 17:03 ` [GIT PULL v6] hw-breakpoints: Rewrite on top of perf events v6 Ingo Molnar
2009-11-24 9:44 ` K.Prasad
2009-11-24 10:13 ` Ingo Molnar
2009-11-24 13:21 ` K.Prasad
2009-11-26 5:59 ` Frederic Weisbecker [this message]
2009-11-27 19:07 ` K.Prasad
2009-12-01 6:43 ` Frederic Weisbecker
2009-11-26 5:47 ` Frederic Weisbecker
2009-11-26 9:01 ` Ingo Molnar
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=20091126055903.GB5649@nowhere \
--to=fweisbec@gmail.com \
--cc=acme@redhat.com \
--cc=arjan@linux.intel.com \
--cc=avi@redhat.com \
--cc=efault@gmx.de \
--cc=jan.kiszka@web.de \
--cc=jirislaby@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=prasad@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=stern@rowland.harvard.edu \
/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