[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEoOVTVhN3DpQXl2@hirez.programming.kicks-ass.net>
Date: Thu, 11 Mar 2021 13:34:29 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: kan.liang@...ux.intel.com
Cc: mingo@...nel.org, linux-kernel@...r.kernel.org, acme@...nel.org,
tglx@...utronix.de, bp@...en8.de, namhyung@...nel.org,
jolsa@...hat.com, ak@...ux.intel.com, yao.jin@...ux.intel.com,
alexander.shishkin@...ux.intel.com, adrian.hunter@...el.com
Subject: Re: [PATCH V2 16/25] perf/x86: Register hybrid PMUs
On Wed, Mar 10, 2021 at 08:37:52AM -0800, kan.liang@...ux.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];
> +
> + 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 */
Why ?!
AFAICT we could register them all here. That instantly fixes that
CPU_STARTING / CPU_DEAD fail elsewhere in this patch.
> + 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;
>
Powered by blists - more mailing lists