On Tue, Jul 21, 2020 at 10:05:55AM -0400, Liang, Kan wrote: > On 7/21/2020 5:43 AM, Peter Zijlstra wrote: > > @@ -1098,37 +1105,20 @@ static int collect_events(struct cpu_hw_ > > cpuc->pebs_output = is_pebs_pt(leader) + 1; > > } > > - if (x86_pmu.intel_cap.perf_metrics && > > - add_nr_metric_event(cpuc, leader, &max_count, false)) > > + if (is_x86_event(leader) && collect_event(cpuc, leader, max_count, n)) > > return -EINVAL; > > + n++; > > If a leader is not an x86 event, n will be mistakenly increased. > But is it possible that a leader is not an x86 event here?
You're right, and yes that can happen, see the move_group=1 case in sys_perf_event_open(). if (is_x86_event(leader)) { if (collect_event(cpuc, leader, max_count, n)) return -EINVAL; n++; } it is then..