2017-11-14 07:03:30

by Luwei Kang

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

> > + 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:
> >