lkml.org 
[lkml]   [2019]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] sample/hw_breakpoint: avoid sample hw_breakpoint recursion for arm/arm64
    On Mon, Sep 23, 2019 at 04:09:35PM +0800, wangxu wrote:
    > From: Wang Xu <wangxu72@huawei.com>
    >
    > For x86/ppc, hw_breakpoint is triggered after the instruction is
    > executed.
    >
    > For arm/arm64, which is triggered before the instruction executed.
    > Arm/arm64 skips the instruction by using single step. But it only
    > supports default overflow_handler.

    Where is the recusion.. ?

    > This patch provides a chance to avoid sample hw_breakpoint recursion
    > for arm/arm64 by adding 'struct perf_event_attr.bp_step'.

    This patch also lacks justification for why this needs to come with ABI
    changes. There is also a distinct lack of comments.

    > Signed-off-by: Wang Xu <wangxu72@huawei.com>
    > ---
    > include/linux/perf_event.h | 3 +++
    > include/uapi/linux/perf_event.h | 3 ++-
    > samples/hw_breakpoint/data_breakpoint.c | 1 +
    > 3 files changed, 6 insertions(+), 1 deletion(-)
    >
    > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
    > index 61448c1..f270eb7 100644
    > --- a/include/linux/perf_event.h
    > +++ b/include/linux/perf_event.h
    > @@ -1024,6 +1024,9 @@ extern int perf_event_output(struct perf_event *event,
    > return true;
    > if (unlikely(event->overflow_handler == perf_event_output_backward))
    > return true;
    > + /* avoid sample hw_breakpoint recursion */
    > + if (unlikely(event->attr.bp_step))
    > + return true;

    This is just _wrong_.. it says that every event with bp_step set always
    is a 'default overflow handler', irrespective of what the overflow
    handler actually is.

    > return false;
    > }
    >

    \
     
     \ /
      Last update: 2019-09-26 11:14    [W:5.885 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site