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

[Xen-devel] [PATCH v7 11/15] x86/hvm: Remove loop from hvm_save_cpu_xsave_states


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
  • Date: Thu, 7 Jun 2018 17:59:29 +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: Thu, 07 Jun 2018 14:59:49 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=UiqWziyyhxOYiYhmmWYk2KfvGfuMruMIygTzdxNmk2hSb+vrwcHE1Sr1G7hMztolNBeZLM2H7rgStitwCyZKr61ocOskY+aT6ToQcNDO6tkO5TCHCm1gjfIKZ5Tow2sq8pbobpl5RK4OVroqO4qgDlAyVL92JN3av/TlYeXh+AR8IW2swPQ0P0zf6Qnp/03WPLfCZuRAy3lHKjPmqLuFV7FyPF1lybe04xyxLChNkyDcgfEU/cL5F0flgEq/QlnDDFCf0LfHXLuXXAX6UqjiTjmSKufLyD7/DySSTeisqxq7WN1Id2fYTDwg9psEY/SpIHUL2PZPaR5rOmDp1MV68w==; 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>

Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 38e5e96..2542cbd 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1160,36 +1160,27 @@ HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_cpu_ctxt, 
hvm_load_cpu_ctxt,
                                            save_area) + \
                                   xstate_ctxt_size(xcr0))
 
-static void hvm_save_cpu_xsave_states_one(struct vcpu *v, struct 
hvm_hw_cpu_xsave *ctxt)
-{
-    ctxt->xfeature_mask = xfeature_mask;
-    ctxt->xcr0 = v->arch.xcr0;
-    ctxt->xcr0_accum = v->arch.xcr0_accum;
-}
-
 static int hvm_save_cpu_xsave_states(struct domain *d, hvm_domain_context_t *h)
 {
-    struct vcpu *v;
+    struct vcpu *v = NULL;
     struct hvm_hw_cpu_xsave *ctxt;
+    unsigned int size = HVM_CPU_XSAVE_SIZE(v->arch.xcr0_accum);
 
     if ( !cpu_has_xsave )
         return 0;   /* do nothing */
 
-    for_each_vcpu ( d, v )
-    {
-        unsigned int size = HVM_CPU_XSAVE_SIZE(v->arch.xcr0_accum);
-
-        if ( !xsave_enabled(v) )
-            continue;
-        if ( _hvm_init_entry(h, CPU_XSAVE_CODE, v->vcpu_id, size) )
-            return 1;
-        ctxt = (struct hvm_hw_cpu_xsave *)&h->data[h->cur];
-        h->cur += size;
+    if ( !xsave_enabled(v) )
+        return CONTINUE;
+    if ( _hvm_init_entry(h, CPU_XSAVE_CODE, v->vcpu_id, size) )
+        return 1;
+    ctxt = (struct hvm_hw_cpu_xsave *)&h->data[h->cur];
+    h->cur += size;
+    ctxt->xfeature_mask = xfeature_mask;
+    ctxt->xcr0 = v->arch.xcr0;
+    ctxt->xcr0_accum = v->arch.xcr0_accum;
 
-        hvm_save_cpu_xsave_states_one(v, ctxt);
-        expand_xsave_states(v, &ctxt->save_area,
-                            size - offsetof(typeof(*ctxt), save_area));
-    }
+    expand_xsave_states(v, &ctxt->save_area,
+                        size - offsetof(typeof(*ctxt), save_area));
 
     return 0;
 }
-- 
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®.