RE: [patch v2 8/8] KVM: x86: Disable intercept for Intel processor trace MSRs

From: Kang, Luwei
Date: Tue Nov 14 2017 - 02:02:11 EST


> > + if (pt_mode == PT_MODE_HOST_GUEST) {
> > + u32 i, eax, ebx, ecx, edx;
> > +
> > + cpuid_count(0x14, 1, &eax, &ebx, &ecx, &edx);
> > + vmx_disable_intercept_for_msr(MSR_IA32_RTIT_STATUS, false);
> > + vmx_disable_intercept_for_msr(MSR_IA32_RTIT_OUTPUT_BASE, false);
> > + vmx_disable_intercept_for_msr(MSR_IA32_RTIT_OUTPUT_MASK, false);
> > + vmx_disable_intercept_for_msr(MSR_IA32_RTIT_CR3_MATCH, false);
> > + for (i = 0; i < (eax & 0x7); i++)
> > + vmx_disable_intercept_for_msr(MSR_IA32_RTIT_ADDR0_A + i,
> > + false);
> > + }
> > +
>
> As I mentioned earlier, this probably makes vmentry/vmexit too expensive when guests are not using processor tracing. I would do it only if guest TRACEEN=1 (since anyway the values have to be correct if guest TRACEEN=1, and a change in TRACEEN always causes a vmexit).
>

Will change in next version.

Thanks,
Luwei Kang

>
> > return alloc_kvm_area();
> >
> > out:
> >