On 19/01/19 21:04, Luwei Kang wrote: > static struct pt_pmu pt_pmu; > > @@ -1260,6 +1262,14 @@ void intel_pt_interrupt(void) > struct pt_buffer *buf; > struct perf_event *event = pt->handle.event; > > + if (pt->vcpu) { > + /* Inject PMI to Guest */ > + kvm_make_request(KVM_REQ_PMI, pt->vcpu); > + __set_bit(MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT, > + (unsigned long *)&pt->vcpu->arch.pmu.global_status); > + return; > + } > + There is no need to touch struct pt and to know details of KVM in arch/x86/events. Please add a function pointer void (*kvm_handle_pt_interrupt)(void); to some header, and in handle_pmi_common do if (unlikely(kvm_handle_intel_pt_interrupt)) kvm_handle_intel_pt_interrupt(); else intel_pt_interrupt(); The function pointer can be assigned in kvm_before_interrupt/kvm_after_interrupt just like you do now. This should be a simpler patch too. Paolo