Skip to contentSkip to conversation

7468: tolerable FAIL - PUSHED

xen-4.1-testing test xen.org 6 participants 31 messages Jun 1, 2011 – Jun 2, 2011

lore
Share & tools
lore

xen.org

author
#0 lore raw

flight 7468 xen-4.1-testing real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/7468/

Failures :-/ but no regressions.

Tests which did not succeed, but are not blocking, including regressions (tests previously passed) regarded as allowable:

 test-amd64-amd64-win         16 leak-check/check             fail   never pass
 test-amd64-amd64-xl-win      13 guest-stop                   fail   never pass
 test-amd64-i386-rhel6hvm-amd  8 guest-saverestore            fail   never pass
 test-amd64-i386-rhel6hvm-intel  8 guest-saverestore            fail never pass
 test-amd64-i386-win-vcpus1   16 leak-check/check             fail   never pass
 test-amd64-i386-win          16 leak-check/check             fail   never pass
 test-amd64-i386-xl-win-vcpus1 13 guest-stop                   fail  never pass
 test-amd64-xcpkern-i386-pair 16 guest-start                  fail    like 7329
 test-amd64-xcpkern-i386-rhel6hvm-amd  8 guest-saverestore      fail never pass
 test-amd64-xcpkern-i386-rhel6hvm-intel  8 guest-saverestore    fail never pass
 test-amd64-xcpkern-i386-win  16 leak-check/check             fail   never pass
 test-amd64-xcpkern-i386-xl-win 13 guest-stop                   fail never pass
 test-i386-i386-win           16 leak-check/check             fail   never pass
 test-i386-i386-xl-win        13 guest-stop                   fail   never pass
 test-i386-xcpkern-i386-win   16 leak-check/check             fail   never pass

version targeted for testing:
xen dbe9e02a1f75
baseline version:
xen 61336bbb0002

------------------------------------------------------------
People who touched revisions under test:
Ian Campbell <[email protected]>
Ian Jackson <[email protected]>
Jim Fehlig <[email protected]>
Keir Fraser <[email protected]>
Li, Xin <[email protected]>
Tim Deegan <[email protected]>
Yang, Wei <[email protected]>
------------------------------------------------------------

jobs:

 build-i386-xcpkern                                           pass     
 build-amd64                                                  pass     
 build-i386                                                   pass     
 build-amd64-oldkern                                          pass     
 build-i386-oldkern                                           pass     
 build-amd64-pvops                                            pass     
 build-i386-pvops                                             pass     
 test-amd64-amd64-xl                                          pass     
 test-amd64-i386-xl                                           pass     
 test-i386-i386-xl                                            pass     
 test-amd64-xcpkern-i386-xl                                   pass     
 test-i386-xcpkern-i386-xl                                    pass     
 test-amd64-i386-rhel6hvm-amd                                 fail     
 test-amd64-xcpkern-i386-rhel6hvm-amd                         fail     
 test-amd64-i386-xl-credit2                                   pass     
 test-amd64-xcpkern-i386-xl-credit2                           pass     
 test-amd64-i386-rhel6hvm-intel                               fail     
 test-amd64-xcpkern-i386-rhel6hvm-intel                       fail     
 test-amd64-i386-xl-multivcpu                                 pass     
 test-amd64-xcpkern-i386-xl-multivcpu                         pass     
 test-amd64-amd64-pair                                        pass     
 test-amd64-i386-pair                                         pass     
 test-i386-i386-pair                                          pass     
 test-amd64-xcpkern-i386-pair                                 fail     
 test-i386-xcpkern-i386-pair                                  pass     
 test-amd64-amd64-pv                                          pass     
 test-amd64-i386-pv                                           pass     
 test-i386-i386-pv                                            pass     
 test-amd64-xcpkern-i386-pv                                   pass     
 test-i386-xcpkern-i386-pv                                    pass     
 test-amd64-i386-win-vcpus1                                   fail     
 test-amd64-i386-xl-win-vcpus1                                fail     
 test-amd64-amd64-win                                         fail     
 test-amd64-i386-win                                          fail     
 test-i386-i386-win                                           fail     
 test-amd64-xcpkern-i386-win                                  fail     
 test-i386-xcpkern-i386-win                                   fail     
 test-amd64-amd64-xl-win                                      fail     
 test-i386-i386-xl-win                                        fail     
 test-amd64-xcpkern-i386-xl-win                               fail     

------------------------------------------------------------
sg-report-flight on woking.cam.xci-test.com
logs: /home/xc_osstest/logs
images: /home/xc_osstest/images

Logs, config files, etc. are available at
http://www.chiark.greenend.org.uk/~xensrcts/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary

Pushing revision :

+ branch=xen-4.1-testing
+ revision=dbe9e02a1f75
+ . cri-lock-repos
++ . cri-common
+++ umask 002
+++ getconfig Repos
+++ perl -e '

                use Osstest;
                readconfigonly();
                print $c{Repos} or die $!;
        '

++ repos=/export/home/osstest/repos
++ repos_lock=/export/home/osstest/repos/lock
++ '[' x '!=' x/export/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/export/home/osstest/repos/lock
++ exec with-lock-ex -w /export/home/osstest/repos/lock ./ap-push xen-4.1-testing dbe9e02a1f75
+ branch=xen-4.1-testing
+ revision=dbe9e02a1f75
+ . cri-lock-repos
++ . cri-common
+++ umask 002
+++ getconfig Repos
+++ perl -e '

                use Osstest;
                readconfigonly();
                print $c{Repos} or die $!;
        '

++ repos=/export/home/osstest/repos
++ repos_lock=/export/home/osstest/repos/lock
++ '[' x/export/home/osstest/repos/lock '!=' x/export/home/osstest/repos/lock ']'
+ : [email protected]
+ : [email protected]:git/linux-pvops
+ : master
+ case "$branch" in
+ cd /export/home/osstest/repos/xen-4.1-testing.hg
+ hg push -r dbe9e02a1f75 ssh://[email protected]/HG/xen-4.1-testing.hg pushing to ssh://[email protected]/HG/xen-4.1-testing.hg searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 5 changesets with 9 changes to 9 files

#1 lore raw

pre-cleanup1 for nested VMX

Extend nhvm_vmcx_guest_intercepts_trap to include errcode to assist decision of TRAP_page_fault in VMX. Thanks, Eddie

xen/arch/x86/hvm/hvm.c +3 -3
diff -r 0c446850d85e xen/arch/x86/hvm/hvm.c
@@ -1152,7 +1152,7 @@
         return;
     }
 
-    if ( nhvm_vmcx_guest_intercepts_trap(v, trapnr) )
+    if ( nhvm_vmcx_guest_intercepts_trap(v, trapnr, errcode) )
     {
         enum nestedhvm_vmexits nsret;
 
@@ -4175,10 +4175,10 @@
     return -EOPNOTSUPP;
 }
 
-int nhvm_vmcx_guest_intercepts_trap(struct vcpu *v, unsigned int trap)
+int nhvm_vmcx_guest_intercepts_trap(struct vcpu *v, unsigned int trap, int errcode)
 {
     if (hvm_funcs.nhvm_vmcx_guest_intercepts_trap)
-        return hvm_funcs.nhvm_vmcx_guest_intercepts_trap(v, trap);
+        return hvm_funcs.nhvm_vmcx_guest_intercepts_trap(v, trap, errcode);
     return -EOPNOTSUPP;
 }
 
xen/arch/x86/hvm/svm/nestedsvm.c +1 -1
diff -r 0c446850d85e xen/arch/x86/hvm/svm/nestedsvm.c
@@ -895,7 +895,7 @@
 }
 
 int
-nsvm_vmcb_guest_intercepts_trap(struct vcpu *v, unsigned int trapnr)
+nsvm_vmcb_guest_intercepts_trap(struct vcpu *v, unsigned int trapnr, int errcode)
 {
     return nsvm_vmcb_guest_intercepts_exitcode(v,
         guest_cpu_user_regs(), VMEXIT_EXCEPTION_DE + trapnr);
xen/include/asm-x86/hvm/hvm.h +4 -2
diff -r 0c446850d85e xen/include/asm-x86/hvm/hvm.h
@@ -164,7 +164,8 @@
     uint64_t (*nhvm_vcpu_guestcr3)(struct vcpu *v);
     uint64_t (*nhvm_vcpu_hostcr3)(struct vcpu *v);
     uint32_t (*nhvm_vcpu_asid)(struct vcpu *v);
-    int (*nhvm_vmcx_guest_intercepts_trap)(struct vcpu *v, unsigned int trapnr);
+    int (*nhvm_vmcx_guest_intercepts_trap)(struct vcpu *v, 
+                               unsigned int trapnr, int errcode);
 
     bool_t (*nhvm_vmcx_hap_enabled)(struct vcpu *v);
 
@@ -443,7 +444,8 @@
 uint32_t nhvm_vcpu_asid(struct vcpu *v);
 
 /* returns true, when l1 guest intercepts the specified trap */
-int nhvm_vmcx_guest_intercepts_trap(struct vcpu *v, unsigned int trapnr);
+int nhvm_vmcx_guest_intercepts_trap(struct vcpu *v, 
+                                    unsigned int trapnr, int errcode);
 
 /* returns true when l1 guest wants to use hap to run l2 guest */
 bool_t nhvm_vmcx_hap_enabled(struct vcpu *v);
xen/include/asm-x86/hvm/svm/nestedsvm.h +2 -1
diff -r 0c446850d85e xen/include/asm-x86/hvm/svm/nestedsvm.h
@@ -114,7 +114,8 @@
 uint32_t nsvm_vcpu_asid(struct vcpu *v);
 int nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
     struct cpu_user_regs *regs, uint64_t exitcode);
-int nsvm_vmcb_guest_intercepts_trap(struct vcpu *v, unsigned int trapnr);
+int nsvm_vmcb_guest_intercepts_trap(struct vcpu *v, unsigned int trapnr,
+                                    int errcode);
 bool_t nsvm_vmcb_hap_enabled(struct vcpu *v);
 enum hvm_intblk nsvm_intr_blocked(struct vcpu *v);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

pre-cleanup2 for nested VMX

In reply to xen.org

Move IDT_VECTORING processing code out of intr_assist for simplicity.

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +29 -23
diff -r 9aa31694b91e xen/arch/x86/hvm/vmx/vmx.c
@@ -2098,6 +2098,33 @@
     return 0;
 }
 
+static void vmx_idtv_reinject(unsigned long idtv_info)
+{
+
+    /* Event delivery caused this intercept? Queue for redelivery. */
+    if ( unlikely(idtv_info & INTR_INFO_VALID_MASK) )
+    {
+        if ( hvm_event_needs_reinjection((idtv_info>>8)&7, idtv_info&0xff) )
+        {
+            /* See SDM 3B 25.7.1.1 and .2 for info about masking resvd bits. */
+            __vmwrite(VM_ENTRY_INTR_INFO,
+                      idtv_info & ~INTR_INFO_RESVD_BITS_MASK);
+            if ( idtv_info & INTR_INFO_DELIVER_CODE_MASK )
+                __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE,
+                          __vmread(IDT_VECTORING_ERROR_CODE));
+        }
+
+        /*
+         * Clear NMI-blocking interruptibility info if an NMI delivery faulted.
+         * Re-delivery will re-set it (see SDM 3B 25.7.1.2).
+         */
+        if ( (idtv_info & INTR_INFO_INTR_TYPE_MASK) == (X86_EVENTTYPE_NMI<<8) )
+            __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
+                      __vmread(GUEST_INTERRUPTIBILITY_INFO) &
+                      ~VMX_INTR_SHADOW_NMI);
+    }
+}
+
 asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
 {
     unsigned int exit_reason, idtv_info, intr_info = 0, vector = 0;
@@ -2187,30 +2214,9 @@
 
     hvm_maybe_deassert_evtchn_irq();
 
-    /* Event delivery caused this intercept? Queue for redelivery. */
     idtv_info = __vmread(IDT_VECTORING_INFO);
-    if ( unlikely(idtv_info & INTR_INFO_VALID_MASK) &&
-         (exit_reason != EXIT_REASON_TASK_SWITCH) )
-    {
-        if ( hvm_event_needs_reinjection((idtv_info>>8)&7, idtv_info&0xff) )
-        {
-            /* See SDM 3B 25.7.1.1 and .2 for info about masking resvd bits. */
-            __vmwrite(VM_ENTRY_INTR_INFO,
-                      idtv_info & ~INTR_INFO_RESVD_BITS_MASK);
-            if ( idtv_info & INTR_INFO_DELIVER_CODE_MASK )
-                __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE,
-                          __vmread(IDT_VECTORING_ERROR_CODE));
-        }
-
-        /*
-         * Clear NMI-blocking interruptibility info if an NMI delivery faulted.
-         * Re-delivery will re-set it (see SDM 3B 25.7.1.2).
-         */
-        if ( (idtv_info & INTR_INFO_INTR_TYPE_MASK) == (X86_EVENTTYPE_NMI<<8) )
-            __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
-                      __vmread(GUEST_INTERRUPTIBILITY_INFO) &
-                      ~VMX_INTR_SHADOW_NMI);
-    }
+    if ( exit_reason != EXIT_REASON_TASK_SWITCH )
+        vmx_idtv_reinject(idtv_info);
 
     switch ( exit_reason )
     {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

RFC: Nested VMX patch series 01: data structure

In reply to xen.org

Thanks, Eddie

xen/include/asm-x86/hvm/vcpu.h +2 -0
diff -r 9aa31694b91e xen/include/asm-x86/hvm/vcpu.h
@@ -24,6 +24,7 @@
 #include <asm/hvm/io.h>
 #include <asm/hvm/vlapic.h>
 #include <asm/hvm/vmx/vmcs.h>
+#include <asm/hvm/vmx/vvmx.h>
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/mtrr.h>
@@ -57,6 +58,7 @@
     /* SVM/VMX arch specific */
     union {
         struct nestedsvm nsvm;
+        struct nestedvmx nvmx;
     } u;
 
     bool_t nv_flushp2m; /* True, when p2m table must be flushed */
xen/include/asm-x86/hvm/vmx/vvmx.h new file +41 -0

41 lines not on this page · raw message

#4 lore raw

RFC: Nested VMX patch series 02: wrap APIs

In reply to xen.org

Wrap for common nested APIs.
Thx, Eddie

xen/arch/x86/hvm/hvm.c +1 -1
diff -r 70ee714947fb xen/arch/x86/hvm/hvm.c
@@ -3502,7 +3502,7 @@
                 /* Remove the check below once we have
                  * shadow-on-shadow.
                  */
-                if ( !paging_mode_hap(d) && a.value )
+                if ( cpu_has_svm && !paging_mode_hap(d) && a.value )
                     rc = -EINVAL;
                 /* Set up NHVM state for any vcpus that are already up */
                 if ( !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )
xen/arch/x86/hvm/vmx/Makefile +1 -0
diff -r 70ee714947fb xen/arch/x86/hvm/vmx/Makefile
@@ -4,3 +4,4 @@
 obj-y += vmcs.o
 obj-y += vmx.o
 obj-y += vpmu_core2.o
+obj-y += vvmx.o
xen/arch/x86/hvm/vmx/intr.c +5 -0
diff -r 70ee714947fb xen/arch/x86/hvm/vmx/intr.c
@@ -109,6 +109,11 @@
     }
 }
 
+enum hvm_intblk nvmx_intr_blocked(struct vcpu *v)
+{
+    return hvm_intblk_none;
+}
+
 asmlinkage void vmx_intr_assist(void)
 {
     struct hvm_intack intack;
xen/arch/x86/hvm/vmx/vmx.c +8 -1
diff -r 70ee714947fb xen/arch/x86/hvm/vmx/vmx.c
@@ -1407,7 +1407,14 @@
     .invlpg_intercept     = vmx_invlpg_intercept,
     .set_uc_mode          = vmx_set_uc_mode,
     .set_info_guest       = vmx_set_info_guest,
-    .set_rdtsc_exiting    = vmx_set_rdtsc_exiting
+    .set_rdtsc_exiting    = vmx_set_rdtsc_exiting,
+    .nhvm_vcpu_initialise = nvmx_vcpu_initialise,
+    .nhvm_vcpu_destroy    = nvmx_vcpu_destroy,
+    .nhvm_vcpu_reset      = nvmx_vcpu_reset,
+    .nhvm_vcpu_guestcr3   = nvmx_vcpu_guestcr3,
+    .nhvm_vcpu_hostcr3    = nvmx_vcpu_hostcr3,
+    .nhvm_vcpu_asid       = nvmx_vcpu_asid,
+    .nhvm_intr_blocked    = nvmx_intr_blocked
 };
 
 struct hvm_function_table * __init start_vmx(void)
xen/arch/x86/hvm/vmx/vvmx.c new file +93 -0

93 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +9 -0
diff -r 70ee714947fb xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -37,5 +37,14 @@
 
 #define nvcpu_2_nvmx(nv)	((*(nv)).u.nvmx)
 #define vcpu_2_nvmx(v)	(nvcpu_2_nvmx(&vcpu_nestedhvm(v)))
+
+int nvmx_vcpu_initialise(struct vcpu *v);
+void nvmx_vcpu_destroy(struct vcpu *v);
+int nvmx_vcpu_reset(struct vcpu *v);
+uint64_t nvmx_vcpu_guestcr3(struct vcpu *v);
+uint64_t nvmx_vcpu_hostcr3(struct vcpu *v);
+uint32_t nvmx_vcpu_asid(struct vcpu *v);
+enum hvm_intblk nvmx_intr_blocked(struct vcpu *v);
+
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#6 lore raw

RFC: Nested VMX patch series 03: vmxon_off

In reply to xen.org

VMXON_OFF processing

Thx, Eddie

xen/arch/x86/hvm/vmx/Makefile +1 -0
diff -r 7a9c7fbdabc0 xen/arch/x86/hvm/vmx/Makefile
@@ -5,3 +5,4 @@
 obj-y += vmx.o
 obj-y += vpmu_core2.o
 obj-y += vvmx.o
+obj-y += vvmx.o
xen/arch/x86/hvm/vmx/vmx.c +10 -2
diff -r 7a9c7fbdabc0 xen/arch/x86/hvm/vmx/vmx.c
@@ -2435,6 +2435,16 @@
         break;
     }
 
+    case EXIT_REASON_VMXOFF:
+        if ( nvmx_handle_vmxoff(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
+    case EXIT_REASON_VMXON:
+        if ( nvmx_handle_vmxon(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
     case EXIT_REASON_VMCLEAR:
@@ -2444,8 +2454,6 @@
     case EXIT_REASON_VMREAD:
     case EXIT_REASON_VMRESUME:
     case EXIT_REASON_VMWRITE:
-    case EXIT_REASON_VMXOFF:
-    case EXIT_REASON_VMXON:
     case EXIT_REASON_GETSEC:
     case EXIT_REASON_INVEPT:
     case EXIT_REASON_INVVPID:
xen/arch/x86/hvm/vmx/vvmx.c +278 -0

281 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +2 -0
diff -r 7a9c7fbdabc0 xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -46,5 +46,7 @@
 uint32_t nvmx_vcpu_asid(struct vcpu *v);
 enum hvm_intblk nvmx_intr_blocked(struct vcpu *v);
 
+int nvmx_handle_vmxon(struct cpu_user_regs *regs);
+int nvmx_handle_vmxoff(struct cpu_user_regs *regs);
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#7 lore raw

RFC: Nested VMX patch series 04: virtual VMCS structure and APIs

In reply to xen.org

Virtual VMCS structure and access wrapper APIs

Thx, Eddie

xen/arch/x86/hvm/vmx/vvmx.c +78 -0
diff -r f0647d3c60dc xen/arch/x86/hvm/vmx/vvmx.c
@@ -183,6 +183,84 @@
 #define CASE_GET_REG(REG, reg)      \
     case VMX_REG_ ## REG: value = regs->reg; break
 
+static int vvmcs_offset(u32 width, u32 type, u32 index)
+{
+    int offset;
+
+    offset = (index & 0x1f) | type << 5 | width << 7;
+
+    if ( offset == 0 )    /* vpid */
+        offset = 0x3f;
+
+    return offset;
+}
+
+u64 __get_vvmcs(void *vvmcs, u32 vmcs_encoding)
+{
+    union vmcs_encoding enc;
+    u64 *content = (u64 *) vvmcs;
+    int offset;
+    u64 res;
+
+    enc.word = vmcs_encoding;
+    offset = vvmcs_offset(enc.width, enc.type, enc.index);
+    res = content[offset];
+
+    switch ( enc.width ) {
+    case VVMCS_WIDTH_16:
+        res &= 0xffff;
+        break;
+   case VVMCS_WIDTH_64:
+        if ( enc.access_type )
+            res >>= 32;
+        break;
+    case VVMCS_WIDTH_32:
+        res &= 0xffffffff;
+        break;
+    case VVMCS_WIDTH_NATURAL:
+    default:
+        break;
+    }
+
+    return res;
+}
+
+void __set_vvmcs(void *vvmcs, u32 vmcs_encoding, u64 val)
+{
+    union vmcs_encoding enc;
+    u64 *content = (u64 *) vvmcs;
+    int offset;
+    u64 res;
+
+    enc.word = vmcs_encoding;
+    offset = vvmcs_offset(enc.width, enc.type, enc.index);
+    res = content[offset];
+
+    switch ( enc.width ) {
+    case VVMCS_WIDTH_16:
+        res = val & 0xffff;
+        break;
+    case VVMCS_WIDTH_64:
+        if ( enc.access_type )
+        {
+            res &= 0xffffffff;
+            res |= val << 32;
+        }
+        else
+            res = val;
+        break;
+    case VVMCS_WIDTH_32:
+        res = val & 0xffffffff;
+        break;
+    case VVMCS_WIDTH_NATURAL:
+    default:
+        res = val;
+        break;
+    }
+
+    content[offset] = res;
+}
+
 static unsigned long reg_read(struct cpu_user_regs *regs,
                               enum vmx_regs_enc index)
 {
xen/include/asm-x86/hvm/vmx/vvmx.h +59 -0

69 lines not on this page · raw message

#8 lore raw

RFC: Nested VMX patch series 05: vmptrld

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +5 -1
diff -r c7820e886afc xen/arch/x86/hvm/vmx/vmx.c
@@ -2445,11 +2445,15 @@
             update_guest_eip();
         break;
 
+    case EXIT_REASON_VMPTRLD:
+        if ( nvmx_handle_vmptrld(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
     case EXIT_REASON_VMCLEAR:
     case EXIT_REASON_VMLAUNCH:
-    case EXIT_REASON_VMPTRLD:
     case EXIT_REASON_VMPTRST:
     case EXIT_REASON_VMREAD:
     case EXIT_REASON_VMRESUME:
xen/arch/x86/hvm/vmx/vvmx.c +88 -1

114 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +3 -0
diff -r c7820e886afc xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -107,5 +107,8 @@
 u64 __get_vvmcs(void *vvmcs, u32 vmcs_encoding);
 void __set_vvmcs(void *vvmcs, u32 vmcs_encoding, u64 val);
 
+void nvmx_destroy_vmcs(struct vcpu *v);
+int nvmx_handle_vmptrld(struct cpu_user_regs *regs);
+
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#9 lore raw

RE: RFC: Nested VMX patch series 05: vmptrst

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +5 -1
diff -r 474da95963e2 xen/arch/x86/hvm/vmx/vmx.c
@@ -2450,11 +2450,15 @@
             update_guest_eip();
         break;
 
+    case EXIT_REASON_VMPTRST:
+        if ( nvmx_handle_vmptrst(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
     case EXIT_REASON_VMCLEAR:
     case EXIT_REASON_VMLAUNCH:
-    case EXIT_REASON_VMPTRST:
     case EXIT_REASON_VMREAD:
     case EXIT_REASON_VMRESUME:
     case EXIT_REASON_VMWRITE:
xen/arch/x86/hvm/vmx/vvmx.c +22 -0
diff -r 474da95963e2 xen/arch/x86/hvm/vmx/vvmx.c
@@ -536,3 +536,25 @@
     return X86EMUL_OKAY;
 }
 
+int nvmx_handle_vmptrst(struct cpu_user_regs *regs)
+{
+    struct vcpu *v = current;
+    struct vmx_inst_decoded decode;
+    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
+    unsigned long gpa = 0;
+    int rc;
+
+    rc = decode_vmx_inst(regs, &decode, &gpa, 0);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
+
+    gpa = nvcpu->nv_vvmcxaddr;
+
+    rc = hvm_copy_to_guest_virt(decode.mem, &gpa, decode.len, 0);
+    if ( rc != HVMCOPY_okay )
+        return X86EMUL_EXCEPTION;
+
+    vmreturn(regs, VMSUCCEED);
+    return X86EMUL_OKAY;
+}
+
xen/include/asm-x86/hvm/vmx/vvmx.h +1 -0
diff -r 474da95963e2 xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -109,6 +109,7 @@
 
 void nvmx_destroy_vmcs(struct vcpu *v);
 int nvmx_handle_vmptrld(struct cpu_user_regs *regs);
+int nvmx_handle_vmptrst(struct cpu_user_regs *regs);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#10 lore raw

RFC: Nested VMX patch series 07: vmclear

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +5 -1
diff -r 4c4c2256d301 xen/arch/x86/hvm/vmx/vmx.c
@@ -2445,6 +2445,11 @@
             update_guest_eip();
         break;
 
+    case EXIT_REASON_VMCLEAR:
+        if ( nvmx_handle_vmclear(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+ 
     case EXIT_REASON_VMPTRLD:
         if ( nvmx_handle_vmptrld(regs) == X86EMUL_OKAY )
             update_guest_eip();
@@ -2457,7 +2462,6 @@
 
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
-    case EXIT_REASON_VMCLEAR:
     case EXIT_REASON_VMLAUNCH:
     case EXIT_REASON_VMREAD:
     case EXIT_REASON_VMRESUME:
xen/arch/x86/hvm/vmx/vvmx.c +66 -0

93 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +1 -0
diff -r 4c4c2256d301 xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -110,6 +110,7 @@
 void nvmx_destroy_vmcs(struct vcpu *v);
 int nvmx_handle_vmptrld(struct cpu_user_regs *regs);
 int nvmx_handle_vmptrst(struct cpu_user_regs *regs);
+int nvmx_handle_vmclear(struct cpu_user_regs *regs);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#11 lore raw

RFC: Nested VMX patch series 08: vmwrite

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +5 -1
diff -r 135cec9c2aac xen/arch/x86/hvm/vmx/vmx.c
@@ -2460,12 +2460,16 @@
             update_guest_eip();
         break;
 
+    case EXIT_REASON_VMWRITE:
+        if ( nvmx_handle_vmwrite(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
     case EXIT_REASON_VMLAUNCH:
     case EXIT_REASON_VMREAD:
     case EXIT_REASON_VMRESUME:
-    case EXIT_REASON_VMWRITE:
     case EXIT_REASON_GETSEC:
     case EXIT_REASON_INVEPT:
     case EXIT_REASON_INVVPID:
xen/arch/x86/hvm/vmx/vvmx.c +24 -0
diff -r 135cec9c2aac xen/arch/x86/hvm/vmx/vvmx.c
@@ -624,3 +624,27 @@
     return X86EMUL_OKAY;
 }
 
+int nvmx_handle_vmwrite(struct cpu_user_regs *regs)
+{
+    struct vcpu *v = current;
+    struct vmx_inst_decoded decode;
+    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
+    u64 operandS, vmcs_encoding;
+
+    if ( decode_vmx_inst(regs, &decode, &operandS, 0)
+             != X86EMUL_OKAY )
+        return X86EMUL_EXCEPTION;
+
+    vmcs_encoding = reg_read(regs, decode.reg2);
+    __set_vvmcs(nvcpu->nv_vvmcx, vmcs_encoding, operandS);
+
+    if ( vmcs_encoding == IO_BITMAP_A || vmcs_encoding == IO_BITMAP_A_HIGH )
+        __map_io_bitmap (v, IO_BITMAP_A);
+    else if ( vmcs_encoding == IO_BITMAP_B || 
+              vmcs_encoding == IO_BITMAP_B_HIGH )
+        __map_io_bitmap (v, IO_BITMAP_B);
+
+    vmreturn(regs, VMSUCCEED);
+    return X86EMUL_OKAY;
+}
+
xen/include/asm-x86/hvm/vmx/vvmx.h +1 -0
diff -r 135cec9c2aac xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -111,6 +111,7 @@
 int nvmx_handle_vmptrld(struct cpu_user_regs *regs);
 int nvmx_handle_vmptrst(struct cpu_user_regs *regs);
 int nvmx_handle_vmclear(struct cpu_user_regs *regs);
+int nvmx_handle_vmwrite(struct cpu_user_regs *regs);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#12 lore raw

RE: RFC: Nested VMX patch series 09: vmread

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +5 -1
diff -r 4838d3cb1e85 xen/arch/x86/hvm/vmx/vmx.c
@@ -2460,6 +2460,11 @@
             update_guest_eip();
         break;
 
+    case EXIT_REASON_VMREAD:
+        if ( nvmx_handle_vmread(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+ 
     case EXIT_REASON_VMWRITE:
         if ( nvmx_handle_vmwrite(regs) == X86EMUL_OKAY )
             update_guest_eip();
@@ -2468,7 +2473,6 @@
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
     case EXIT_REASON_VMLAUNCH:
-    case EXIT_REASON_VMREAD:
     case EXIT_REASON_VMRESUME:
     case EXIT_REASON_GETSEC:
     case EXIT_REASON_INVEPT:
xen/arch/x86/hvm/vmx/vvmx.c +57 -0

75 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +1 -0
diff -r 4838d3cb1e85 xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -111,6 +111,7 @@
 int nvmx_handle_vmptrld(struct cpu_user_regs *regs);
 int nvmx_handle_vmptrst(struct cpu_user_regs *regs);
 int nvmx_handle_vmclear(struct cpu_user_regs *regs);
+int nvmx_handle_vmread(struct cpu_user_regs *regs);
 int nvmx_handle_vmwrite(struct cpu_user_regs *regs);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#13 lore raw

RFC: Nested VMX patch series 10: vmcs switching API

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmcs.c +39 -0
diff -r e6ae904dc440 xen/arch/x86/hvm/vmx/vmcs.c
@@ -669,6 +669,38 @@
     }
 }
 
+/*
+ * Switch VMCS between layer 1 & 2 guest
+ */
+void vmx_vmcs_switch(struct vcpu *v,
+                             struct vmcs_struct *from,
+                             struct vmcs_struct *to)
+{
+    /* no foreign access */
+    if ( unlikely(v != current) )
+        return;
+
+    if ( unlikely(current->arch.hvm_vmx.vmcs != from) )
+        return;
+
+    spin_lock(&v->arch.hvm_vmx.vmcs_lock);
+
+    __vmpclear(virt_to_maddr(from));
+    __vmptrld(virt_to_maddr(to));
+
+    v->arch.hvm_vmx.vmcs = to;
+    v->arch.hvm_vmx.launched = 0;
+    this_cpu(current_vmcs) = to;
+
+    if ( v->arch.hvm_vmx.hostenv_migrated )
+    {
+        v->arch.hvm_vmx.hostenv_migrated = 0;
+        vmx_set_host_env(v);
+    }
+
+    spin_unlock(&v->arch.hvm_vmx.vmcs_lock);
+}
+
 static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
@@ -1078,6 +1110,13 @@
         hvm_migrate_timers(v);
         hvm_migrate_pirqs(v);
         vmx_set_host_env(v);
+        /*
+         * Both n1 VMCS and n2 VMCS need to update the host environment after 
+         * VCPU migration. The environment of current VMCS is updated in place,
+         * but the action of another VMCS is deferred till it is switched in.
+         */
+        v->arch.hvm_vmx.hostenv_migrated = 1;
+
         hvm_asid_flush_vcpu(v);
     }
 
xen/include/asm-x86/hvm/vmx/vmcs.h +4 -0
diff -r e6ae904dc440 xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -123,6 +123,7 @@
     struct segment_register vm86_saved_seg[x86_seg_tr + 1];
     /* Remember EFLAGS while in virtual 8086 mode */
     uint32_t             vm86_saved_eflags;
+    int                  hostenv_migrated;
 };
 
 int vmx_create_vmcs(struct vcpu *v);
@@ -390,6 +391,9 @@
 int vmx_write_guest_msr(u32 msr, u64 val);
 int vmx_add_guest_msr(u32 msr);
 int vmx_add_host_load_msr(u32 msr);
+void vmx_vmcs_switch(struct vcpu *v,
+                      struct vmcs_struct *from,
+                      struct vmcs_struct *to);
 
 #endif /* ASM_X86_HVM_VMX_VMCS_H__ */
#14 lore raw

RFC: Nested VMX patch series 11: vmresume

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +15 -2
diff -r 599f4aacabeb xen/arch/x86/hvm/vmx/vmx.c
@@ -2142,6 +2142,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
+     */
+    vcpu_nestedhvm(v).nv_vmswitch_in_progress = 0;
+
     if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
         return vmx_failed_vmentry(exit_reason, regs);
 
@@ -2457,10 +2462,18 @@
             update_guest_eip();
         break;
 
+    case EXIT_REASON_VMLAUNCH:
+        if ( nvmx_handle_vmlaunch(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
+    case EXIT_REASON_VMRESUME:
+        if ( nvmx_handle_vmresume(regs) == X86EMUL_OKAY )
+            update_guest_eip();
+        break;
+
     case EXIT_REASON_MWAIT_INSTRUCTION:
     case EXIT_REASON_MONITOR_INSTRUCTION:
-    case EXIT_REASON_VMLAUNCH:
-    case EXIT_REASON_VMRESUME:
     case EXIT_REASON_GETSEC:
     case EXIT_REASON_INVEPT:
     case EXIT_REASON_INVVPID:
xen/arch/x86/hvm/vmx/vvmx.c +35 -0
diff -r 599f4aacabeb xen/arch/x86/hvm/vmx/vvmx.c
@@ -283,6 +283,13 @@
     }
 }
 
+static inline u32 __n2_exec_control(struct vcpu *v)
+{
+    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
+
+    return __get_vvmcs(nvcpu->nv_vvmcx, CPU_BASED_VM_EXEC_CONTROL);
+}
+
 static int vmx_inst_check_privilege(struct cpu_user_regs *regs, int vmxop_check)
 {
     struct vcpu *v = current;
@@ -470,6 +477,34 @@
     return X86EMUL_OKAY;
 }
 
+int nvmx_handle_vmresume(struct cpu_user_regs *regs)
+{
+    struct vcpu *v = current;
+    struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
+    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
+    int rc;
+
+    rc = vmx_inst_check_privilege(regs, 0);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
+
+    /* check VMCS is valid and IO BITMAP is set */
+    if ( (nvcpu->nv_vvmcxaddr != VMCX_EADDR) &&
+            ((nvmx->iobitmap[0] && nvmx->iobitmap[1]) ||
+            !(__n2_exec_control(v) & CPU_BASED_ACTIVATE_IO_BITMAP) ) )
+        nvcpu->nv_vmentry_pending = 1;
+    else
+        vmreturn(regs, VMFAIL_INVALID);
+
+    return X86EMUL_OKAY;
+}
+
+int nvmx_handle_vmlaunch(struct cpu_user_regs *regs)
+{
+    /* TODO: check for initial launch/resume */
+    return nvmx_handle_vmresume(regs);
+}
+
 int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
 {
     struct vcpu *v = current;
xen/include/asm-x86/hvm/vmx/vvmx.h +2 -0
diff -r 599f4aacabeb xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -103,6 +103,8 @@
 
 int nvmx_handle_vmread(struct cpu_user_regs *regs);
 int nvmx_handle_vmwrite(struct cpu_user_regs *regs);
+int nvmx_handle_vmresume(struct cpu_user_regs *regs);
+int nvmx_handle_vmlaunch(struct cpu_user_regs *regs);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#15 lore raw

RFC: Nested VMX patch series 12: shadow vmcs control

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +15 -4
diff -r 607ce7be0b5c xen/arch/x86/hvm/vmx/vmx.c
@@ -54,6 +54,7 @@
 #include <asm/xenoprof.h>
 #include <asm/debugger.h>
 #include <asm/apic.h>
+#include <asm/hvm/nestedhvm.h>
 
 enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised };
 
@@ -361,18 +362,28 @@
 
 void vmx_update_cpu_exec_control(struct vcpu *v)
 {
-    __vmwrite(CPU_BASED_VM_EXEC_CONTROL, v->arch.hvm_vmx.exec_control);
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+        nvmx_update_exec_control(v, v->arch.hvm_vmx.exec_control);
+    else
+        __vmwrite(CPU_BASED_VM_EXEC_CONTROL, v->arch.hvm_vmx.exec_control);
 }
 
 static void vmx_update_secondary_exec_control(struct vcpu *v)
 {
-    __vmwrite(SECONDARY_VM_EXEC_CONTROL,
-              v->arch.hvm_vmx.secondary_exec_control);
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+        nvmx_update_secondary_exec_control(v,
+            v->arch.hvm_vmx.secondary_exec_control);
+    else
+        __vmwrite(SECONDARY_VM_EXEC_CONTROL,
+                  v->arch.hvm_vmx.secondary_exec_control);
 }
 
 void vmx_update_exception_bitmap(struct vcpu *v)
 {
-    __vmwrite(EXCEPTION_BITMAP, v->arch.hvm_vmx.exception_bitmap);
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+        nvmx_update_exception_bitmap(v, v->arch.hvm_vmx.exception_bitmap);
+    else
+        __vmwrite(EXCEPTION_BITMAP, v->arch.hvm_vmx.exception_bitmap);
 }
 
 static int vmx_guest_x86_mode(struct vcpu *v)
xen/arch/x86/hvm/vmx/vvmx.c +88 -0

100 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +5 -0
diff -r 607ce7be0b5c xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -117,5 +117,10 @@
 int nvmx_handle_vmresume(struct cpu_user_regs *regs);
 int nvmx_handle_vmlaunch(struct cpu_user_regs *regs);
 
+void nvmx_update_exec_control(struct vcpu *v, unsigned long value);
+void nvmx_update_secondary_exec_control(struct vcpu *v,
+                                        unsigned long value);
+void nvmx_update_exception_bitmap(struct vcpu *v, unsigned long value);
+
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#16 lore raw

RFC: Nested VMX patch series 12: real VMCS switch

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/entry.S +1 -0
diff -r 091f56f71a32 xen/arch/x86/hvm/vmx/entry.S
@@ -119,6 +119,7 @@
 .globl vmx_asm_do_vmentry
 vmx_asm_do_vmentry:
         call vmx_intr_assist
+        call nvmx_switch_layed_guest
 
         get_current(bx)
         cli
xen/arch/x86/hvm/vmx/vvmx.c +397 -0

409 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +1 -0
diff -r 091f56f71a32 xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -121,6 +121,7 @@
 void nvmx_update_secondary_exec_control(struct vcpu *v,
                                         unsigned long value);
 void nvmx_update_exception_bitmap(struct vcpu *v, unsigned long value);
+asmlinkage void nvmx_switch_layed_guest(void);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#17 lore raw

RFC: Nested VMX patch series 14: exceptions

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/intr.c +96 -1
diff -r 3899dcd0005c xen/arch/x86/hvm/vmx/intr.c
@@ -35,6 +35,7 @@
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vpic.h>
 #include <asm/hvm/vlapic.h>
+#include <asm/hvm/nestedhvm.h>
 #include <public/hvm/ioreq.h>
 #include <asm/hvm/trace.h>
 
@@ -109,9 +110,100 @@
     }
 }
 
+/*
+ * Injecting interrupts for nested virtualization
+ *
+ *  When injecting virtual interrupts (originated from L0), there are
+ *  two major possibilities, within L1 context and within L2 context
+ *   1. L1 context (in_nesting == 0)
+ *     Everything is the same as without nested, check RFLAGS.IF to
+ *     see if the injection can be done, using VMCS to inject the
+ *     interrupt
+ *
+ *   2. L2 context (in_nesting == 1)
+ *     Causes a virtual VMExit, RFLAGS.IF is ignored, whether to ack
+ *     irq according to intr_ack_on_exit, shouldn't block normally,
+ *     except for:
+ *    a. context transition
+ *     interrupt needs to be blocked at virtual VMEntry time
+ *    b. L2 idtv reinjection
+ *     if L2 idtv is handled within L0 (e.g. L0 shadow page fault),
+ *     it needs to be reinjected without exiting to L1, interrupt
+ *     injection should be blocked as well at this point.
+ *
+ *  Unfortunately, interrupt blocking in L2 won't work with simple
+ *  intr_window_open (which depends on L2's IF). To solve this,
+ *  the following algorithm can be used:
+ *   v->arch.hvm_vmx.exec_control.VIRTUAL_INTR_PENDING now denotes
+ *   only L0 control, physical control may be different from it.
+ *       - if in L1, it behaves normally, intr window is written
+ *         to physical control as it is
+ *       - if in L2, replace it to MTF (or NMI window) if possible
+ *       - if MTF/NMI window is not used, intr window can still be
+ *         used but may have negative impact on interrupt performance.
+ */
+
 enum hvm_intblk nvmx_intr_blocked(struct vcpu *v)
 {
-    return hvm_intblk_none;
+    int r = hvm_intblk_none;
+    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
+
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
+        if ( nvcpu->nv_vmexit_pending ||
+             nvcpu->nv_vmswitch_in_progress ||
+             (__vmread(VM_ENTRY_INTR_INFO) & INTR_INFO_VALID_MASK) )
+            r = hvm_intblk_rflags_ie;
+    }
+    else if ( nvcpu->nv_vmentry_pending )
+        r = hvm_intblk_rflags_ie;
+
+    return r;
+}
+
+static int nvmx_intr_intercept(struct vcpu *v, struct hvm_intack intack)
+{
+    u32 exit_ctrl;
+
+    /*
+     * TODO:
+     *   - if L1 intr-window exiting == 0
+     *   - vNMI
+     */
+
+    if ( nvmx_intr_blocked(v) != hvm_intblk_none )
+    {
+        enable_intr_window(v, intack);
+        return 1;
+    }
+
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
+        if ( intack.source == hvm_intsrc_pic ||
+                 intack.source == hvm_intsrc_lapic )
+        {
+            vmx_inject_extint(intack.vector);
+
+            exit_ctrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx,
+                            VM_EXIT_CONTROLS);
+            if ( exit_ctrl & VM_EXIT_ACK_INTR_ON_EXIT )
+            {
+                /* for now, duplicate the ack path in vmx_intr_assist */
+                hvm_vcpu_ack_pending_irq(v, intack);
+                pt_intr_post(v, intack);
+
+                intack = hvm_vcpu_has_pending_irq(v);
+                if ( unlikely(intack.source != hvm_intsrc_none) )
+                    enable_intr_window(v, intack);
+            }
+            else
+                enable_intr_window(v, intack);
+
+            return 1;
+        }
+    }
+
+    return 0;
 }
 
 asmlinkage void vmx_intr_assist(void)
@@ -137,6 +229,9 @@
         if ( likely(intack.source == hvm_intsrc_none) )
             goto out;
 
+        if ( unlikely(nvmx_intr_intercept(v, intack)) )
+            goto out;
+
         intblk = hvm_interrupt_blocked(v, intack);
         if ( intblk == hvm_intblk_tpr )
         {
xen/arch/x86/hvm/vmx/vmx.c +74 -3

129 lines not on this page · raw message

xen/arch/x86/hvm/vmx/vvmx.c +96 -0

123 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +3 -0
diff -r 3899dcd0005c xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -48,6 +48,8 @@
 uint64_t nvmx_vcpu_hostcr3(struct vcpu *v);
 uint32_t nvmx_vcpu_asid(struct vcpu *v);
 enum hvm_intblk nvmx_intr_blocked(struct vcpu *v);
+int nvmx_intercepts_exception(struct vcpu *v, 
+                               unsigned int trap, int error_code);
 
 int nvmx_handle_vmxon(struct cpu_user_regs *regs);
 int nvmx_handle_vmxoff(struct cpu_user_regs *regs);
@@ -121,6 +123,7 @@
                                         unsigned long value);
 void nvmx_update_exception_bitmap(struct vcpu *v, unsigned long value);
 asmlinkage void nvmx_switch_layed_guest(void);
+void nvmx_idtv_handling(void);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#18 lore raw

RFC: Nested VMX patch series 15: exit from n2 guest

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +10 -0
diff -r 8a54c14b7bbd xen/arch/x86/hvm/vmx/vmx.c
@@ -943,6 +943,10 @@
 static void vmx_set_tsc_offset(struct vcpu *v, u64 offset)
 {
     vmx_vmcs_enter(v);
+
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+        offset += nvmx_get_tsc_offset(v);
+
     __vmwrite(TSC_OFFSET, offset);
 #if defined (__i386__)
     __vmwrite(TSC_OFFSET_HIGH, offset >> 32);
@@ -2203,6 +2207,11 @@
      * any pending vmresume has really happened
      */
     vcpu_nestedhvm(v).nv_vmswitch_in_progress = 0;
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
+        if ( nvmx_n2_vmexit_handler(regs, exit_reason) )
+            goto out;
+    }
 
     if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
         return vmx_failed_vmentry(exit_reason, regs);
@@ -2605,6 +2614,7 @@
         break;
     }
 
+out:
     if ( nestedhvm_vcpu_in_guestmode(v) )
         nvmx_idtv_handling();
 }
xen/arch/x86/hvm/vmx/vvmx.c +272 -1

306 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +3 -0
diff -r 8a54c14b7bbd xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -123,6 +123,9 @@
 void nvmx_update_exception_bitmap(struct vcpu *v, unsigned long value);
 asmlinkage void nvmx_switch_layed_guest(void);
 void nvmx_idtv_handling(void);
+u64 nvmx_get_tsc_offset(struct vcpu *v);
+int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
+                          unsigned int exit_reason);
 
 #endif /* __ASM_X86_HVM_VVMX_H__ */
#19 lore raw

RE: RFC: Nested VMX patch series 16: fpu

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vvmx.c +12 -1
diff -r 7c75c8a9da05 xen/arch/x86/hvm/vmx/vvmx.c
@@ -712,6 +712,9 @@
     regs->rsp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->rflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
 
+    /* updating host cr0 to sync TS bit */
+    __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0);
+
     /* TODO: EPT_POINTER */
 }
 
@@ -851,6 +854,9 @@
     regs->rsp = __get_vvmcs(nvcpu->nv_vvmcx, HOST_RSP);
     regs->rflags = __vmread(GUEST_RFLAGS);
 
+    /* updating host cr0 to sync TS bit */
+    __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0);
+
     vmreturn(regs, VMSUCCEED);
 }
 
@@ -948,13 +954,18 @@
 
         /*
          * decided by L0 and L1 exception bitmap, if the vetor is set by
-         * both, L0 has priority on #PF, L1 has priority on others
+         * both, L0 has priority on #PF and #NM, L1 has priority on others
          */
         if ( vector == TRAP_page_fault )
         {
             if ( paging_mode_hap(v->domain) )
                 nvcpu->nv_vmexit_pending = 1;
         }
+        else if ( vector == TRAP_no_device )
+        {
+            if ( v->fpu_dirtied )
+                nvcpu->nv_vmexit_pending = 1;
+        }
         else if ( (intr_info & valid_mask) == valid_mask )
         {
             exec_bitmap =__get_vvmcs(nvcpu->nv_vvmcx, EXCEPTION_BITMAP);
#20 lore raw

RFC: Nested VMX patch series 17: cr4

In reply to xen.org

Thx, Eddie

xen/include/asm-x86/cpufeature.h +2 -0
diff -r 117cc0237936 xen/include/asm-x86/cpufeature.h
@@ -216,6 +216,8 @@
 
 #define cpu_has_svm		boot_cpu_has(X86_FEATURE_SVM)
 
+#define cpu_has_vmx		boot_cpu_has(X86_FEATURE_VMXE)
+
 #endif /* __ASM_I386_CPUFEATURE_H */
 
 /* 
xen/include/asm-x86/hvm/hvm.h +2 -0
diff -r 117cc0237936 xen/include/asm-x86/hvm/hvm.h
@@ -312,6 +312,8 @@
         X86_CR4_DE  | X86_CR4_PSE | X86_CR4_PAE |       \
         X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE |       \
         X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT |           \
+	((nestedhvm_enabled((_v)->domain) &&            \
+          cpu_has_vmx) ? X86_CR4_VMXE : 0)  |       	\
         (xsave_enabled(_v) ? X86_CR4_OSXSAVE : 0))))
 
 /* These exceptions must always be intercepted. */
#21 lore raw

RFC: Nested VMX patch series 18: capability

In reply to xen.org

Thx, Eddie

xen/arch/x86/hvm/vmx/vmx.c +10 -4
diff -r 6391fb6a41fb xen/arch/x86/hvm/vmx/vmx.c
@@ -1728,8 +1728,11 @@
         *msr_content |= (u64)__vmread(GUEST_IA32_DEBUGCTL_HIGH) << 32;
 #endif
         break;
-    case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_PROCBASED_CTLS2:
-        goto gp_fault;
+    case IA32_FEATURE_CONTROL_MSR:
+    case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_TRUE_ENTRY_CTLS:
+        if ( !nvmx_msr_read_intercept(msr, msr_content) )
+            goto gp_fault;
+        break;
     case MSR_IA32_MISC_ENABLE:
         rdmsrl(MSR_IA32_MISC_ENABLE, *msr_content);
         /* Debug Trace Store is not supported. */
@@ -1890,8 +1893,11 @@
 
         break;
     }
-    case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_PROCBASED_CTLS2:
-        goto gp_fault;
+    case IA32_FEATURE_CONTROL_MSR:
+    case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_TRUE_ENTRY_CTLS:
+        if ( !nvmx_msr_write_intercept(msr, msr_content) )
+            goto gp_fault;
+        break;
     default:
         if ( vpmu_do_wrmsr(msr, msr_content) )
             return X86EMUL_OKAY;
xen/arch/x86/hvm/vmx/vvmx.c +88 -0

94 lines not on this page · raw message

xen/include/asm-x86/hvm/vmx/vvmx.h +4 -0
diff -r 6391fb6a41fb xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -108,6 +108,10 @@
 int nvmx_handle_vmwrite(struct cpu_user_regs *regs);
 int nvmx_handle_vmresume(struct cpu_user_regs *regs);
 int nvmx_handle_vmlaunch(struct cpu_user_regs *regs);
+int nvmx_msr_read_intercept(unsigned int msr,
+                                u64 *msr_content);
+int nvmx_msr_write_intercept(unsigned int msr,
+                                 u64 msr_content);
 
 void nvmx_update_exec_control(struct vcpu *v, unsigned long value);
 void nvmx_update_secondary_exec_control(struct vcpu *v,
#22 lore raw

RFC: Nested VMX patch series 00

In reply to xen.org

Keir/Tim:
Here is the nested VMX support series for comments. The current solution works with host shadow page table. The virtual EPT support will come soon.

Thx, Eddie

#23 lore raw

Re: RFC: Nested VMX patch series 00

Please don't start new threads by reply to an old, unrelated mail -- it confuses threading.

Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments. The current
solution works with host shadow page table. The virtual EPT support will come soon.

I'm neither Tim nor Keir but the documentary aspects of this series seem rather insufficient IMHO, even for an RFC.

You summary lines are mostly verbose boilerplate with very little actual information and the changelog entries do not generally describe the change either. Lastly you haven't included a Signed-off-by on at least some of the patches (maybe that's OK for an RFC but you did sign off some of them).

