[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RESEND v1 2/7] x86: configure vmcs for Intel processor trace virtualization



> > This patch configure VMCS to make Intel PT output address can be treat
> > as guest physical address and translated by EPT when intel_pt option
> > is true.
> > There have some constraint condition on VMCS configuration, otherwise
> > will cause VM entry failed.
> >
> > 1. If the “Guest PT uses Guest Physical Addresses” execution
> >    control is 1, the “Clear IA32_RTIT_CTL on exit” exit
> >    control and the “Load IA32_RTIT_CTL on entry” entry
> >    control must also be 1.
> > 2. If the “Guest PT uses Guest Physical Addresses” execution
> >    control is 1, the "enable EPT" execution control must
> >    also be 1.
> 
> What are the implications for a guest running with hap=0?
> 

Intel PT enabling in guest depend on EPT feature. So if hap=0 Intel PT will 
disabled in guest.

> > @@ -383,13 +388,28 @@ static int vmx_init_vmcs_config(void)
> >          _vmx_secondary_exec_control &=
> > ~SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS;
> >
> >      min = 0;
> > -    opt = VM_ENTRY_LOAD_GUEST_PAT | VM_ENTRY_LOAD_BNDCFGS;
> > +    opt = VM_ENTRY_LOAD_GUEST_PAT | VM_ENTRY_LOAD_BNDCFGS |
> > +          VM_ENTRY_CONCEAL_PT_PIP | VM_ENTRY_LOAD_IA32_RTIT_CTL;
> >      _vmx_vmentry_control = adjust_vmx_controls(
> >          "VMEntry Control", min, opt, MSR_IA32_VMX_ENTRY_CTLS,
> > &mismatch);
> >
> >      if ( mismatch )
> >          return -EINVAL;
> >
> > +    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
> ||
> > +         !(_vmx_secondary_exec_control & SECONDARY_EXEC_PT_USE_GPA)
> ||
> > +         !(_vmx_vmexit_control & VM_EXIT_CLEAR_IA32_RTIT_CTL) ||
> > +         !(_vmx_vmentry_control & VM_ENTRY_LOAD_IA32_RTIT_CTL) )
> > +    {
> > +        _vmx_secondary_exec_control &=
> ~(SECONDARY_EXEC_PT_USE_GPA |
> > +                                         SECONDARY_EXEC_CONCEAL_PT_PIP);
> > +        _vmx_vmexit_control &= ~(VM_EXIT_CONCEAL_PT_PIP |
> > +                                 VM_EXIT_CLEAR_IA32_RTIT_CTL);
> > +        _vmx_vmentry_control &= ~(VM_ENTRY_CONCEAL_PT_PIP |
> > +                                  VM_ENTRY_LOAD_IA32_RTIT_CTL);
> > +        opt_intel_pt = 0;
> > +    }
> 
> Besides clearing the flag here, shouldn't you also check it further up?

If " opt_intel_pt =0" represent user don't want to use this feature to all 
guest or hardware don't support it at all. If flag "opt_intel_pt " still true 
after this check represent the user want to use this feature and hardware have 
capability to support PT in guest.  This is depend on hardware capability and 
the parameter set of xen command line "ipt=1".

If " opt_intel_pt = 1" but a new guest created by "hap=0" in xl.cfg. Intel PT 
will be make off in this guest and set flag " pt->intel_pt_enabled = false". 
This flag is VM specific and can't affect create another new guest have Intel 
PT with "hap=1". I am not sure if this is what you concern.

Thanks,
Luwei Kang

> 
> Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.