[PATCH v1] KVM: arm64: Use the host kvm_host_data for nr_event_counters
Marc Zyngier
maz at kernel.org
Fri Oct 23 05:43:35 PDT 2026
On Fri, 23 Oct 2026 13:29:04 +0100,
Fuad Tabba <fuad.tabba at linux.dev> wrote:
>
> Hi Vincent,
>
> On Fri, 23 Oct 2026 10:20:07 +0100, Vincent Donnefort
> <vdonnefort at google.com> wrote:
> [...]
> > So kvm_init_host_debug_data() initialises nr_event_counters in the
> > hypervisor's kvm_host_data, while kvm_arm_setup_mdcr_el2() reads the
> > host copy which is 0. With a HPMN of 0, this stops programmable event
> > counters from counting a non-protected guest.
>
> I tested this in pKVM with a non-protected guest counting with
> perf_event_open(). On its own the patch doesn't change what the guest
> sees: every counter, the cycle counter included, still reads 0. That's
> a separate bug: flush_hyp_vcpu() never copies vcpu->arch.pmu.events to
> the hyp vCPU, so the guest's events are never enabled on entry. I'll
> send a fix for that shortly.
Please synchronise with Vincent and sent this as a series fixing PMU
handling on pKVM, not as discrete patches.
The approach taken for this patch is wrong anyway, so you have plenty
of opportunity to work together.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list