Re: [PATCH] perf x86: Change SandyBridge and IvyBrige instructions event to be precise

From: Andi Kleen
Date: Wed Feb 20 2013 - 15:56:07 EST

Jiri Olsa <jolsa@xxxxxxxxxx> writes:

> Changing the default 'instructions' HW event for SandyBridge and
> IvyBrige to use the available precise 'instructions' event.
> The precise event is defined in Intel SDM as:
> INST_RETIRED.ALL - Precise instruction retired event with HW to
> reduce effect of PEBS shadow in IP distribution
> for both SandyBridge and IvyBrige micro-archs. It allows to use
> precise modifier on 'instructions' event on SandyBridge and
> IvyBrige micro-archs which is not possible now.

Actually it's possible, you just have to use it explicitely.

This will break a lot of profiling setups that assume instructions
count on the fixed counter and use the 4/8 other counters.
Also it will give very bad results with perf stat, which
you don't want to run with pebs.

Even worse with your change the fixed instruction counter is not
accessible anymore. So pretty much all the standard setups
that collect it in addition to other events and fill all
the counters would break.

I don't think it should be done by default, but yes explicitely
it's quite useful.

My Haswell patchkit (in the "extended version") exposes
the precise event as "instructions-p" through sysfs.


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
Please read the FAQ at