[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131210163051.GI10633@localhost.localdomain>
Date: Tue, 10 Dec 2013 17:30:53 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: suravee.suthikulpanit@....com, mingo@...nel.org, mingo@...hat.com,
jacob.w.shin@...il.com, a.p.zijlstra@...llo.nl,
acme@...stprotocols.net, hpa@...or.com, tgl@...ain.invalid,
linux-kernel@...r.kernel.org, sherry.hurwitz@....com
Subject: Re: [PATCH 1/3] perf/x86/amd: AMD support for bp_len >
HW_BREAKPOINT_LEN_8
On Tue, Dec 10, 2013 at 05:19:45PM +0100, Oleg Nesterov wrote:
> On 12/10, Frederic Weisbecker wrote:
> >
> > On Wed, Oct 02, 2013 at 11:11:06AM -0500, suravee.suthikulpanit@....com wrote:
> > > @@ -279,7 +260,16 @@ static int arch_build_bp_info(struct perf_event *bp)
> > > }
> > >
> > > /* Len */
> > > + info->mask = 0;
> > > +
> > > switch (bp->attr.bp_len) {
> > > + default:
> > > + if (!is_power_of_2(bp->attr.bp_len))
> > > + return -EINVAL;
> > > + if (!cpu_has_bpext)
> > > + return -EOPNOTSUPP;
> > > + info->mask = bp->attr.bp_len - 1;
> > > + /* fall through */
> >
> > So, that's perhaps just personal preference but having the default on
> > top of the switch makes things very confusing. Can't we put the above
> > in the end of the switch instead?
>
> Then "fall through" won't work ;)
Indeed, now may be that's just me but it's very hard to parse :)
There are other ways to perform the above, it's no big deal if
we duplicate one line of code.
>
> > > @@ -314,11 +303,11 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
> > > if (ret)
> > > return ret;
> > >
> > > - ret = -EINVAL;
> > > -
> > > switch (info->len) {
> > > case X86_BREAKPOINT_LEN_1:
> > > align = 0;
> > > + if (info->mask)
> > > + align = info->mask;
> >
> > Confused, I thought mask is set only when length is above 8?
>
> Yes. But we need the info->len for hw anyway. if mask != 0 then
> len == X86_BREAKPOINT_LEN_1 and it is still used by encode_dr7().
> Note that it is not the length in bytes, it is the magic x86 code.
Good point, and that matches the above fallthrough.
Thanks.
>
> ->bp_len is the length.
>
> Oleg.
>
--
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