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

[Xen-changelog] [xen-unstable] Cleanups to map_vcpu_info.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1180010536 -3600
# Node ID 36959baf05c00329c2a270ff4de7edf0bc0ec3eb
# Parent  1e418f7e0212f274b5042e2113ecdb50b3cc6af9
Cleanups to map_vcpu_info.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/domain.c     |   26 ++++++++++++++++----------
 xen/include/public/vcpu.h |    5 +++--
 2 files changed, 19 insertions(+), 12 deletions(-)

diff -r 1e418f7e0212 -r 36959baf05c0 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu May 24 13:34:19 2007 +0100
+++ b/xen/arch/x86/domain.c     Thu May 24 13:42:16 2007 +0100
@@ -489,7 +489,7 @@ void arch_domain_destroy(struct domain *
 {
     struct vcpu *v;
 
-    for_each_vcpu( d, v )
+    for_each_vcpu ( d, v )
         unmap_vcpu_info(v);
 
     if ( is_hvm_domain(d) )
@@ -754,7 +754,7 @@ unmap_vcpu_info(struct vcpu *v)
         return;
 
     mfn = v->vcpu_info_mfn;
-    unmap_domain_page_global( v->vcpu_info );
+    unmap_domain_page_global(v->vcpu_info);
 
     v->vcpu_info = shared_info_addr(d, vcpu_info[v->vcpu_id]);
     v->vcpu_info_mfn = INVALID_MFN;
@@ -779,8 +779,11 @@ map_vcpu_info(struct vcpu *v, unsigned l
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
-    if ( mfn == INVALID_MFN ||
-         v->vcpu_info_mfn != INVALID_MFN )
+    if ( v->vcpu_info_mfn != INVALID_MFN )
+        return -EINVAL;
+
+    /* Run this command on yourself or on other offline VCPUS. */
+    if ( (v != current) && !test_bit(_VPF_down, &v->pause_flags) )
         return -EINVAL;
 
     mfn = gmfn_to_mfn(d, mfn);
@@ -802,19 +805,22 @@ map_vcpu_info(struct vcpu *v, unsigned l
     v->vcpu_info = new_info;
     v->vcpu_info_mfn = mfn;
 
-    /* make sure all the pointers are uptodate before setting pending */
+    /* Set new vcpu_info pointer /before/ setting pending flags. */
     wmb();
 
-    /* Mark everything as being pending just to make sure nothing gets
-       lost.  The domain will get a spurious event, but it can
-       cope. */
+    /*
+     * Mark everything as being pending just to make sure nothing gets
+     * lost.  The domain will get a spurious event, but it can cope.
+     */
     vcpu_info(v, evtchn_upcall_pending) = 1;
     for ( i = 0; i < BITS_PER_GUEST_LONG(d); i++ )
         set_bit(i, vcpu_info_addr(v, evtchn_pending_sel));
 
-    /* Only bother to update time for the current vcpu.  If we're
+    /*
+     * Only bother to update time for the current vcpu.  If we're
      * operating on another vcpu, then it had better not be running at
-     * the time. */
+     * the time.
+     */
     if ( v == current )
          update_vcpu_system_time(v);
 
diff -r 1e418f7e0212 -r 36959baf05c0 xen/include/public/vcpu.h
--- a/xen/include/public/vcpu.h Thu May 24 13:34:19 2007 +0100
+++ b/xen/include/public/vcpu.h Thu May 24 13:42:16 2007 +0100
@@ -172,8 +172,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_singles
  */
 #define VCPUOP_register_vcpu_info   10  /* arg == struct vcpu_info */
 struct vcpu_register_vcpu_info {
-    xen_pfn_t mfn;              /* mfn of page to place vcpu_info */
-    uint32_t offset;            /* offset within page */
+    uint64_t mfn;    /* mfn of page to place vcpu_info */
+    uint32_t offset; /* offset within page */
+    uint32_t rsvd;   /* unused */
 };
 typedef struct vcpu_register_vcpu_info vcpu_register_vcpu_info_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_register_vcpu_info_t);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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