migration: avx2, 'info migrate' updates
The following changes since commit 97556fe80e4f7252300b3498b3477fb4295153a3:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2016-03-08 04:53:37 +0000)
are available in the git repository at:
https://git.kernel.org/pub/scm/virt/qemu/amit/migration.git tags/migration-for-2.6-6
for you to fetch changes up to 28b90d9c19d368645f475e36297ca21c53c38799:
cutils: add avx2 instruction optimization (2016-03-08 16:53:26 +0530)
----------------------------------------------------------------
migration:
* add avx2 instruction optimization, speeds up zero-page checking on compatible architectures and compilers (gcc 4.9+)
* add additional postcopy stats to 'info migrate' output
----------------------------------------------------------------
Dr. David Alan Gilbert (1):
Postcopy: Fix sync count in info migrate
Liang Li (2):
configure: detect ifunc and avx2 attribute
cutils: add avx2 instruction optimization
configure | 21 +++++++++ include/qemu-common.h | 8 +--- migration/migration.c | 1 + util/cutils.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 143 insertions(+), 11 deletions(-)
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 1/3] Postcopy: Fix sync count in info migrate
From: "Dr. David Alan Gilbert" <[email protected]>
I'd missed the sync count off in the postcopy case.
Message-id: [email protected]
Message-Id: <[email protected]>
--- migration/migration.c | 1 + 1 file changed, 1 insertion(+)
migration/migration.c +1 -0
@@ -635,6 +635,7 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->normal_bytes =norm_mig_bytes_transferred (); info->ram->dirty_pages_rate = s->dirty_pages_rate; info->ram->mbps = s->mbps; + info->ram->dirty_sync_count = s->dirty_sync_count;if (blk_mig_active ()) { info->has_disk = true;
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 2/3] configure: detect ifunc and avx2 attribute
In reply to Amit ShahFrom: Liang Li <[email protected]>
Detect if the compiler can support the ifun and avx2, if so, set CONFIG_AVX2_OPT which will be used to turn on the avx2 instruction optimization.
Message-Id: <[email protected]>
--- configure | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
configure +21 -0
@@ -280,6 +280,7 @@ libusb="" usb_redir="" opengl="" opengl_dmabuf="no" +avx2_opt="no" zlib="yes" lzo="" snappy=""
@@ -1773,6 +1774,21 @@ EOF fi ########################################## +# avx2 optimization requirement check + +cat > $TMPC << EOF +static void bar(void) {} +static void *bar_ifunc(void) {return (void*) bar;} +static void foo(void) __attribute__((ifunc("bar_ifunc"))); +int main(void) { foo(); return 0; } +EOF +if compile_prog "-mavx2" "" ; then + if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then + avx2_opt="yes" + fi +fi + +######################################### # zlib check if test "$zlib" != "no" ; then
@@ -4790,6 +4806,7 @@ echo "bzip2 support $bzip2" echo "NUMA host support $numa" echo "tcmalloc support $tcmalloc" echo "jemalloc support $jemalloc" +echo "avx2 optimization $avx2_opt" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5178,6 +5195,10 @@ if test "$opengl" = "yes" ; then fi fi +if test "$avx2_opt" = "yes" ; then + echo "CONFIG_AVX2_OPT=y" >> $config_host_mak +fi + if test "$lzo" = "yes" ; then echo "CONFIG_LZO=y" >> $config_host_mak fi
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 3/3] cutils: add avx2 instruction optimization
In reply to Amit ShahFrom: Liang Li <[email protected]>
buffer_find_nonzero_offset() is a hot function during live migration. Now it use SSE2 instructions for optimization. For platform supports AVX2 instructions, use AVX2 instructions for optimization can help to improve the performance of buffer_find_nonzero_offset() about 30% comparing to SSE2.
Live migration can be faster with this optimization, the test result shows that for an 8GiB RAM idle guest just boots, this patch can help to shorten the total live migration time about 6%.
This patch use the ifunc mechanism to select the proper function when running, for platform supports AVX2, execute the AVX2 instructions, else, execute the original instructions.
Message-Id: <[email protected]>
--- include/qemu-common.h | 8 +--- util/cutils.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 121 insertions(+), 11 deletions(-)
include/qemu-common.h +1 -7
@@ -476,13 +476,7 @@ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);#endif #define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8 -static inline bool -can_use_buffer_find_nonzero_offset (const void *buf,size_t len) -{ -return (len % (BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR - *sizeof (VECTYPE )) ==0 - && ((uintptr_t ) buf) %sizeof (VECTYPE ) ==0 ); -} +bool can_use_buffer_find_nonzero_offset (const void *buf,size_t len);size_t buffer_find_nonzero_offset (const void *buf,size_t len);/*
util/cutils.c +120 -4
153 lines not on this page · raw message
Signature · 1 line
2.5.0
Peter Maydell
AppliedQuoted 12 lines · Amit Shah
The following changes since commit
97556fe80e4f7252300b3498b3477fb4295153a3:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2016-03-08 04:53:37 +0000)
are available in the git repository at:
https://git.kernel.org/pub/scm/virt/qemu/amit/migration.git tags/migration-for-2.6-6
for you to fetch changes up to
28b90d9c19d368645f475e36297ca21c53c38799:cutils: add avx2 instruction optimization (2016-03-08 16:53:26 +0530)
Quoted 7 lines
----------------------------------------------------------------
migration:
* add avx2 instruction optimization, speeds up zero-page checking on compatible architectures and compilers (gcc 4.9+)
* add additional postcopy stats to 'info migrate' output----------------------------------------------------------------
Applied, thanks.
-- PMM