Messages in this thread | | | Date | Thu, 11 Mar 2021 13:30:16 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH V2 16/25] perf/x86: Register hybrid PMUs |
| |
On Thu, Mar 11, 2021 at 01:17:15PM +0100, Peter Zijlstra wrote: > On Wed, Mar 10, 2021 at 08:37:52AM -0800, kan.liang@linux.intel.com wrote: > > @@ -2092,9 +2105,37 @@ static int __init init_hw_perf_events(void) > > if (err) > > goto out1; > > > > - err = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); > > - if (err) > > - goto out2; > > + if (!is_hybrid()) { > > + err = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); > > + if (err) > > + goto out2; > > + } else { > > + u8 cpu_type = get_hybrid_cpu_type(smp_processor_id()); > > + struct x86_hybrid_pmu *hybrid_pmu; > > + int i; > > + > > + for (i = 0; i < x86_pmu.num_hybrid_pmus; i++) { > > + hybrid_pmu = &x86_pmu.hybrid_pmu[i]; > > I can't find where you actually allocated x86_pmu.hybrid_pmu.
Ah, patch 20 has that.
> > + hybrid_pmu->pmu = pmu; > > + hybrid_pmu->pmu.type = -1; > > + hybrid_pmu->pmu.attr_update = x86_pmu.attr_update; > > + hybrid_pmu->pmu.capabilities |= PERF_PMU_CAP_HETEROGENEOUS_CPUS; > > + > > + /* Only register the PMU for the boot CPU */ > > + if (hybrid_pmu->cpu_type != cpu_type) > > + continue; > > + > > + err = perf_pmu_register(&hybrid_pmu->pmu, hybrid_pmu->name, > > + x86_get_hybrid_pmu_type(cpu_type)); > > + if (err) { > > + pr_warn("Failed to register a PMU, err %d\n", err); > > + kfree(x86_pmu.hybrid_pmu); > > + x86_pmu.hybrid_pmu = NULL; > > + goto out2; > > + } > > + } > > + } > > > > return 0;
| |