lkml.org 
[lkml]   [2019]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] perf/x86/intel/pt: Inject PMI for KVM guest
From
Date
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

\
 
 \ /
  Last update: 2019-01-30 18:03    [W:0.090 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site