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

[Xen-changelog] [xen staging] x86/vvmx: Fix nested virt on VMCS-Shadow capable hardware



commit 6a4a62534853b4d20b44990e0d56c665b1ff55ae
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jul 30 15:19:04 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Aug 12 15:50:10 2019 +0100

    x86/vvmx: Fix nested virt on VMCS-Shadow capable hardware
    
    c/s e9986b0dd "x86/vvmx: Simplify per-CPU memory allocations" had the wrong
    indirection on its pointer check in nvmx_cpu_up_prepare(), causing the
    VMCS-shadowing buffer never be allocated.  Fix it.
    
    This in turn results in a massive quantity of logspam, as every virtual
    vmentry/exit hits both gdprintk()s in the *_bulk() functions.
    
    Switch these to using printk_once(), but still only in debug builds.  The 
size
    of the buffer is chosen at compile time, so complaining about it repeatedly 
is
    of no benefit.
    
    Finally, drop the runtime NULL pointer checks.  It is not terribly 
appropriate
    to be repeatedly checking infrastructure which is set up from start-of-day,
    and in this case, actually hid the above bug.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vvmx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 332623d006..fdf449bfd1 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -43,7 +43,7 @@ int nvmx_cpu_up_prepare(unsigned int cpu)
     uint64_t **vvmcs_buf;
 
     if ( cpu_has_vmx_vmcs_shadowing &&
-         (vvmcs_buf = &per_cpu(vvmcs_buf, cpu)) == NULL )
+         *(vvmcs_buf = &per_cpu(vvmcs_buf, cpu)) == NULL )
     {
         void *ptr = xzalloc_array(uint64_t, VMCS_BUF_SIZE);
 
@@ -922,11 +922,11 @@ static void vvmcs_to_shadow_bulk(struct vcpu *v, unsigned 
int n,
     if ( !cpu_has_vmx_vmcs_shadowing )
         goto fallback;
 
-    if ( !value || n > VMCS_BUF_SIZE )
+    if ( n > VMCS_BUF_SIZE )
     {
-        gdprintk(XENLOG_DEBUG, "vmcs sync fall back to non-bulk mode, "
-                 "buffer: %p, buffer size: %d, fields number: %d.\n",
-                 value, VMCS_BUF_SIZE, n);
+        if ( IS_ENABLED(CONFIG_DEBUG) )
+            printk_once(XENLOG_ERR "%pv VMCS sync too many fields %u\n",
+                        v, n);
         goto fallback;
     }
 
@@ -962,11 +962,11 @@ static void shadow_to_vvmcs_bulk(struct vcpu *v, unsigned 
int n,
     if ( !cpu_has_vmx_vmcs_shadowing )
         goto fallback;
 
-    if ( !value || n > VMCS_BUF_SIZE )
+    if ( n > VMCS_BUF_SIZE )
     {
-        gdprintk(XENLOG_DEBUG, "vmcs sync fall back to non-bulk mode, "
-                 "buffer: %p, buffer size: %d, fields number: %d.\n",
-                 value, VMCS_BUF_SIZE, n);
+        if ( IS_ENABLED(CONFIG_DEBUG) )
+            printk_once(XENLOG_ERR "%pv VMCS sync too many fields %u\n",
+                        v, n);
         goto fallback;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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