lkml.org 
[lkml]   [2010]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 3/7] perf, hw_breakpoint: Fix crash in hw_breakpoint creation
    On Thu, Oct 14, 2010 at 10:34:07PM +0200, Peter Zijlstra wrote:
    > hw_breakpoint creation needs to account stuff per-task to ensure there
    > is always sufficient hardware resources to back these things due to
    > ptrace.
    >
    > With the perf per pmu context changes the event initialization no
    > longer has access to the event context, for the simple reason that we
    > need to first find the pmu (result of initialization) before we can
    > find the context.
    >
    > This makes hw_breakpoints unhappy, because it can no longer do per
    > task accounting, cure this by frobbing a task pointer in the event::hw
    > bits for now...
    >
    > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    > Cc: Frederic Weisbecker <fweisbec@gmail.com>
    > ---
    > include/linux/perf_event.h | 7 +++++++
    > kernel/hw_breakpoint.c | 8 ++++----
    > kernel/perf_event.c | 21 ++++++++++++++++-----
    > 3 files changed, 27 insertions(+), 9 deletions(-)
    >
    > Index: linux-2.6/include/linux/perf_event.h
    > ===================================================================
    > --- linux-2.6.orig/include/linux/perf_event.h
    > +++ linux-2.6/include/linux/perf_event.h
    > @@ -536,6 +536,12 @@ struct hw_perf_event {
    > struct { /* breakpoint */
    > struct arch_hw_breakpoint info;
    > struct list_head bp_list;
    > + /*
    > + * Crufty hack to avoid the chicken and egg
    > + * problem hw_breakpoint has with context
    > + * creation and event initalization.
    > + */
    > + struct task_struct *bp_target;
    > };
    > #endif
    > };
    > @@ -693,6 +699,7 @@ struct swevent_hlist {
    >
    > #define PERF_ATTACH_CONTEXT 0x01
    > #define PERF_ATTACH_GROUP 0x02
    > +#define PERF_ATTACH_TASK 0x04



    Thanks, the patch looks good.

    I'm just not sure about the point of this flag...



    \
     
     \ /
      Last update: 2010-10-15 18:47    [W:4.227 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site