Re: [PATCH 3/3] perf, x86: Add INST_RETIRED.ALL workarounds

From: Ingo Molnar
Date: Mon Mar 23 2015 - 05:39:06 EST



* Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:

> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> On Broadwell INST_RETIRED.ALL cannot be used with any period
> that doesn't have the lowest 6 bits cleared. And the period
> should not be smaller than 128.

Sloppy changelog: a most basic question is not answered by the
changelog: what happens in practice when the period is set to a
smaller value than 128?

> +/*
> + * Broadwell:
> + * The INST_RETIRED.ALL period always needs to have lowest
> + * 6bits cleared (BDM57). It shall not use a period smaller
> + * than 100 (BDM11). We combine the two to enforce
> + * a min-period of 128.
> + */

Sloppy comment: that's not what we do:

> +static unsigned bdw_limit_period(struct perf_event *event, unsigned left)
> +{
> + if ((event->hw.config & INTEL_ARCH_EVENT_MASK) ==
> + X86_CONFIG(.event=0xc0, .umask=0x01)) {
> + if (left < 128)
> + left = 128;
> + left &= ~0x3fu;
> + }
> + return left;

We enforce a minimum period of 128 and round the requested period to
64.

I think in this case it would be useful to tooling if we updated the
syscall attribute with the real period value that was used, to not
skew tooling output.

Thanks,

Ingo
--
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/