On Thu, 14 Dec 2023, Eric Auger wrote:
On 12/7/23 11:36, Shaoqin Huang wrote:
+ if (kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, &attr)) {
+ warn_report("The kernel doesn't support the PMU Event Filter!\n");
+ return;
+ }
+
+ /* The filter only needs to be initialized for 1 vcpu. */
Are you sure? This is a per vcpu device ctrl. Where is it written in the
doc that this shall not be called for each vcpu
The interface is per vcpu but the filters are actually managed per vm
(kvm->arch.pmu_filter). From (kernel) commit 6ee7fca2a ("KVM: arm64: Add
KVM_ARM_VCPU_PMU_V3_SET_PMU attribute"):
To ensure that KVM doesn't expose an asymmetric system to the guest, the
PMU set for one VCPU will be used by all other VCPUs. Once a VCPU has run,
the PMU cannot be changed in order to avoid changing the list of available
events for a VCPU, or to change the semantics of existing events.
Sebastian