On Sun, Aug 25, 2013 at 3:44 PM, Jan Kiszka <jan.kiszka@xxxxxx> wrote: > On 2013-08-25 09:37, Arthur Chunqi Li wrote: >> On Sun, Aug 25, 2013 at 3:28 PM, Jan Kiszka <jan.kiszka@xxxxxx> wrote: >>> On 2013-08-25 09:24, Arthur Chunqi Li wrote: >>>> On Sun, Aug 25, 2013 at 2:44 PM, Jan Kiszka <jan.kiszka@xxxxxx> wrote: >>>>> On 2013-08-24 20:44, root wrote: >>>>>> This patch contains the following two changes: >>>>>> 1. Fix the bug in nested preemption timer support. If vmexit L2->L0 >>>>>> with some reasons not emulated by L1, preemption timer value should >>>>>> be save in such exits. >>>>>> 2. Add support of "Save VMX-preemption timer value" VM-Exit controls >>>>>> to nVMX. >>>>>> >>>>>> With this patch, nested VMX preemption timer features are fully >>>>>> supported. >>>>>> >>>>>> Signed-off-by: Arthur Chunqi Li <yzt356@xxxxxxxxx> >>>>>> --- >>>>>> arch/x86/kvm/vmx.c | 30 +++++++++++++++++++++++++----- >>>>>> 1 file changed, 25 insertions(+), 5 deletions(-) >>>>>> >>>>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >>>>>> index 57b4e12..9579409 100644 >>>>>> --- a/arch/x86/kvm/vmx.c >>>>>> +++ b/arch/x86/kvm/vmx.c >>>>>> @@ -2204,7 +2204,8 @@ static __init void nested_vmx_setup_ctls_msrs(void) >>>>>> #ifdef CONFIG_X86_64 >>>>>> VM_EXIT_HOST_ADDR_SPACE_SIZE | >>>>>> #endif >>>>>> - VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT; >>>>>> + VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT | >>>>>> + VM_EXIT_SAVE_VMX_PREEMPTION_TIMER; >>>>>> nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | >>>>>> VM_EXIT_LOAD_IA32_EFER); >>>>> >>>>> In the absence of VM_EXIT_SAVE_VMX_PREEMPTION_TIMER, you need to hide >>>>> PIN_BASED_VMX_PREEMPTION_TIMER from the guest as we cannot emulate its >>>>> behavior properly in that case. >> Besides, we need to test that in the absence of >> PIN_BASED_VMX_PREEMPTION_TIMER, we need to hide >> VM_EXIT_SAVE_VMX_PREEMPTION_TIMER, though this should not happen >> according to Intel SDM. > > If the SDM guarantees this for us, we don't need such a safety measure. > Otherwise, it should be added, yes. The SDM has such description (see 26.2.1.2): If “activate VMX-preemption timer” VM-execution control is 0, the “save VMX-preemption timer value” VM-exit control must also be 0. It doesn't tell us if these two flags are consistent when getting them from related MSR (IA32_VMX_PINBASED_CTLS and IA32_VMX_EXIT_CTLS). So I think the check is needed here. Arthur > > Jan > > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html