WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH 08/16] vmx: nest: vmresume/vmlaunch

To: Christoph Egger <Christoph.Egger@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH 08/16] vmx: nest: vmresume/vmlaunch
From: "Dong, Eddie" <eddie.dong@xxxxxxxxx>
Date: Mon, 20 Sep 2010 13:19:28 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "Dong, Eddie" <eddie.dong@xxxxxxxxx>, "He, Qing" <qing.he@xxxxxxxxx>
Delivery-date: Sun, 19 Sep 2010 22:25:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <201009151330.28618.Christoph.Egger@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1283959344-3837-1-git-send-email-qing.he@xxxxxxxxx> <1283959344-3837-9-git-send-email-qing.he@xxxxxxxxx> <201009151152.27514.Christoph.Egger@xxxxxxx> <201009151330.28618.Christoph.Egger@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: ActUyfgsp1eVCTEmQaKGRyDKxud6agDuVxAg
Thread-topic: [Xen-devel] [PATCH 08/16] vmx: nest: vmresume/vmlaunch
Christoph Egger wrote:
> On Wednesday 15 September 2010 11:52:26 Christoph Egger wrote:
>> On Wednesday 08 September 2010 17:22:16 Qing He wrote:
>>> vmresume and vmlaunch instructions and transitional states
>>> 
>>> Signed-off-by: Qing He <qing.he@xxxxxxxxx>
>>> Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx>
>>> 
>>> ---
>>> 
>>> diff -r e828d55c10bb xen/arch/x86/hvm/vmx/nest.c
>>> --- a/xen/arch/x86/hvm/vmx/nest.c   Wed Sep 08 21:42:10 2010 +0800
>>> +++ b/xen/arch/x86/hvm/vmx/nest.c   Wed Sep 08 22:04:16 2010 +0800 @@
>>>      -633,3 +633,33 @@ hvm_inject_exception(TRAP_invalid_op, 0, 0);
>>>      return X86EMUL_EXCEPTION;
>>>  }
>>> +
>>> +int vmx_nest_handle_vmresume(struct cpu_user_regs *regs) +{
>>> +    struct vcpu *v = current;
>>> +    struct vmx_nest_struct *nest = &v->arch.hvm_vmx.nest; +    int
>>> rc; +
>>> +    if ( unlikely(!nest->guest_vmxon_pa) )
>>> +        goto invalid_op;
>>> +
>>> +    rc = vmx_inst_check_privilege(regs);
>>> +    if ( rc != X86EMUL_OKAY )
>>> +        return rc;
>>> +
>>> +    if ( nest->vmcs_valid == 1 )
>>> +        nest->vmresume_pending = 1;
>>> +    else
>>> +        vmreturn(regs, VMFAIL_INVALID);
>>> +
>>> +    return X86EMUL_OKAY;
>>> +
>>> +invalid_op:
>>> +    hvm_inject_exception(TRAP_invalid_op, 0, 0);
>>> +    return X86EMUL_EXCEPTION;
>>> +}
>>> +
>>> +int vmx_nest_handle_vmlaunch(struct cpu_user_regs *regs) +{
>>> +    return vmx_nest_handle_vmresume(regs);
>>> +}
>>> diff -r e828d55c10bb xen/arch/x86/hvm/vmx/vmx.c
>>> --- a/xen/arch/x86/hvm/vmx/vmx.c    Wed Sep 08 21:42:10 2010 +0800
>>> +++ b/xen/arch/x86/hvm/vmx/vmx.c    Wed Sep 08 22:04:16 2010 +0800 @@
>>>      -2321,6 +2321,11 @@ /* Now enable interrupts so it's safe to
>>> take locks. */      local_irq_enable(); 
>>> 
>>> +    /* XXX: This looks ugly, but we need a mechanism to ensure
>>> +     * any pending vmresume has really happened
>>> +     */
>>> +    v->arch.hvm_vmx.nest.vmresume_in_progress = 0; +
>>>      if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
>>>          return vmx_failed_vmentry(exit_reason, regs);
>>> 
>>> @@ -2592,6 +2597,11 @@
>>>          if ( vmx_nest_handle_vmclear(regs) == X86EMUL_OKAY )
>>>              __update_guest_eip(inst_len);
>>>          break;
>>> +    case EXIT_REASON_VMLAUNCH:
>>> +        inst_len = __get_instruction_length();
>>> +        if ( vmx_nest_handle_vmlaunch(regs) == X86EMUL_OKAY )
>>> +            __update_guest_eip(inst_len);
>>> +        break;
>>>      case EXIT_REASON_VMPTRLD:
>>>          inst_len = __get_instruction_length();
>>>          if ( vmx_nest_handle_vmptrld(regs) == X86EMUL_OKAY ) @@
>>>          -2607,6 +2617,11 @@ if ( vmx_nest_handle_vmread(regs) ==
>>>              X86EMUL_OKAY ) __update_guest_eip(inst_len);
>>>          break;
>>> +    case EXIT_REASON_VMRESUME:
>>> +        inst_len = __get_instruction_length();
>>> +        if ( vmx_nest_handle_vmresume(regs) == X86EMUL_OKAY )
>>> +            __update_guest_eip(inst_len);
>>> +        break;
>>>      case EXIT_REASON_VMWRITE:
>>>          inst_len = __get_instruction_length();
>>>          if ( vmx_nest_handle_vmwrite(regs) == X86EMUL_OKAY ) @@
>>> -2625,8 +2640,6 @@ 
>>> 
>>>      case EXIT_REASON_MWAIT_INSTRUCTION:
>>>      case EXIT_REASON_MONITOR_INSTRUCTION:
>>> -    case EXIT_REASON_VMLAUNCH:
>>> -    case EXIT_REASON_VMRESUME:
>>>          vmx_inject_hw_exception(TRAP_invalid_op,
>>> HVM_DELIVER_NO_ERROR_CODE); break;
>>> 
>>> diff -r e828d55c10bb xen/include/asm-x86/hvm/vmx/nest.h
>>> --- a/xen/include/asm-x86/hvm/vmx/nest.h    Wed Sep 08 21:42:10 2010
>>> +0800 +++ b/xen/include/asm-x86/hvm/vmx/nest.h      Wed Sep 08 22:04:16
>>>      2010 +0800 @@ -40,6 +40,20 @@ void                *vvmcs;
>>>      struct vmcs_struct  *svmcs;
>>>      int                  vmcs_valid;
>>> +
>>> +    /*
>>> +     * vmexit_pending and vmresume_pending is to mark pending
>>> +     * switches, they are cleared when physical vmcs is changed. +
>>> */ +    int                  vmexit_pending;
>>> +    int                  vmresume_pending;
>> 
>> This is functional equal to the vmentry flag in struct nestedhvm.
> 
> Is it possible to have both vmexit and vmresume pending at the same
> time ? 
> 

Should not be. We may be able to use single variable for multiple state.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>