* [PATCH] kexec: prefer __copy_to_guest() when possible
@ 2015-01-27 17:19 Jan Beulich
2015-01-27 17:21 ` David Vrabel
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2015-01-27 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: David Vrabel
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
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@suse.com>
--- 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 #2: kexec-copy-to-guest.patch --]
[-- Type: text/plain, Size: 1074 bytes --]
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@suse.com>
--- 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 #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kexec: prefer __copy_to_guest() when possible
2015-01-27 17:19 [PATCH] kexec: prefer __copy_to_guest() when possible Jan Beulich
@ 2015-01-27 17:21 ` David Vrabel
0 siblings, 0 replies; 2+ messages in thread
From: David Vrabel @ 2015-01-27 17:21 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 27/01/15 17:19, Jan Beulich wrote:
> It's slightly cheaper and safe as long a copy_from_guest() for the same
> guest address range was issued before.
Acked-by: David Vrabel <david.vrabel@citrix.com>
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-27 17:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 17:19 [PATCH] kexec: prefer __copy_to_guest() when possible Jan Beulich
2015-01-27 17:21 ` David Vrabel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.