qemu-qdisk: Implementation of grant copy operation.
v7 cover qemu-qdisk: Implementation of grant copy operation.
Hi,
It is a proposition for implementation of grant copy operation in qemu-qdisk and interface in libxc/libs.
Changes since v6:
qemu-qdisk:
-removed blank lines
-renamed functions free_buffers -> ioreq_free_copy_buffers,
ioreq_copy -> ioreq_grant_copy
-merged the if(ioreq_copy) with the conditions above
Changes since v5:
qemu-qdisk:
-added checking of every interface in the configure file. Based on
the Roger's comment that xengnttab_map_grant_ref was added prior xengnttab_grant_copy, thus do not need to be check again here I dropped this check.
Changes since v4:
Interface:
- changed the subject line
- changed the comment in libs/gnttab/include/xengnttab.h according to the David's suggestion.
- removed unnecessary braces.
qemu-qdisk:
- in the configure file check only if xengnttab_grant_copy is implemented to verify 480 version of Xen.
- remove r variable and initialization of count to 0 in ioreq_copy.
- surround free_buffers, ioreq_init_copy_buffers and ioreq_copy by "#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 480" abort in else path because the function should not be called in that case.
- replace the definition of struct xengnttab_grant_copy_segment and a typedef to it with
'typedef void* xengnttab_grant_copy_segment_t'.
- moved the new code in the xen_common.h to the end of the file.
Changes since v3:
Interface:
- revert to cast from xengnttab_grant_copy_segment_t
to ioctl_gntdev_grant_copy.
- added compile-time check to compare the libs xengnttab_grant_copy_segment_t with the ioctl structure.
The patch relies on Wei patch introducing XENGNTTAB_BUILD_BUG_ON in libs/gnttab.
qemu-qdisk:
- qemu_memalign/qemu_free is used instead function allocating memory from xc.
- removed the get_buffer function instead there is a direct call to qemu_memalign.
- moved ioreq_copy for write operation to ioreq_runio_qemu_aio.
- added struct xengnttab_grant_copy_segment_t and stub in xen_common.h for version of Xen earlier then 480.
- added checking for version 480 to configure. The test repeats all the operation that are required for version < 480 and checks if xengnttab_grant_copy() is implemented.
Changes since v2:
Interface:
- dropped the changes in libxc/include/xenctrl_compat
- changed the MINOR version in Makefile
- replaced 'return -1' -> 'abort()'in libs/gnttab/gnttab_unimp.c
- moved the struct 'xengnttab_copy_grant_segment' to libs/gnttab/include/xengnttab.h
- added explicit assingment to ioctl_gntdev_grant_copy_segment to the linux part
qemu-qdisk:
- to use the xengnttab_* function directly added -lxengnttab to configure and include <xengnttab.h> in include/hw/xen/xen_common.h
- in ioreq_copy removed an out path, changed a log level, made explicit assignement to 'xengnttab_copy_grant_segment'
* I did not change the way of testing if grant_copy operation is implemented. As far as I understand if the code from gnttab_unimp.c is used then the gnttab device is unavailable and the handler to gntdev would be invalid. But if the handler is valid then the ioctl should return operation unimplemented if the gntdev does not implement the operation.
Changes since v1:
Interface:
- changed the interface to call grant copy operation to match ioctl
int xengnttab_grant_copy(xengnttab_handle *xgt,
uint32_t count,
xengnttab_grant_copy_segment_t* segs)- added a struct 'xengnttab_copy_grant_segment' definition to tools/libs /gnttab/private.h, tools/libxc/include/xenctrl_compat.h
- changed the function 'osdep_gnttab_grant_copy' which right now just call the ioctl
- added a new VER1.1 to tools/libs/gnttab/libxengnttab.map
qemu-qdisk:
- removed the 'ioreq_write','ioreq_read_init','ioreq_read' functions
- implemented 'ioreq_init_copy_buffers', 'ioreq_copy'
- reverted the removal of grant map and introduced conditional invoking grant copy or grant map
- resigned from caching the local buffers on behalf of allocating the required amount of pages at once. The cached structure would require to have an lock guard and I suppose that the performance improvement would degraded.
For the functional test I attached the device with a qdisk backend to the guest, mounted, performed some reads and writes.
I run fio tests[1] with different iodepth and size of the block. The test can be accessed on my github[2] but mainly after the warm up I run for 60 seconds:
fio --time_based \ --clocksource=clock_gettime \ --rw=randread \ --random_distribution=pareto:0.9 \ --size=10g \ --direct='1' \ --ioengine=libaio \ --filename=$DEV \ --iodepth=$IODEPTH \ --bs=$BS \ --name=$NAME \ --runtime=$RUNTIME >> $FILENAME
The test were repeated at least three times.
[1] https://docs.google.com/spreadsheets/d/1E6AMiB8ceJpExL6jWpH9u2yy6DZxzhmDUyFf-eUuJ0c/edit?usp=sharing
[2] https://github.com/paulina-szubarczyk/xen-benchmark
- multitest_with_iodepth.sh
Thanks and regards,
Paulina
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v7 1/2 libs/gnttab: introduce grant copy interface
In a linux part an ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..) system call is invoked. In mini-os the operation is yet not implemented. For the OSs that does not implement gnttab the call of the grant copy operation causes abort.
--- tools/include/xen-sys/Linux/gntdev.h | 21 ++++++++++ tools/libs/gnttab/Makefile | 2 +- tools/libs/gnttab/gnttab_core.c | 6 +++ tools/libs/gnttab/gnttab_unimp.c | 6 +++ tools/libs/gnttab/include/xengnttab.h | 28 +++++++++++++ tools/libs/gnttab/libxengnttab.map | 5 +++ tools/libs/gnttab/linux.c | 77 +++++++++++++++++++++++++++++++++++ tools/libs/gnttab/minios.c | 6 +++ tools/libs/gnttab/private.h | 4 ++ 9 files changed, 154 insertions(+), 1 deletion(-)
tools/include/xen-sys/Linux/gntdev.h +21 -0
@@ -147,4 +147,25 @@ struct ioctl_gntdev_unmap_notify {/* Send an interrupt on the indicated event channel */ #define UNMAP_NOTIFY_SEND_EVENT 0x2 +struct ioctl_gntdev_grant_copy_segment { +union { +void *virt; +struct { +uint32_t ref; +uint16_t offset; +uint16_t domid; + } foreign; + } source, dest; +uint16_t len; +uint16_t flags; +int16_t status; +}; + +#define IOCTL_GNTDEV_GRANT_COPY \ +_IOC(_IOC_NONE, 'G', 8, sizeof(struct ioctl_gntdev_grant_copy)) +struct ioctl_gntdev_grant_copy { +unsigned int count; +struct ioctl_gntdev_grant_copy_segment *segments; +}; +#endif /* __LINUX_PUBLIC_GNTDEV_H__ */
tools/libs/gnttab/Makefile +1 -1
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk MAJOR = 1 -MINOR = 0 +MINOR = 1 SHLIB_LDFLAGS += -Wl,--version-script=libxengnttab.map CFLAGS += -Werror -Wmissing-prototypes
tools/libs/gnttab/gnttab_core.c +6 -0
@@ -113,6 +113,12 @@ int xengnttab_unmap(xengnttab_handle *xgt, void *start_address, uint32_t count)return osdep_gnttab_unmap (xgt, start_address, count); } +int xengnttab_grant_copy (xengnttab_handle *xgt, +uint32_t count, +xengnttab_grant_copy_segment_t *segs) +{ +return osdep_gnttab_grant_copy (xgt, count, segs); +}/* * Local variables: * mode: C
tools/libs/gnttab/gnttab_unimp.c +6 -0
@@ -78,6 +78,12 @@ int xengnttab_unmap(xengnttab_handle *xgt, void *start_address, uint32_t count)abort (); } +int xengnttab_copy_grant (xengnttab_handle *xgt, +uint32_t count, +xengnttab_copy_grant_segment_t *segs) +{ +abort (); +}/* * Local variables: * mode: C
tools/libs/gnttab/include/xengnttab.h +28 -0
@@ -258,6 +258,34 @@ int xengnttab_unmap(xengnttab_handle *xgt, void *start_address, uint32_t count);int xengnttab_set_max_grants (xengnttab_handle *xgt,uint32_t nr_grants); +struct xengnttab_grant_copy_segment { +union xengnttab_copy_ptr { +void *virt; +struct { +uint32_t ref; +uint16_t offset; +uint16_t domid; + } foreign; + } source, dest; +uint16_t len; +uint16_t flags; +int16_t status; +}; + +typedef struct xengnttab_grant_copy_segment xengnttab_grant_copy_segment_t ; + +/** +* Copy memory from or to grant references. The information of each operations +* are contained in 'xengnttab_grant_copy_segment_t'. The @flag value indicate +* the direction of an operation (GNTCOPY_source_gref\GNTCOPY_dest_gref). +* +* For each segment, @virt may cross a page boundary but @offset + @len +* must not exceed XEN_PAGE_SIZE. +*/ +int xengnttab_grant_copy (xengnttab_handle *xgt, +uint32_t count, +xengnttab_grant_copy_segment_t *segs); +/* * Grant Sharing Interface (allocating and granting pages to others) */
tools/libs/gnttab/libxengnttab.map +5 -0
@@ -21,3 +21,8 @@ VERS_1.0 { xengntshr_unshare; local: *; /* Do not expose anything by default */ }; + +VERS_1.1 { + global: + xengnttab_grant_copy; +} VERS_1.0;
tools/libs/gnttab/linux.c +77 -0
89 lines not on this page · raw message
tools/libs/gnttab/minios.c +6 -0
@@ -106,6 +106,12 @@ int osdep_gnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count)return ret; } +int osdep_gnttab_grant_copy (xengnttab_handle *xgt, +uint32_t count, +xengnttab_grant_copy_segment_t *segs) +{ +return -1 ; +}/* * Local variables: * mode: C
tools/libs/gnttab/private.h +4 -0
@@ -30,6 +30,10 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,int osdep_gnttab_unmap (xengnttab_handle *xgt,void *start_address,uint32_t count); +int osdep_gnttab_grant_copy (xengnttab_handle *xgt, +uint32_t count, +xengnttab_grant_copy_segment_t *segs); +int osdep_gntshr_open (xengntshr_handle *xgs);int osdep_gntshr_close (xengntshr_handle *xgs);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v7 1/2] libs/gnttab: introduce grant copy interface
Quoted 7 lines · Paulina Szubarczyk
In a linux part an
ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..)system call is invoked. In mini-os the operation is yet not implemented. For the OSs that does not implement gnttab the call of the grant copy operation causes abort.Signed-off-by Paulina Szubarczyk <[email protected]>Reviewed-by David Vrabel <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v7 1/2] libs/gnttab: introduce grant copy interface
In reply to Paulina SzubarczykQuoted 7 lines · Paulina Szubarczyk
In a linux part an
ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..)system call is invoked. In mini-os the operation is yet not implemented. For the OSs that does not implement gnttab the call of the grant copy operation causes abort.Signed-off-by Paulina Szubarczyk <[email protected]>Reviewed-by David Vrabel <[email protected]>
Re: [Qemu-devel] [PATCH v7 1/2] libs/gnttab: introduce grant copy interface
In reply to Paulina SzubarczykQuoted 7 lines · Paulina Szubarczyk
In a linux part an
ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..)system call is invoked. In mini-os the operation is yet not implemented. For the OSs that does not implement gnttab the call of the grant copy operation causes abort.Signed-off-by Paulina Szubarczyk <[email protected]>Reviewed-by David Vrabel <[email protected]>
Paulina, this is mostly for your information. No action is needed on your side. Thanks for putting in the effort to contribute to Xen.
Because Ian prefers another way of dealing with BUILD_BUG_ON, I've sent out another patch for that. I also write the following patch to fix up this patch.
---8<---
From 096fef32bffaef5b3e273bdfe75d620d8a7c8792 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Mon, 19 Sep 2016 16:50:35 +0100
Subject: [PATCH] fixup! libs/gnttab: introduce grant copy interface
--- tools/libs/gnttab/linux.c | 116 +++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 57 deletions(-)
tools/libs/gnttab/linux.c +59 -57
@@ -31,6 +31,8 @@#include <xen/sys/gntdev.h> #include <xen/sys/gntalloc.h> +#include <xen-tools/libs.h> +#include "private.h" #define DEVXEN "/dev/xen/"
@@ -244,63 +246,63 @@ int osdep_gnttab_grant_copy(xengnttab_handle *xgt,int fd = xgt->fd;struct ioctl_gntdev_grant_copy copy; -XENGNTTAB_BUILD_BUG_ON (sizeof (struct ioctl_gntdev_grant_copy_segment ) != -sizeof (xengnttab_grant_copy_segment_t)); - -XENGNTTAB_BUILD_BUG_ON (__alignof__(struct ioctl_gntdev_grant_copy_segment ) != - __alignof__(xengnttab_grant_copy_segment_t )); - - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.virt) != - offsetof(xengnttab_grant_copy_segment_t , - source.virt)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign) != - offsetof(xengnttab_grant_copy_segment_t , - source.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign.ref) != - offsetof(xengnttab_grant_copy_segment_t , - source.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign.offset) != - offsetof(xengnttab_grant_copy_segment_t , - source.foreign.offset)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign.domid) != - offsetof(xengnttab_grant_copy_segment_t , - source.foreign.domid)); - - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.virt) != - offsetof(xengnttab_grant_copy_segment_t , - dest.virt)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign) != - offsetof(xengnttab_grant_copy_segment_t , - dest.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign.ref) != - offsetof(xengnttab_grant_copy_segment_t , - dest.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign.offset) != - offsetof(xengnttab_grant_copy_segment_t , - dest.foreign.offset)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign.domid) != - offsetof(xengnttab_grant_copy_segment_t , - dest.foreign.domid)); - -XENGNTTAB_BUILD_BUG_ON (offsetof(struct ioctl_gntdev_grant_copy_segment , - len) != - offsetof(xengnttab_grant_copy_segment_t , len)); -XENGNTTAB_BUILD_BUG_ON (offsetof(struct ioctl_gntdev_grant_copy_segment , - flags) != - offsetof(xengnttab_grant_copy_segment_t , flags)); -XENGNTTAB_BUILD_BUG_ON (offsetof(struct ioctl_gntdev_grant_copy_segment , - status) != - offsetof(xengnttab_grant_copy_segment_t , status)); +BUILD_BUG_ON (sizeof (struct ioctl_gntdev_grant_copy_segment ) != +sizeof (xengnttab_grant_copy_segment_t)); + +BUILD_BUG_ON (__alignof__(struct ioctl_gntdev_grant_copy_segment ) != + __alignof__(xengnttab_grant_copy_segment_t )); + + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.virt) != + offsetof(xengnttab_grant_copy_segment_t , + source.virt)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign) != + offsetof(xengnttab_grant_copy_segment_t , + source.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign.ref) != + offsetof(xengnttab_grant_copy_segment_t , + source.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign.offset) != + offsetof(xengnttab_grant_copy_segment_t , + source.foreign.offset)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign.domid) != + offsetof(xengnttab_grant_copy_segment_t , + source.foreign.domid)); + + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.virt) != + offsetof(xengnttab_grant_copy_segment_t , + dest.virt)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign) != + offsetof(xengnttab_grant_copy_segment_t , + dest.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign.ref) != + offsetof(xengnttab_grant_copy_segment_t , + dest.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign.offset) != + offsetof(xengnttab_grant_copy_segment_t , + dest.foreign.offset)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign.domid) != + offsetof(xengnttab_grant_copy_segment_t , + dest.foreign.domid)); + +BUILD_BUG_ON (offsetof(struct ioctl_gntdev_grant_copy_segment , + len) != + offsetof(xengnttab_grant_copy_segment_t , len)); +BUILD_BUG_ON (offsetof(struct ioctl_gntdev_grant_copy_segment , + flags) != + offsetof(xengnttab_grant_copy_segment_t , flags)); +BUILD_BUG_ON (offsetof(struct ioctl_gntdev_grant_copy_segment , + status) != + offsetof(xengnttab_grant_copy_segment_t , status)); copy.segments = (struct ioctl_gntdev_grant_copy_segment *)segs; copy.count = count;
Signature · 6 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v7 1/2] libs/gnttab: introduce grant copy interface
Quoted 16 lines · Wei Liu
Quoted 7 lines · Paulina Szubarczyk
In a linux part an
ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..)system call is invoked. In mini-os the operation is yet not implemented. For the OSs that does not implement gnttab the call of the grant copy operation causes abort.Signed-off-by Paulina Szubarczyk <[email protected]>Reviewed-by David Vrabel <[email protected]>Paulina, this is mostly for your information. No action is needed on your side. Thanks for putting in the effort to contribute to Xen.
Because Ian prefers another way of dealing with
BUILD_BUG_ON, I've sent out another patch for that. I also write the following patch to fix up this patch.
Quoted 6 lines
---8<---
From096fef32bffaef5b3e273bdfe75d620d8a7c8792Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Mon, 19 Sep 2016 16:50:35 +0100
Subject: [PATCH] fixup! libs/gnttab: introduce grant copy interface
Squashed the fixup into this patch and pushed to staging.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v7 2/2 qdisk - hw/block/xen_disk: grant copy implementation
In reply to Paulina SzubarczykCopy data operated on during request from/to local buffers to/from the grant references.
Before grant copy operation local buffers must be allocated what is done by calling ioreq_init_copy_buffers. For the 'read' operation, first, the qemu device invokes the read operation on local buffers and on the completion grant copy is called and buffers are freed. For the 'write' operation grant copy is performed before invoking write by qemu device.
A new value 'feature_grant_copy' is added to recognize when the grant copy operation is supported by a guest.
---
Changes since v6:
-removed blank lines
-renamed functions free_buffers -> ioreq_free_copy_buffers,
ioreq_copy -> ioreq_grant_copy
-merged the if(ioreq_copy) with the conditions above
--- configure | 55 ++++++++++++++++ hw/block/xen_disk.c | 153 ++++++++++++++++++++++++++++++++++++++++++-- include/hw/xen/xen_common.h | 14 ++++ 3 files changed, 217 insertions(+), 5 deletions(-)
configure +55 -0
@@ -1972,6 +1972,61 @@ EOF /* * If we have stable libs the we don't want the libxc compat * layers, regardless of what CFLAGS we may have been given. + * + * Also, check if xengnttab_grant_copy_segment_t is defined and + * grant copy operation is implemented. + */ +#undef XC_WANT_COMPAT_EVTCHN_API +#undef XC_WANT_COMPAT_GNTTAB_API +#undef XC_WANT_COMPAT_MAP_FOREIGN_API +#include <xenctrl.h> +#include <xenstore.h> +#include <xenevtchn.h> +#include <xengnttab.h> +#include <xenforeignmemory.h> +#include <stdint.h> +#include <xen/hvm/hvm_info_table.h> +#if !defined(HVM_MAX_VCPUS) +# error HVM_MAX_VCPUS not defined +#endif +int main(void) { + xc_interface *xc = NULL; + xenforeignmemory_handle *xfmem; + xenevtchn_handle *xe; + xengnttab_handle *xg; + xen_domain_handle_t handle; + xengnttab_grant_copy_segment_t* seg = NULL; + + xs_daemon_open(); + + xc = xc_interface_open(0, 0, 0); + xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); + xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); + xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); + xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); + xc_domain_create(xc, 0, handle, 0, NULL, NULL); + + xfmem = xenforeignmemory_open(0, 0); + xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); + + xe = xenevtchn_open(0, 0); + xenevtchn_fd(xe); + + xg = xengnttab_open(0, 0); + xengnttab_grant_copy(xg, 0, seg); + + return 0; +} +EOF + compile_prog "" "$xen_libs $xen_stable_libs" + then + xen_ctrl_version=480 + xen=yes + elif + cat > $TMPC <<EOF && +/* + * If we have stable libs the we don't want the libxc compat + * layers, regardless of what CFLAGS we may have been given. */ #undef XC_WANT_COMPAT_EVTCHN_API #undef XC_WANT_COMPAT_GNTTAB_API
hw/block/xen_disk.c +148 -5
196 lines not on this page · raw message
include/hw/xen/xen_common.h +14 -0
@@ -424,4 +424,18 @@ static inline int xen_domain_create(xc_interface *xc, uint32_t ssidref,#endif #endif +/* Xen before 4.8 */ + +#if CONFIG_XEN_CTRL_INTERFACE_VERSION <480 + + +typedef void *xengnttab_grant_copy_segment_t ; + +static inline int xengnttab_grant_copy (xengnttab_handle *xgt,uint32_t count, +xengnttab_grant_copy_segment_t *segs) +{ +return -ENOSYS ; +} +#endif +#endif /* QEMU_HW_XEN_COMMON_H */
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hi Wei,
I am happy to queue up this for QEMU, but I'll wait for the first patch to be committed to Xen before sending a pull request. Is that OK?
Cheers,
Stefano
Quoted 125 lines · Paulina Szubarczyk
Hi,
It is a proposition for implementation of grant copy operation in qemu-qdisk and interface in libxc/libs.
Changes since v6:
qemu-qdisk:(quoted diff) +0
-3-removed blank lines -renamed functions free_buffers -> ioreq_free_copy_buffers, ioreq_copy -> ioreq_grant_copy -merged the if(ioreq_copy) with the conditions aboveChanges since v5:
qemu-qdisk:
-added checking of every interface in the configure file. Based on
the Roger's comment thatxengnttab_map_grant_refwas added priorxengnttab_grant_copy, thus do not need to be check again here I dropped this check.Changes since v4:
Interface:
- changed the subject line
- changed the comment inlibs/gnttab/include/xengnttab.haccording to the David's suggestion.
- removed unnecessary braces.qemu-qdisk:
- in the configure file check only ifxengnttab_grant_copyis implemented to verify 480 version of Xen.
- remove r variable and initialization of count to 0 inioreq_copy.- surround
free_buffers,ioreq_init_copy_buffersandioreq_copyby "#ifCONFIG_XEN_CTRL_INTERFACE_VERSION>= 480" abort in else path because the function should not be called in that case.
- replace the definition of structxengnttab_grant_copy_segmentand a typedef to it with
'typedef void*xengnttab_grant_copy_segment_t'.
- moved the new code in thexen_common.hto the end of the file.Changes since v3:
Interface:
- revert to cast fromxengnttab_grant_copy_segment_t
toioctl_gntdev_grant_copy.
- added compile-time check to compare the libsxengnttab_grant_copy_segment_twith the ioctl structure.
The patch relies on Wei patch introducingXENGNTTAB_BUILD_BUG_ONin libs/gnttab.qemu-qdisk:
- qemu_memalign/qemu_free is used instead function allocating memory from xc.
- removed theget_bufferfunction instead there is a direct call toqemu_memalign.
- movedioreq_copyfor write operation toioreq_runio_qemu_aio.
- added structxengnttab_grant_copy_segment_tand stub inxen_common.hfor version of Xen earlier then 480.
- added checking for version 480 to configure. The test repeats all the operation that are required for version < 480 and checks ifxengnttab_grant_copy()is implemented.Changes since v2:
Interface:
- dropped the changes in libxc/include/xenctrl_compat
- changed the MINOR version inMakefile
- replaced 'return -1' -> 'abort()'inlibs/gnttab/gnttab_unimp.c
- moved the struct 'xengnttab_copy_grant_segment' tolibs/gnttab/include/xengnttab.h
- added explicit assingment toioctl_gntdev_grant_copy_segmentto the linux partqemu-qdisk:
- to use the xengnttab_* function directly added -lxengnttab to configure and include <xengnttab.h> ininclude/hw/xen/xen_common.h
- inioreq_copyremoved an out path, changed a log level, made explicit assignement to 'xengnttab_copy_grant_segment'
* I did not change the way of testing ifgrant_copyoperation is implemented. As far as I understand if the code fromgnttab_unimp.cis used then the gnttab device is unavailable and the handler to gntdev would be invalid. But if the handler is valid then the ioctl should return operation unimplemented if the gntdev does not implement the operation.Changes since v1:
Interface:
- changed the interface to call grant copy operation to match ioctlint xengnttab_grant_copy(xengnttab_handle *xgt, uint32_t count, xengnttab_grant_copy_segment_t* segs)- added a struct '
xengnttab_copy_grant_segment' definition totools/libs/gnttab/private.h,tools/libxc/include/xenctrl_compat.h- changed the function '
osdep_gnttab_grant_copy' which right now just call the ioctl- added a new VER1.1 to
tools/libs/gnttab/libxengnttab.mapqemu-qdisk:
- removed the 'ioreq_write','ioreq_read_init','ioreq_read' functions
- implemented 'ioreq_init_copy_buffers', 'ioreq_copy'
- reverted the removal of grant map and introduced conditional invoking grant copy or grant map
- resigned from caching the local buffers on behalf of allocating the required amount of pages at once. The cached structure would require to have an lock guard and I suppose that the performance improvement would degraded.For the functional test I attached the device with a qdisk backend to the guest, mounted, performed some reads and writes.
I run fio tests[1] with different iodepth and size of the block. The test can be accessed on my github[2] but mainly after the warm up I run for 60 seconds:
fio --time_based \ --clocksource=clock_gettime \ --rw=randread \ --random_distribution=pareto:0.9 \ --size=10g \ --direct='1' \ --ioengine=libaio \ --filename=$DEV \ --iodepth=$IODEPTH \ --bs=$BS \ --name=$NAME \ --runtime=$RUNTIME >> $FILENAMEThe test were repeated at least three times.
Quoted 9 lines
[1] https://docs.google.com/spreadsheets/d/1E6AMiB8ceJpExL6jWpH9u2yy6DZxzhmDUyFf-eUuJ0c/edit?usp=sharing
[2] https://github.com/paulina-szubarczyk/xen-benchmark
-multitest_with_iodepth.shThanks and regards,
Paulina
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines · Stefano Stabellini
Hi Wei,
I am happy to queue up this for QEMU, but I'll wait for the first patch to be committed to Xen before sending a pull request. Is that OK?
Yes, that's fine. I will get around to this next week. One of the prerequisite patch written by me needs Ian's ack and he is away.
Wei.
Quoted 3 lines
Cheers,
Stefano
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel