|
|
0727d3 |
From 75cd92cb7cff055f46163e64d66ba3f685f9ac04 Mon Sep 17 00:00:00 2001
|
|
|
0727d3 |
From: Juan Quintela <quintela@redhat.com>
|
|
|
0727d3 |
Date: Wed, 18 May 2022 02:52:23 -0300
|
|
|
0727d3 |
Subject: [PATCH 09/37] multifd: Make zlib compression method not use iovs
|
|
|
0727d3 |
MIME-Version: 1.0
|
|
|
0727d3 |
Content-Type: text/plain; charset=UTF-8
|
|
|
0727d3 |
Content-Transfer-Encoding: 8bit
|
|
|
0727d3 |
|
|
|
0727d3 |
RH-Author: Leonardo Brás <leobras@redhat.com>
|
|
|
0727d3 |
RH-MergeRequest: 191: MSG_ZEROCOPY + Multifd @ rhel8.7
|
|
|
0727d3 |
RH-Commit: [9/26] d33dd62b833d50fee989a195aebcc8d5e7d43181
|
|
|
0727d3 |
RH-Bugzilla: 2072049
|
|
|
0727d3 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
0727d3 |
RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
0727d3 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
0727d3 |
|
|
|
0727d3 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
0727d3 |
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
0727d3 |
(cherry picked from commit a5ed22948873b50fcf1415d1ce15c71d61a9388d)
|
|
|
0727d3 |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
0727d3 |
---
|
|
|
0727d3 |
migration/multifd-zlib.c | 17 +++++++++--------
|
|
|
0727d3 |
1 file changed, 9 insertions(+), 8 deletions(-)
|
|
|
0727d3 |
|
|
|
0727d3 |
diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c
|
|
|
0727d3 |
index 330fc021c5..a1950a4588 100644
|
|
|
0727d3 |
--- a/migration/multifd-zlib.c
|
|
|
0727d3 |
+++ b/migration/multifd-zlib.c
|
|
|
0727d3 |
@@ -13,6 +13,7 @@
|
|
|
0727d3 |
#include "qemu/osdep.h"
|
|
|
0727d3 |
#include <zlib.h>
|
|
|
0727d3 |
#include "qemu/rcu.h"
|
|
|
0727d3 |
+#include "exec/ramblock.h"
|
|
|
0727d3 |
#include "exec/target_page.h"
|
|
|
0727d3 |
#include "qapi/error.h"
|
|
|
0727d3 |
#include "migration.h"
|
|
|
0727d3 |
@@ -100,8 +101,8 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
|
|
|
0727d3 |
*/
|
|
|
0727d3 |
static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
|
|
0727d3 |
{
|
|
|
0727d3 |
- struct iovec *iov = p->pages->iov;
|
|
|
0727d3 |
struct zlib_data *z = p->data;
|
|
|
0727d3 |
+ size_t page_size = qemu_target_page_size();
|
|
|
0727d3 |
z_stream *zs = &z->zs;
|
|
|
0727d3 |
uint32_t out_size = 0;
|
|
|
0727d3 |
int ret;
|
|
|
0727d3 |
@@ -115,8 +116,8 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
|
|
0727d3 |
flush = Z_SYNC_FLUSH;
|
|
|
0727d3 |
}
|
|
|
0727d3 |
|
|
|
0727d3 |
- zs->avail_in = iov[i].iov_len;
|
|
|
0727d3 |
- zs->next_in = iov[i].iov_base;
|
|
|
0727d3 |
+ zs->avail_in = page_size;
|
|
|
0727d3 |
+ zs->next_in = p->pages->block->host + p->pages->offset[i];
|
|
|
0727d3 |
|
|
|
0727d3 |
zs->avail_out = available;
|
|
|
0727d3 |
zs->next_out = z->zbuff + out_size;
|
|
|
0727d3 |
@@ -240,6 +241,7 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p)
|
|
|
0727d3 |
static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
|
|
0727d3 |
{
|
|
|
0727d3 |
struct zlib_data *z = p->data;
|
|
|
0727d3 |
+ size_t page_size = qemu_target_page_size();
|
|
|
0727d3 |
z_stream *zs = &z->zs;
|
|
|
0727d3 |
uint32_t in_size = p->next_packet_size;
|
|
|
0727d3 |
/* we measure the change of total_out */
|
|
|
0727d3 |
@@ -264,7 +266,6 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
|
|
0727d3 |
zs->next_in = z->zbuff;
|
|
|
0727d3 |
|
|
|
0727d3 |
for (i = 0; i < p->pages->num; i++) {
|
|
|
0727d3 |
- struct iovec *iov = &p->pages->iov[i];
|
|
|
0727d3 |
int flush = Z_NO_FLUSH;
|
|
|
0727d3 |
unsigned long start = zs->total_out;
|
|
|
0727d3 |
|
|
|
0727d3 |
@@ -272,8 +273,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
|
|
0727d3 |
flush = Z_SYNC_FLUSH;
|
|
|
0727d3 |
}
|
|
|
0727d3 |
|
|
|
0727d3 |
- zs->avail_out = iov->iov_len;
|
|
|
0727d3 |
- zs->next_out = iov->iov_base;
|
|
|
0727d3 |
+ zs->avail_out = page_size;
|
|
|
0727d3 |
+ zs->next_out = p->pages->block->host + p->pages->offset[i];
|
|
|
0727d3 |
|
|
|
0727d3 |
/*
|
|
|
0727d3 |
* Welcome to inflate semantics
|
|
|
0727d3 |
@@ -286,8 +287,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
|
|
0727d3 |
do {
|
|
|
0727d3 |
ret = inflate(zs, flush);
|
|
|
0727d3 |
} while (ret == Z_OK && zs->avail_in
|
|
|
0727d3 |
- && (zs->total_out - start) < iov->iov_len);
|
|
|
0727d3 |
- if (ret == Z_OK && (zs->total_out - start) < iov->iov_len) {
|
|
|
0727d3 |
+ && (zs->total_out - start) < page_size);
|
|
|
0727d3 |
+ if (ret == Z_OK && (zs->total_out - start) < page_size) {
|
|
|
0727d3 |
error_setg(errp, "multifd %d: inflate generated too few output",
|
|
|
0727d3 |
p->id);
|
|
|
0727d3 |
return -1;
|
|
|
0727d3 |
--
|
|
|
0727d3 |
2.35.3
|
|
|
0727d3 |
|