[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <584cb976-4e21-5dc2-bce2-cd6c3b5d1613@arm.com>
Date: Fri, 9 Jun 2023 12:44:12 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mark Rutland <mark.rutland@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
will@...nel.org, catalin.marinas@....com,
Mark Brown <broonie@...nel.org>,
James Clark <james.clark@....com>,
Rob Herring <robh@...nel.org>, Marc Zyngier <maz@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH V11 05/10] arm64/perf: Add branch stack support in ARMV8
PMU
[..]
On 6/8/23 15:43, Suzuki K Poulose wrote:
>>> | static int armv8pmu_probe_pmu(struct arm_pmu *cpu_pmu)
>>> | {
>>> | struct armv8pmu_probe_info probe = {
>>> | .pmu = cpu_pmu,
>>> | .present = false,
>>> | };
>>> | int ret;
>>> |
>>> | ret = smp_call_function_any(&cpu_pmu->supported_cpus,
>>> | __armv8pmu_probe_pmu,
>>> | &probe, 1);
>>> | if (ret)
>>> | return ret;
>>> | if (!probe.present)
>>> | return -ENODEV;
>>> |
>>> | if (!arm_pmu_branch_stack_supported(cpu_pmu))
>>> | return 0;
>>> |
>>> | ret = armv8pmu_private_alloc(cpu_pmu);
>>> | if (ret)
>>> | return ret;
>>> |
>>> | ret = branch_records_alloc(cpu_pmu);
>>> | if (ret)
>>> | armv8pmu_private_free(cpu_pmu);
>>> |
>>> | return ret;
>>> | }
After splitting the task ctx cache management from pmu private data
management, the above function will look something like this taking
care of all error path freeing as well.
static int armv8pmu_probe_pmu(struct arm_pmu *cpu_pmu)
{
struct armv8pmu_probe_info probe = {
.pmu = cpu_pmu,
.present = false,
};
int ret;
ret = armv8pmu_private_alloc(cpu_pmu);
if (ret)
return ret;
ret = smp_call_function_any(&cpu_pmu->supported_cpus,
__armv8pmu_probe_pmu,
&probe, 1);
if (ret)
goto probe_err;
if (!probe.present) {
ret = -ENODEV;
goto probe_err;
}
if (cpu_pmu->has_branch_stack) {
ret = armv8pmu_task_ctx_cache_alloc(cpu_pmu);
if (ret)
goto probe_err;
ret = branch_records_alloc(cpu_pmu);
if (ret) {
armv8pmu_task_ctx_cache_free(cpu_pmu);
goto probe_err;
}
return 0;
}
armv8pmu_private_free(cpu_pmu);
return 0;
probe_err:
armv8pmu_private_free(cpu_pmu);
return ret;
}
Powered by blists - more mailing lists