Thread (7 messages) 7 messages, 2 authors, 2020-02-17

Re: [PATCH 1/2] KVM: arm64: Add PMU event filtering infrastructure

From: Robin Murphy <robin.murphy@arm.com>
Date: 2020-02-14 22:01:19
Also in: kvm, kvmarm

Hi Marc,

On 2020-02-14 6:36 pm, Marc Zyngier wrote:
[...]
quoted hunk ↗ jump to hunk
@@ -585,6 +585,14 @@ static void kvm_pmu_create_perf_event(struct kvm_vcpu *vcpu, u64 select_idx)
  	    pmc->idx != ARMV8_PMU_CYCLE_IDX)
  		return;
  
+	/*
+	 * If we have a filter in place and that the event isn't allowed, do
+	 * not install a perf event either.
+	 */
+	if (vcpu->kvm->arch.pmu_filter &&
+	    !test_bit(eventsel, vcpu->kvm->arch.pmu_filter))
+		return;
If I'm reading the derivation of eventsel right, this will end up 
treating cycle counter events (aliased to SW_INCR) differently from 
CPU_CYCLES, which doesn't seem desirable.

Also, if the user did try to blacklist SW_INCR for ridiculous reasons, 
we'd need to special-case kvm_pmu_software_increment() to make it (not) 
work as expected, right?

Robin.
+
  	memset(&attr, 0, sizeof(struct perf_event_attr));
  	attr.type = PERF_TYPE_RAW;
  	attr.size = sizeof(attr);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help