]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf: arm_pmuv3: Call kvm_vcpu_pmu_resync_el0() before enabling counters
authorRob Herring (Arm) <robh@kernel.org>
Tue, 18 Feb 2025 20:39:56 +0000 (14:39 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:02 +0000 (11:13 +0200)
[ Upstream commit 04bd15c4cbc3f7bd2399d1baab958c5e738dbfc9 ]

Counting events related to setup of the PMU is not desired, but
kvm_vcpu_pmu_resync_el0() is called just after the PMU counters have
been enabled. Move the call to before enabling the counters.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Tested-by: James Clark <james.clark@linaro.org>
Link: https://lore.kernel.org/r/20250218-arm-brbe-v19-v20-1-4e9922fc2e8e@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/perf/arm_pmuv3.c

index 0e360feb3432e14815dd88d8ec92f25161b2220a..9ebc950559c0a2520ca48f26ed6df915597424e4 100644 (file)
@@ -825,10 +825,10 @@ static void armv8pmu_start(struct arm_pmu *cpu_pmu)
        else
                armv8pmu_disable_user_access();
 
+       kvm_vcpu_pmu_resync_el0();
+
        /* Enable all counters */
        armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E);
-
-       kvm_vcpu_pmu_resync_el0();
 }
 
 static void armv8pmu_stop(struct arm_pmu *cpu_pmu)