|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 3/4] libxc/tbuf: Use the xc_hypercall_bounce_[pre|post] instead of memcpy
for bounce buffer of the xc_cpumask_t.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
tools/libxc/xc_tbuf.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
index 2828aee..85156dd 100644
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -116,7 +116,7 @@ int xc_tbuf_disable(xc_interface *xch)
int xc_tbuf_set_cpu_mask(xc_interface *xch, xc_cpumap_t mask, int bits)
{
DECLARE_SYSCTL;
- DECLARE_HYPERCALL_BUFFER(uint8_t, bytemap);
+ DECLARE_HYPERCALL_BOUNCE(mask, 0, XC_HYPERCALL_BUFFER_BOUNCE_IN);
int ret = -1;
int local_bits;
@@ -129,8 +129,9 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, xc_cpumap_t
mask, int bits)
PERROR("Wrong amount of bits supplied: %d > %d!\n", bits, local_bits);
goto out;
}
- bytemap = xc_hypercall_buffer_alloc(xch, bytemap, DIV_ROUND_UP(bits, 8));
- if ( bytemap == NULL )
+
+ HYPERCALL_BOUNCE_SET_SIZE(mask, DIV_ROUND_UP(bits, 8));
+ if ( xc_hypercall_bounce_pre(xch, mask) )
{
PERROR("Could not allocate memory for xc_tbuf_set_cpu_mask hypercall");
goto out;
@@ -140,14 +141,12 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, xc_cpumap_t
mask, int bits)
sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_cpu_mask;
- memcpy(bytemap, mask, DIV_ROUND_UP(bits, 8));
-
- set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, bytemap);
+ set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, mask);
sysctl.u.tbuf_op.cpu_mask.nr_bits = bits;
ret = do_sysctl(xch, &sysctl);
- xc_hypercall_buffer_free(xch, bytemap);
+ xc_hypercall_bounce_post(xch, mask);
out:
return ret;
--
1.7.7.6
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |