Re: [PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v3

From: Andi Kleen
Date: Mon Jan 28 2013 - 20:00:18 EST


On Tue, Jan 29, 2013 at 01:30:19AM +0100, Stephane Eranian wrote:
> >> The counter is reinstated to its state before the critical section but
> >> the PMI cannot be
> >> cancelled and there is no state left behind to tell what to do with it.
> >
> > The PMI is effectively spurious, but we use it to set back. Don't know
> > what you mean with "cancel". It already happened of course.
> >
> But when you do this, it seems you making INT_CP events unusable
> for sampling, because you're resetting their value under the cover.
> So what happens when you sample, especially with a fixed period?

Sampling is forbidden for checkpointed events, the setup code
enforces that. It's unlikely to be useful anyways.

The main use case for checkpointing is perf stat -T and related
counting usages.

> >>
> >> > + if (event->attr.sample_period > 0 &&
> >> > + event->attr.sample_period < 0x7fffffff)
> >> > + return -EIO;
> >> > + }
> Explain the 0x7fffffff to me? Is that the max period set by default when you
> just count?

Originally I had just > 0, but then I found that perf stat from the
guest doesn't work anymore because it sets an very high overflow
to accumulate counters.

The 0x7fffffff is a somewhat arbitary threshold to detect this case.


-Andi
--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
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/