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

[Xen-devel] [PATCH v15 14/14] x86/domctl: Don't pause the whole domain if only getting vcpu state


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
  • Date: Fri, 3 Aug 2018 16:53:51 +0300
  • Cc: wei.liu2@xxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, ian.jackson@xxxxxxxxxxxxx, paul.durrant@xxxxxxxxxx, jbeulich@xxxxxxxx, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Fri, 03 Aug 2018 13:54:31 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=Tf8gMdc6cq8XJf0o/FoCa2GVh3QsqCH2tZFP3xR/hXjf2WudDrJPfeJZoVq2Av1jS1V+/AXiri+h0WuN+M97kEshR32VhbYXIigCyeH7uctEb5cnIBRDG7OWDjuuRRR184Tp+zx4LklWFY4OuBR23yG9qiTHYmx5glXo5tiDtQ90VtKvwD+MnNurYyRgEBT+qCroaFpozOMnW3zJuQhP2+NqzgRO1Q/wQKtFdIFos3/b13XObIdv4To/GDVp1EmrCHOlAdkaiVFHoMri02E/cmT2sveE2nuRJeh3L7OXzVE3kaUzXx4TF4CBRcAl7hqF0XnNfFzDG6VaLIBs6GOYZg==; h=Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References;
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This patch is focused on moving changing hvm_save_one() to save one
typecode from one vcpu and now that the save functions get data from a
single vcpu we can pause the specific vcpu instead of the domain.

Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/domctl.c   |  4 ++--
 xen/arch/x86/hvm/save.c | 41 +++++++++++++++++------------------------
 2 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 8fbbf3a..bd6ba62 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -591,12 +591,12 @@ long arch_do_domctl(
              !is_hvm_domain(d) )
             break;
 
-        domain_pause(d);
+        vcpu_pause(d->vcpu[domctl->u.hvmcontext_partial.instance]);
         ret = hvm_save_one(d, domctl->u.hvmcontext_partial.type,
                            domctl->u.hvmcontext_partial.instance,
                            domctl->u.hvmcontext_partial.buffer,
                            &domctl->u.hvmcontext_partial.bufsz);
-        domain_unpause(d);
+        vcpu_unpause(d->vcpu[domctl->u.hvmcontext_partial.instance]);
 
         if ( !ret )
             copyback = true;
diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
index 43eb582..28f3b57 100644
--- a/xen/arch/x86/hvm/save.c
+++ b/xen/arch/x86/hvm/save.c
@@ -138,6 +138,7 @@ int hvm_save_one(struct domain *d, unsigned int typecode, 
unsigned int instance,
     int rv;
     hvm_domain_context_t ctxt = { };
     const struct hvm_save_descriptor *desc;
+    uint32_t off = 0;
 
     if ( d->is_dying ||
          typecode > HVM_SAVE_CODE_MAX ||
@@ -146,8 +147,6 @@ int hvm_save_one(struct domain *d, unsigned int typecode, 
unsigned int instance,
         return -EINVAL;
 
     ctxt.size = hvm_sr_handlers[typecode].size;
-    if ( hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU )
-        ctxt.size *= d->max_vcpus;
     ctxt.data = xmalloc_bytes(ctxt.size);
     if ( !ctxt.data )
         return -ENOMEM;
@@ -157,29 +156,23 @@ int hvm_save_one(struct domain *d, unsigned int typecode, 
unsigned int instance,
                d->domain_id, typecode, rv);
     else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
     {
-        uint32_t off;
-
-        for ( off = 0; off <= (ctxt.cur - sizeof(*desc)); off += desc->length )
+        desc = (void *)(ctxt.data + off);
+        /* Move past header */
+        off += sizeof(*desc);
+        if ( ctxt.cur < desc->length ||
+             off > ctxt.cur - desc->length )
+            rv = -EFAULT;
+        if ( instance == desc->instance )
         {
-            desc = (void *)(ctxt.data + off);
-            /* Move past header */
-            off += sizeof(*desc);
-            if ( ctxt.cur < desc->length ||
-                 off > ctxt.cur - desc->length )
-                break;
-            if ( instance == desc->instance )
-            {
-                rv = 0;
-                if ( guest_handle_is_null(handle) )
-                    *bufsz = desc->length;
-                else if ( *bufsz < desc->length )
-                    rv = -ENOBUFS;
-                else if ( copy_to_guest(handle, ctxt.data + off, desc->length) 
)
-                    rv = -EFAULT;
-                else
-                    *bufsz = desc->length;
-                break;
-            }
+            rv = 0;
+            if ( guest_handle_is_null(handle) )
+                *bufsz = desc->length;
+            else if ( *bufsz < desc->length )
+                rv = -ENOBUFS;
+            else if ( copy_to_guest(handle, ctxt.data + off, desc->length) )
+                rv = -EFAULT;
+            else
+                *bufsz = desc->length;
         }
     }
 
-- 
2.7.4


_______________________________________________
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®.