Re: [PATCH v8 09/11] KVM: arm64: PMU: Implement fixed-counters-only emulation

Oliver Upton <[email protected]>
Newsgroups org.kernel.vger.linux-hardening,dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.kvm,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
On Fri, Jul 10, 2026 at 08:15:03PM +0900, Akihiko Odaki wrote:
> @@ -813,6 +842,15 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
>  	if (!pmuv3_implemented(kvm_arm_pmu_get_pmuver_limit()))
>  		return;
>  
> +	/*
> +	 * IMPDEF PMUv3 traps are non-architectural, and KVM cannot assume a
> +	 * uniform PMUv3-compatible arm_pmu is available on all CPUs.
> +	 */
> +	if (cpus_have_final_cap(ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS)) {
> +		kvm_info("Non-architectural PMU, tainting kernel\n");
> +		add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
> +	}
> +

This is an unrelated change, and really the taint should be added with the
.cpu_enable() for this capability. That's the point where we flip the
magic bit.

> +void kvm_vcpu_load_pmu(struct kvm_vcpu *vcpu, int last_cpu)
> +{
> +	if (!kvm_pmu_fixed_counters_only(vcpu->kvm) || vcpu->cpu == last_cpu || last_cpu == -1)
										^~~~~~~~~~~~~~

Does this do anything other than avoid a spurious reload on the first KVM_RUN?

Thanks,
Oliver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.