On Tue, May 28, 2019 at 02:23:09PM -0400, Liang, Kan wrote: > > > RDPMC > > > ========= > > > The TopDown can be collected per thread/process. To use TopDown > > > through RDPMC in applications on Icelake, the metrics and slots values > > > have to be saved/restored during context switching. > > > > > > Add specific set_period() to specially handle the slots and metrics > > > event. Because, > > > - The initial value must be 0. > > > - Only need to restore the value in context switch. For other cases, > > > the counters have been cleared after read. > > > > So the above claims to explain RDPMC, but doesn't mention that magic > > value below at all. In fact, I don't see how the above relates to RDPMC > > at all. > > Current perf only support per-core Topdown RDPMC. On Icelake, it can be > extended to per-thread Topdown RDPMC. > It tries to explain the extra work for per-thread topdown RDPMC, e.g. > save/restore slots and metrics value in context switch.
Right, this has what relation to RDPMC ? > > > @@ -2141,7 +2157,9 @@ static int x86_pmu_event_idx(struct perf_event > > > *event) > > > if (!(event->hw.flags & PERF_X86_EVENT_RDPMC_ALLOWED)) > > > return 0; > > > - if (x86_pmu.num_counters_fixed && idx >= INTEL_PMC_IDX_FIXED) { > > > + if (is_metric_idx(idx)) > > > + idx = 1 << 29; > > > > I can't find this in the SDM RDPMC description. What does it return? > > It will return the value of PERF_METRICS. I will add it in the changelog. A comment would be even better.