Re: [PATCH V2 16/25] perf/x86: Register hybrid PMUs

From: Peter Zijlstra
Date: Thu Mar 11 2021 - 07:20:25 EST


On Wed, Mar 10, 2021 at 08:37:52AM -0800, kan.liang@xxxxxxxxxxxxxxx wrote:
> @@ -4420,6 +4513,27 @@ void intel_cpuc_finish(struct cpu_hw_events *cpuc)
> static void intel_pmu_cpu_dead(int cpu)
> {
> intel_cpuc_finish(&per_cpu(cpu_hw_events, cpu));
> +
> + if (is_hybrid()) {
> + struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
> + struct x86_hybrid_pmu *hybrid_pmu = NULL;
> + int i;
> +
> + for (i = 0; i < x86_pmu.num_hybrid_pmus; i++) {
> + if (cpumask_test_and_clear_cpu(cpu, &x86_pmu.hybrid_pmu[i].supported_cpus)) {
> + hybrid_pmu = &x86_pmu.hybrid_pmu[i];
> + break;
> + }
> + }
> + if (WARN_ON_ONCE(!hybrid_pmu))
> + return;
> +
> + cpuc->pmu = NULL;
> + if (cpumask_empty(&hybrid_pmu->supported_cpus)) {
> + perf_pmu_unregister(&hybrid_pmu->pmu);
> + hybrid_pmu->pmu.type = -1;
> + }
> + }
> }

CPU_DEAD is the part of hotplug after we've disabled IRQs for the last
time and before we kill ourselves, and you're trying to use mutexes
again!