Right, so why then do you allow creating this thing asReset the counters (programming 0) don't trigger overflow.+ wrmsrl(MSR_PERF_METRICS, 0);I don't get this, overflow happens on when we flip sign, so why is
+ wrmsrl(MSR_CORE_PERF_FIXED_CTR3, 0);
programming 0 a sane thing to do?
is_sampling_event() ?
We have to reset both registers for each read to avoid the known'the known PERF_METRICS issue' is unknown to me and any other reader.
PERF_METRICS issue.
What happens if someone does: read(perf_fd) and then has the NMI hit?There should be no NMI for slots or metric events at the moment, because the+ metric = (cpuc->last_metric >> ((hwc->idx - INTEL_PMC_IDX_FIXED_METRIC_BASE)*8)) & 0xff;How is that cpuc->last_* crap not broken for NMIs ?
+ last = (((metric * 0xffff) >> 8) * cpuc->last_slots) >> 16;
MSR_PERF_METRICS and MSR_CORE_PERF_FIXED_CTR3 are reset in first read.
Other NMIs will not touch the codes here.