Re: [tip:perf/core] perf: Ignore non-sampling overflows

From: Robert Richter
Date: Fri Jul 01 2011 - 09:57:55 EST


On 01.07.11 09:36:56, Peter Zijlstra wrote:
> On Thu, 2011-06-30 at 14:47 +0200, Robert Richter wrote:
> >
> > It covers the case there the sampling period may be specified in the
> > raw config register (line 286). I know, this is not the preferred way,
> > but this way you can directly set the config value in perf without
> > bypassing some bits through event->attr. As IBS events are sampling
> > events I will change the code so that it writes back the specified
> > period to event->attr.sample_period/event->hw.sample_period. Something
> > like:
> >
> > if (event->hw.sample_period) {
> > ...
> > } else {
> > max_cnt = event->attr.config & map->cnt_mask;
> > event->attr.sample_period = max_cnt << 4;
> > event->hw.sample_period = event->attr.sample_period;
> > }
> >
> > This will then proper identify IBS samples as samling event.
>
> Ah, being a naught boy then ;-), yeah passing stuff through like that
> will confuse bits and the fixup you propose will indeed work around
> that.
>
> But why complicate things like this? You just add extra code to the init
> path since you need to support attr.sample_period input as well.

For people who only want to set the raw register value as in the spec
it is much easier, they don't need to know perf internals. 3 lines of
code for this are okay.

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/