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

Colton Lewis coltonlewis at google.com
Thu Dec 3 11:23:22 PST 2026


Oliver Upton <oupton at kernel.org> 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.



More information about the linux-arm-kernel mailing list