Also there are two patch 5's and two patch 12's, a tool such as the hg email extension would help avoid that sort of thing.

Ian.

#5 lore raw

Re: RFC: Nested VMX patch series 02: wrap APIs

In reply to Dong, Eddie
Quoted 10 lines · Eddie

Wrap for common nested APIs.
Thx, Eddie

diff -r 70ee714947fb xen/arch/x86/hvm/hvm.c

xen/arch/x86/hvm/hvm.c line 3506

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +1 -1
@@ -3502,7 +3502,7 @@
                  /* Remove the check below once we have
                   * shadow-on-shadow.
                   */
-                if ( !paging_mode_hap(d)&&  a.value )
+                if ( cpu_has_svm&&  !paging_mode_hap(d)&&  a.value )
                      rc = -EINVAL;

Are you going to implement shadow-on-shadow ?

Christoph

Quoted 165 lines
xen/arch/x86/hvm/hvm.c +0 -0
                  /* Set up NHVM state for any vcpus that are already up */
                  if ( !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )

diff -r 70ee714947fb xen/arch/x86/hvm/vmx/Makefile

xen/arch/x86/hvm/vmx/Makefile +1 -0
@@ -4,3 +4,4 @@
  obj-y += vmcs.o
  obj-y += vmx.o
  obj-y += vpmu_core2.o
+obj-y += vvmx.o

diff -r 70ee714947fb xen/arch/x86/hvm/vmx/intr.c

xen/arch/x86/hvm/vmx/intr.c +5 -0
@@ -109,6 +109,11 @@
      }
  }
 
+enum hvm_intblk nvmx_intr_blocked(struct vcpu *v)
+{
+    return hvm_intblk_none;
+}
+
  asmlinkage void vmx_intr_assist(void)
  {
      struct hvm_intack intack;

diff -r 70ee714947fb xen/arch/x86/hvm/vmx/vmx.c

xen/arch/x86/hvm/vmx/vmx.c +8 -1
@@ -1407,7 +1407,14 @@
      .invlpg_intercept     = vmx_invlpg_intercept,
      .set_uc_mode          = vmx_set_uc_mode,
      .set_info_guest       = vmx_set_info_guest,
-    .set_rdtsc_exiting    = vmx_set_rdtsc_exiting
+    .set_rdtsc_exiting    = vmx_set_rdtsc_exiting,
+    .nhvm_vcpu_initialise = nvmx_vcpu_initialise,
+    .nhvm_vcpu_destroy    = nvmx_vcpu_destroy,
+    .nhvm_vcpu_reset      = nvmx_vcpu_reset,
+    .nhvm_vcpu_guestcr3   = nvmx_vcpu_guestcr3,
+    .nhvm_vcpu_hostcr3    = nvmx_vcpu_hostcr3,
+    .nhvm_vcpu_asid       = nvmx_vcpu_asid,
+    .nhvm_intr_blocked    = nvmx_intr_blocked
  };
 
  struct hvm_function_table * __init start_vmx(void)

diff -r 70ee714947fb xen/arch/x86/hvm/vmx/vvmx.c

