lkml.org 
[lkml]   [2018]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 8/9] perf/breakpoint: Split breakpoint "check" and "commit"
On Mon, May 07, 2018 at 12:46:06AM +0000, Joel Fernandes wrote:
> On Sun, May 6, 2018 at 12:22 PM Frederic Weisbecker <frederic@kernel.org>
> wrote:
>
> > arch_validate_hwbkpt_settings() mixes up attribute check and commit into
> > a single code entity. Therefore the validation may return an error due to
> > incorrect atributes while still leaving halfway modified architecture
> > breakpoint struct.
>
> > Now that we have split its logic on all archs, we can remove this
> > misdesigned function and call directly the arch check and commit
> > functions instead. This allows us to later avoid commiting
> > a breakpoint to architecture when its slot couldn't be allocated.
>
> [...]
> > diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> > index 6e28d28..6896ceeb 100644
> > --- a/kernel/events/hw_breakpoint.c
> > +++ b/kernel/events/hw_breakpoint.c
> > @@ -402,11 +402,12 @@ int dbg_release_bp_slot(struct perf_event *bp)
>
> > static int validate_hw_breakpoint(struct perf_event *bp)
> > {
> > - int ret;
> > + int err;
>
> > - ret = arch_validate_hwbkpt_settings(bp);
> > - if (ret)
> > - return ret;
> > + err = hw_breakpoint_arch_check(bp, &bp->attr);
> > + if (err)
> > + return err;
> > + hw_breakpoint_arch_commit(bp);
>
> minor nit:
> To preserve bisectability, shouldn't this be the following in this and
> earlier patches?
>
> err = hw_breakpoint_arch_check(bp, &bp->attr);
> hw_breakpoint_arch_commit(bp);
> if (err)
> return err;
>
> And then in patch 9/9 you can fix it the right way?

I don't see how it was breaking bisectability.
Anyway I'm rewriting it entirely to use:

struct arch_hw_breakpoint hw;
int err;

err = hw_breakpoint_arch_parse(bp, attr, &hw);
if (err)
return err;

.....

bp->hw.info = hw;

Thanks.

\
 
 \ /
  Last update: 2018-05-15 15:54    [W:0.142 / U:5.956 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site