RE: [PATCH v13 08/12] KVM: x86: Add Intel PT context switch for each vcpu
From: Kang, Luwei
Date: Wed Oct 24 2018 - 20:06:33 EST
> > +static void pt_guest_enter(struct vcpu_vmx *vmx) {
> > + if (pt_mode == PT_MODE_SYSTEM)
> > + return;
> > +
> > + /* Save host state before VM entry */
> > + rdmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl);
> > +
> > + /*
> > + * Set guest state of MSR_IA32_RTIT_CTL MSR (PT will be disabled
> > + * on VM entry when it has been disabled in guest before).
> > + */
> > + vmcs_write64(GUEST_IA32_RTIT_CTL, vmx->pt_desc.guest.ctl);
> > +
> > + if (vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN) {
> > + wrmsrl(MSR_IA32_RTIT_CTL, 0);
> > + pt_save_msr(&vmx->pt_desc.host, vmx->pt_desc.addr_range);
> > + pt_load_msr(&vmx->pt_desc.guest, vmx->pt_desc.addr_range);
> > + }
> > +}
>
> From my side this is still a NAK, because [1].
>
> [1] https://marc.info/?l=kvm&m=153847567226248&w=2
>
This place is save the host PT status and load the guest PT status before VM-entry when working in Host-Guest mode.
Thanks,
Luwei Kang