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

[Xen-changelog] [xen master] x86/HVM: clean up HVMOP_set_mem_type processing



commit c25c52e3f779706d3658b75627e665f88c6e79e2
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri May 2 10:56:23 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri May 2 10:56:23 2014 +0200

    x86/HVM: clean up HVMOP_set_mem_type processing
    
    - drop unused variable "mfn"
    - consistently do not use "else" when the prior "if" ends in "goto"
    - use printk() referencing the target domain instead of gdprintk()
      (which references the current domain) and slightly shorten message
    - annotate -EINVAL results in paging/shared paths to actually need
      switching to -EAGAIN (possible only when preemption logic got fixed
      to use -ERESTART)
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ac05160..ff6a1fd 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4531,41 +4531,37 @@ long do_hvm_op(unsigned long op, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         while ( a.nr > start_iter )
         {
             unsigned long pfn = a.first_pfn + start_iter;
-            p2m_type_t t;
-            p2m_type_t nt;
-            mfn_t mfn;
-            mfn = get_gfn_unshare(d, pfn, &t);
+            p2m_type_t t, nt;
+
+            get_gfn_unshare(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
                 put_gfn(d, pfn);
                 p2m_mem_paging_populate(d, pfn);
-                rc = -EINVAL;
+                rc = -EINVAL; /* XXX EAGAIN */
                 goto param_fail4;
             }
             if ( p2m_is_shared(t) )
             {
                 put_gfn(d, pfn);
-                rc = -EINVAL;
+                rc = -EINVAL; /* XXX EAGAIN */
                 goto param_fail4;
-            } 
+            }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm) )
             {
                 put_gfn(d, pfn);
                 goto param_fail4;
             }
-            else
+
+            nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
+            if ( nt != t )
             {
-                nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
-                if ( nt != t )
-                {
-                    put_gfn(d, pfn);
-                    gdprintk(XENLOG_WARNING,
-                             "type of pfn %#lx changed from %d to %d while "
-                             "we were trying to change it to %d\n",
-                             pfn, t, nt, memtype[a.hvmmem_type]);
-                    goto param_fail4;
-                }
+                put_gfn(d, pfn);
+                printk(XENLOG_G_WARNING
+                       "d%d: GFN %#lx type changed from %d to %d while trying 
to change it to %d\n",
+                       d->domain_id, pfn, t, nt, memtype[a.hvmmem_type]);
+                goto param_fail4;
             }
             put_gfn(d, pfn);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.