Load latency sampling on Sandy Bridge
Hi,
I am trying to setup load latency sampling on a Sandy Bridge processor (Cpu familly 6, model 42, model name Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz) running a 3.13 linux kernel.
After deep investigations made of reading of the Intel SDM, examples provided by the pfm library and the source code of perf, I am still not able to get sample. I think for now that my problem is related to the precise_ip parameter of the perf_event_attr structure.
Any time I change this value from 0 to 1 or from 0 to 2 (2 is the value to enable PEBS isn't it ?) the perf_event_open system call failed with a "Not supported operation" error. Running perf mem record on this Sandy Bridge platform also result in the same error.
So my question is, which way should I follow to identify why I am not able to do load latency sampling on this hardware ?
Thanks for any advice,
----
Manu
Quoted 9 lines · Manuel Selva
I am trying to setup load latency sampling on a Sandy Bridge processor (Cpu familly 6, model 42, model name Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz) running a 3.13 linux kernel.
After deep investigations made of reading of the Intel SDM, examples provided by the pfm library and the source code of perf, I am still not able to get sample. I think for now that my problem is related to the
precise_ipparameter of theperf_event_attrstructure.
Quoted 4 lines
Any time I change this value from 0 to 1 or from 0 to 2 (2 is the value to enable PEBS isn't it ?) the
perf_event_opensystem call failed with a "Not supported operation" error. Running perf mem record on this Sandy Bridge platform also result in the same error.
Which event are you trying to use?
On my Ivybrige machine using 3.14 I am able to get latency values with
pe.config=0x1cd;
pe.config1=3;
pe.precise_ip=2;Vince
The same event as the one you mentionned (I also checked that it's the same event than the one used by perf mem record)
Setting precise-ip to 0 allows me to open the event and then mmap the result, but I don't have any sample.
Manu
Quoted 26 lines · Vince Weaver
Quoted 12 lines · Manuel Selva
I am trying to setup load latency sampling on a Sandy Bridge processor (Cpu familly 6, model 42, model name Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz) running a 3.13 linux kernel.
After deep investigations made of reading of the Intel SDM, examples provided by the pfm library and the source code of perf, I am still not able to get sample. I think for now that my problem is related to the
precise_ipparameter of theperf_event_attrstructure.Quoted 4 lines
Any time I change this value from 0 to 1 or from 0 to 2 (2 is the value to enable PEBS isn't it ?) the
perf_event_opensystem call failed with a "Not supported operation" error. Running perf mem record on this Sandy Bridge platform also result in the same error.Which event are you trying to use?
On my Ivybrige machine using 3.14 I am able to get latency values with
pe.config=0x1cd; pe.config1=3; pe.precise_ip=2;Vince
Quoted 2 lines · Manuel Selva
The same event as the one you mentionned (I also checked that it's the same event than the one used by perf mem record)
so perf mem record doesn't work for you either?
I checked on my sandybridge-ep machine running Linux 3.14 and latency measurement seems to be working fine there too.
Vince
Yes, perf mem doesn't work on my Sandy Bridge. I should be missing something, maybe a kernel parameter somewhere, or something like that, but I don't know where searching ...
Manu
Quoted 12 lines · Vince Weaver
Quoted 2 lines · Manuel Selva
The same event as the one you mentionned (I also checked that it's the same event than the one used by perf mem record)
so perf mem record doesn't work for you either?
I checked on my sandybridge-ep machine running Linux 3.14 and latency measurement seems to be working fine there too.
Vince
Quoted 3 lines · Manuel Selva
Yes, perf mem doesn't work on my Sandy Bridge. I should be missing something, maybe a kernel parameter somewhere, or something like that, but I don't know where searching ...
well if you're getting operation not supported you are probably running into this chunk of code in arch/x86/kernel/cpu/perf_event.c
int x86_pmu_hw_config(struct perf_event *event)
{
if (event->attr.precise_ip) {
int precise = 0;
/* Support for constant skid */
if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
precise++;
/* Support for IP fixup */
if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2)
precise++;
}
if (event->attr.precise_ip > precise)
return -EOPNOTSUPP;and if you look, pebs_broken can be enabled on Sandybridge CPUs due to firmware errata. Did you check your dmesg for messages starting with PEBS?
Vince
Yes the problem is there ! Thanks I am not enough "fluent" in kernel code to identify this. Here is my dmesg:
perf_event_intel: PEBS disabled due to CPU errata, please upgrade microcode
Does it mean that I must "upgrade my hardware" through the upgrade of microcode ? I never did such a thing.
Manu
Quoted 35 lines · Vince Weaver
Quoted 3 lines · Manuel Selva
Yes, perf mem doesn't work on my Sandy Bridge. I should be missing something, maybe a kernel parameter somewhere, or something like that, but I don't know where searching ...
well if you're getting operation not supported you are probably running into this chunk of code in
arch/x86/kernel/cpu/perf_event.cint
x86_pmu_hw_config(struct perf_event *event){ if (event->attr.precise_ip) { int precise = 0; /* Support for constant skid */ if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) { precise++; /* Support for IP fixup */ if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2) precise++; } if (event->attr.precise_ip > precise) return -EOPNOTSUPP;and if you look,
pebs_brokencan be enabled on Sandybridge CPUs due to firmware errata. Did you check your dmesg for messages starting with PEBS?Vince
Quoted 4 lines · Manuel Selva
perf_event_intel: PEBS disabled due to CPU errata, please upgrade microcodeDoes it mean that I must "upgrade my hardware" through the upgrade of microcode ? I never did such a thing.
Usually the microcode is updated at boot time. Usually your distribution will have some sort of microcode update package you can install that will do this for you automatically.
Vince
many thanks, it works !!!
On ubuntu: sudo apt-get install intel-microcode
-----
Manu
Quoted 18 lines · Vince Weaver
Quoted 4 lines · Manuel Selva
perf_event_intel: PEBS disabled due to CPU errata, please upgrade microcodeDoes it mean that I must "upgrade my hardware" through the upgrade of microcode ? I never did such a thing.
Usually the microcode is updated at boot time. Usually your distribution will have some sort of microcode update package you can install that will do this for you automatically.
Vince
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html