Re: [PATCH v10 18/33] KVM: arm64: Enforce PMU event filter at vcpu_load()

From: Colton Lewis

Date: Thu Dec 03 2026 - 14:23:31 EST


Oliver Upton <oupton@xxxxxxxxxx> writes:

> On Thu, Nov 19, 2026 at 06:52:00PM +0000, Colton Lewis wrote:
>> + guest_counters = kvm_vcpu_pmu_guest_counter_mask(vcpu);
>> + if (!test_bit(idx, (unsigned long *)&guest_counters))
>> + return;
>
> That's a KVM bug.

Ack, I'll turn this into a KVM_BUG_ON() in v11.

>> + guest_include_el2 = (val & ARMV8_PMU_INCLUDE_EL2);
>
> We have the "kvm_pmc_counts_at_elX()" helpers, those seem like they'd be
> useful here.

Agreed. I'll switch to those.

>> + if (unlikely(is_hyp_ctxt(vcpu))) {
>
> We can do without the unlikely() here.

Ack, will drop.