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

[Xen-devel] [PATCH] kexec: prefer __copy_to_guest() when possible



It's slightly cheaper and safe as long a copy_from_guest() for the same
guest address range was issued before.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -663,8 +663,8 @@ static int kexec_get_range(XEN_GUEST_HAN
 
     ret = kexec_get_range_internal(&range);
 
-    if ( ret == 0 && unlikely(copy_to_guest(uarg, &range, 1)) )
-        return -EFAULT;
+    if ( ret == 0 && unlikely(__copy_to_guest(uarg, &range, 1)) )
+        ret = -EFAULT;
 
     return ret;
 }
@@ -687,10 +687,11 @@ static int kexec_get_range_compat(XEN_GU
     if ( (range.start | range.size) & ~(unsigned long)(~0u) )
         return -ERANGE;
 
-    if ( ret == 0 ) {
+    if ( ret == 0 )
+    {
         XLAT_kexec_range(&compat_range, &range);
-        if ( unlikely(copy_to_guest(uarg, &compat_range, 1)) )
-             return -EFAULT;
+        if ( unlikely(__copy_to_guest(uarg, &compat_range, 1)) )
+             ret = -EFAULT;
     }
 
     return ret;



Attachment: kexec-copy-to-guest.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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