xen/arch/x86/hvm/vmx/vvmx.c new file +93 -0
@@ -0,0 +1,93 @@
+/*
+ * vvmx.c: Support virtual VMX for nested virtualization.
+ *
+ * Copyright (c) 2010, Intel Corporation.
+ * Author: Qing He<[email protected]>
+ *         Eddie Dong<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+
+#include<xen/config.h>
+#include<asm/types.h>
+#include<asm/p2m.h>
+#include<asm/hvm/vmx/vmx.h>
+#include<asm/hvm/vmx/vvmx.h>
+
+int nvmx_vcpu_initialise(struct vcpu *v)
+{
+    struct nestedvmx *nvmx =&vcpu_2_nvmx(v);
+    struct nestedvcpu *nvcpu =&vcpu_nestedhvm(v);
+
+    nvcpu->nv_n2vmcx = alloc_xenheap_page();
+    if ( !nvcpu->nv_n2vmcx )
+    {
+        gdprintk(XENLOG_ERR, "nest: allocation for shadow vmcs failed\n");
+	goto out;
+    }
+    nvmx->vmxon_region_pa = 0;
+    nvcpu->nv_vvmcx = NULL;
+    nvcpu->nv_vvmcxaddr = VMCX_EADDR;
+    nvmx->intr.intr_info = 0;
+    nvmx->intr.error_code = 0;
+    nvmx->iobitmap[0] = NULL;
+    nvmx->iobitmap[1] = NULL;
+    return 0;
+out:
+    return -ENOMEM;
+}
+
+void nvmx_vcpu_destroy(struct vcpu *v)
+{
+    struct nestedvcpu *nvcpu =&vcpu_nestedhvm(v);
+
+    if ( nvcpu->nv_n2vmcx ) {
+        __vmpclear(virt_to_maddr(nvcpu->nv_n2vmcx));
+        free_xenheap_page(nvcpu->nv_n2vmcx);
+        nvcpu->nv_n2vmcx = NULL;
+    }
+    if ( nvcpu->nv_vvmcx ) {
+        unmap_domain_page_global(nvcpu->nv_vvmcx);
+        nvcpu->nv_vvmcx == NULL;
+    }
+    nvcpu->nv_vvmcxaddr = VMCX_EADDR;
+}
+
+int nvmx_vcpu_reset(struct vcpu *v)
+{
+    return 0;
+}
+
+uint64_t nvmx_vcpu_guestcr3(struct vcpu *v)
+{
+    /* TODO */
+    ASSERT(0);
+    return 0;
+}
+
+uint64_t nvmx_vcpu_hostcr3(struct vcpu *v)
+{
+    /* TODO */
+    ASSERT(0);
+    return 0;
+}
+
+uint32_t nvmx_vcpu_asid(struct vcpu *v)
+{
+    /* TODO */
+    ASSERT(0);
+    return 0;
+}
+

diff -r 70ee714947fb xen/include/asm-x86/hvm/vmx/vvmx.h

xen/include/asm-x86/hvm/vmx/vvmx.h +9 -0
@@ -37,5 +37,14 @@
 
  #define nvcpu_2_nvmx(nv)	((*(nv)).u.nvmx)
  #define vcpu_2_nvmx(v)	(nvcpu_2_nvmx(&vcpu_nestedhvm(v)))
+
+int nvmx_vcpu_initialise(struct vcpu *v);
+void nvmx_vcpu_destroy(struct vcpu *v);
+int nvmx_vcpu_reset(struct vcpu *v);
+uint64_t nvmx_vcpu_guestcr3(struct vcpu *v);
+uint64_t nvmx_vcpu_hostcr3(struct vcpu *v);
+uint32_t nvmx_vcpu_asid(struct vcpu *v);
+enum hvm_intblk nvmx_intr_blocked(struct vcpu *v);
+
  #endif /* __ASM_X86_HVM_VVMX_H__ */
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#24 lore raw

Re: RFC: Nested VMX patch series 00

In reply to Ian Campbell
Quoted 12 lines · Ian Campbell

Please don't start new threads by reply to an old, unrelated mail -- it confuses threading.

Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments. The current
solution works with host shadow page table. The virtual EPT support will come soon.

I'm neither Tim nor Keir but the documentary aspects of this series seem rather insufficient IMHO, even for an RFC.

Quoted 8 lines

You summary lines are mostly verbose boilerplate with very little actual information and the changelog entries do not generally describe the change either. Lastly you haven't included a Signed-off-by on at least some of the patches (maybe that's OK for an RFC but you did sign off some of them).

Also there are two patch 5's and two patch 12's, a tool such as the hg email extension would help avoid that sort of thing.

Yes, 'hg email' does a good job of posting large patch series. Also, if you can add

[diff]
showfunc = True

to your ~/.hgrc, it makes big patches much easier to review.

Cheers,

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#25 lore raw

Re: RFC: Nested VMX patch series 00

In reply to Dong, Eddie
Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments.
The current solution works with host shadow page table. The virtual EPT support will come soon.

I am surprised that shadow-on-shadow works w/o touching anything in xen/arch/x86/mm/*

Christoph

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#26 lore raw

Re: RFC: Nested VMX patch series 00

Quoted 8 lines · Christoph Egger
Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments.
The current solution works with host shadow page table. The virtual EPT support will come soon.

I am surprised that shadow-on-shadow works w/o touching anything in xen/arch/x86/mm/*

What do you think should break? One major thing was that we didn't properly report invalid PTE bits, but that's been fixed.

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#27 lore raw

Re: RFC: Nested VMX patch series 00

Quoted 7 lines · Tim Deegan
Quoted 6 lines · Christoph Egger
Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments.
The current solution works with host shadow page table. The virtual EPT support will come soon.

Quoted 5 lines
Quoted 2 lines

I am surprised that shadow-on-shadow works w/o touching anything in xen/arch/x86/mm/*

What do you think should break? One major thing was that we didn't properly report invalid PTE bits, but that's been fixed.

I thought some code to switch forth and back between two shadow page tables needs to be added at least (one to run l1 guest and one to run l2 guest).

Christoph

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#28 lore raw

Re: RFC: Nested VMX patch series 00

Quoted 11 lines · Christoph Egger
Quoted 10 lines · Tim Deegan
Quoted 8 lines · Christoph Egger
Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments.
The current solution works with host shadow page table. The virtual EPT support will come soon.

I am surprised that shadow-on-shadow works w/o touching anything in xen/arch/x86/mm/*

Quoted 7 lines
Quoted 2 lines

What do you think should break? One major thing was that we didn't properly report invalid PTE bits, but that's been fixed.

I thought some code to switch forth and back between two shadow page tables needs to be added at least (one to run l1 guest and one to run
l2 guest).

No need - as long as the n1 guest provides valid pagetables (which may themselves be shadows of n2 pagetables), all n0 has to do is shadow them (again).

Cheers,

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#29 lore raw

RE: RFC: Nested VMX patch series 00

Quoted 8 lines
Quoted 4 lines

I thought some code to switch forth and back between two shadow page tables needs to be added at least (one to run l1 guest and one to run
l2 guest).

No need - as long as the n1 guest provides valid pagetables (which may themselves be shadows of n2 pagetables), all n0 has to do is shadow them (again).

Yes. The reason to use shadow on shadow for now is to reduce the rebase patch size. It is already too large :(

Thx, Eddie

#30 lore raw

RE: RFC: Nested VMX patch series 00

In reply to Christoph Egger
Quoted 14 lines

From: Christoph Egger
Sent: Wednesday, June 01, 2011 6:35 PM

Quoted 10 lines · Tim Deegan
Quoted 8 lines · Christoph Egger
Quoted 4 lines · Eddie

Keir/Tim:
Here is the nested VMX support series for comments.
The current solution works with host shadow page table. The virtual EPT support will come soon.

I am surprised that shadow-on-shadow works w/o touching anything in xen/arch/x86/mm/*

Quoted 9 lines
Quoted 2 lines

What do you think should break? One major thing was that we didn't properly report invalid PTE bits, but that's been fixed.

I thought some code to switch forth and back between two shadow page tables needs to be added at least (one to run l1 guest and one to run l2 guest).

Christoph

as long as correctly emulating HOST_CR3 and GUEST_CR3 fields as L1 cr3 switch action, you don't need any other special logic.

Thanks
Kevin