From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887162; cv=none; d=zoho.com; s=zohoarc; b=U0p0O4Hza9SsfVYk4btkBnmz/hJLIxd25hkEtOAi8Y/Cfgey5qjGh7anSmsTUp1mdTc6aZYBu9XoaBjdkozWoiKrrHO2pQV8jAbit/4WAdNv1yrveQ773imfHSp8veKV/ySZyR5us4Sd2q8LGYMRNULzd3YiSGegaXTCEj0/CT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887162; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0AvevygJfT5Q/yvTVeRNPkhZ9xMvnEXQdE0e+qCRPgM=; b=Fg2bS7nc28U6MkRaDV/ZolfjaKF3oyD6/5HD/2x5E2F4prwkol0s1sOEtci2hDMFicH0lAZAlvmkDYLOA78M6uOxrMZ2wkKSG2G6cnkN8C/jDPEPnOPU0dpu3GwGvKB7V3utctmZSJjhM1uWueCAb7iYk0SOHFABr81H3V9uq/U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887162630915.6638556319284; Thu, 15 Aug 2019 09:39:22 -0700 (PDT) Received: from localhost ([::1]:44326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyImW-00069v-UG for importer@patchew.org; Thu, 15 Aug 2019 12:39:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47100) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIid-0001HX-6N for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIiY-00024l-5o for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIiX-00024N-UA for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2573E5AFDE; Thu, 15 Aug 2019 16:35:13 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 750D1BAAC; Thu, 15 Aug 2019 16:35:11 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:32 +0100 Message-Id: <20190815163504.18937-2-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 15 Aug 2019 16:35:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/33] migration: Add error_desc for file channel errors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Yury Kotov Currently, there is no information about error if outgoing migration was fa= iled because of file channel errors. Example (QMP session): -> { "execute": "migrate", "arguments": { "uri": "exec:head -c 1" }} <- { "return": {} } ... -> { "execute": "query-migrate" } <- { "return": { "status": "failed" }} // There is not error's description And even in the QEMU's output there is nothing. This patch 1) Adds errp for the most of QEMUFileOps 2) Adds qemu_file_get_error_obj/qemu_file_set_error_obj 3) And finally using of qemu_file_get_error_obj in migration.c And now, the status for the mentioned fail will be: -> { "execute": "query-migrate" } <- { "return": { "status": "failed", "error-desc": "Unable to write to command: Broken pipe" }} Signed-off-by: Yury Kotov Message-Id: <20190422103420.15686-1-yury-kotov@yandex-team.ru> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 10 ++++-- migration/qemu-file-channel.c | 30 +++++++++-------- migration/qemu-file.c | 63 ++++++++++++++++++++++++++++------- migration/qemu-file.h | 15 ++++++--- migration/savevm.c | 6 ++-- 5 files changed, 88 insertions(+), 36 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 8a607fe1e2..28342969ea 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2963,6 +2963,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) { int ret; int state =3D s->state; + Error *local_error =3D NULL; =20 if (state =3D=3D MIGRATION_STATUS_CANCELLING || state =3D=3D MIGRATION_STATUS_CANCELLED) { @@ -2971,13 +2972,18 @@ static MigThrError migration_detect_error(Migration= State *s) } =20 /* Try to detect any file errors */ - ret =3D qemu_file_get_error(s->to_dst_file); - + ret =3D qemu_file_get_error_obj(s->to_dst_file, &local_error); if (!ret) { /* Everything is fine */ + assert(!local_error); return MIG_THR_ERR_NONE; } =20 + if (local_error) { + migrate_set_error(s, local_error); + error_free(local_error); + } + if (state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE && ret =3D=3D -EIO) { /* * For postcopy, we allow the network to be down for a diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index 8e639eb496..c382ea2d78 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -33,7 +33,8 @@ static ssize_t channel_writev_buffer(void *opaque, struct iovec *iov, int iovcnt, - int64_t pos) + int64_t pos, + Error **errp) { QIOChannel *ioc =3D QIO_CHANNEL(opaque); ssize_t done =3D 0; @@ -47,7 +48,7 @@ static ssize_t channel_writev_buffer(void *opaque, =20 while (nlocal_iov > 0) { ssize_t len; - len =3D qio_channel_writev(ioc, local_iov, nlocal_iov, NULL); + len =3D qio_channel_writev(ioc, local_iov, nlocal_iov, errp); if (len =3D=3D QIO_CHANNEL_ERR_BLOCK) { if (qemu_in_coroutine()) { qio_channel_yield(ioc, G_IO_OUT); @@ -57,7 +58,6 @@ static ssize_t channel_writev_buffer(void *opaque, continue; } if (len < 0) { - /* XXX handle Error objects */ done =3D -EIO; goto cleanup; } @@ -75,13 +75,14 @@ static ssize_t channel_writev_buffer(void *opaque, static ssize_t channel_get_buffer(void *opaque, uint8_t *buf, int64_t pos, - size_t size) + size_t size, + Error **errp) { QIOChannel *ioc =3D QIO_CHANNEL(opaque); ssize_t ret; =20 do { - ret =3D qio_channel_read(ioc, (char *)buf, size, NULL); + ret =3D qio_channel_read(ioc, (char *)buf, size, errp); if (ret < 0) { if (ret =3D=3D QIO_CHANNEL_ERR_BLOCK) { if (qemu_in_coroutine()) { @@ -90,7 +91,6 @@ static ssize_t channel_get_buffer(void *opaque, qio_channel_wait(ioc, G_IO_IN); } } else { - /* XXX handle Error * object */ return -EIO; } } @@ -100,18 +100,20 @@ static ssize_t channel_get_buffer(void *opaque, } =20 =20 -static int channel_close(void *opaque) +static int channel_close(void *opaque, Error **errp) { + int ret; QIOChannel *ioc =3D QIO_CHANNEL(opaque); - qio_channel_close(ioc, NULL); + ret =3D qio_channel_close(ioc, errp); object_unref(OBJECT(ioc)); - return 0; + return ret; } =20 =20 static int channel_shutdown(void *opaque, bool rd, - bool wr) + bool wr, + Error **errp) { QIOChannel *ioc =3D QIO_CHANNEL(opaque); =20 @@ -125,8 +127,7 @@ static int channel_shutdown(void *opaque, } else { mode =3D QIO_CHANNEL_SHUTDOWN_WRITE; } - if (qio_channel_shutdown(ioc, mode, NULL) < 0) { - /* XXX handler Error * object */ + if (qio_channel_shutdown(ioc, mode, errp) < 0) { return -EIO; } } @@ -135,11 +136,12 @@ static int channel_shutdown(void *opaque, =20 =20 static int channel_set_blocking(void *opaque, - bool enabled) + bool enabled, + Error **errp) { QIOChannel *ioc =3D QIO_CHANNEL(opaque); =20 - if (qio_channel_set_blocking(ioc, enabled, NULL) < 0) { + if (qio_channel_set_blocking(ioc, enabled, errp) < 0) { return -1; } return 0; diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 0431585502..c04a7a891b 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -28,6 +28,7 @@ #include "migration.h" #include "qemu-file.h" #include "trace.h" +#include "qapi/error.h" =20 #define IO_BUF_SIZE 32768 #define MAX_IOV_SIZE MIN(IOV_MAX, 64) @@ -51,6 +52,7 @@ struct QEMUFile { unsigned int iovcnt; =20 int last_error; + Error *last_error_obj; }; =20 /* @@ -62,7 +64,7 @@ int qemu_file_shutdown(QEMUFile *f) if (!f->ops->shut_down) { return -ENOSYS; } - return f->ops->shut_down(f->opaque, true, true); + return f->ops->shut_down(f->opaque, true, true, NULL); } =20 /* @@ -107,24 +109,55 @@ void qemu_file_set_hooks(QEMUFile *f, const QEMUFileH= ooks *hooks) } =20 /* - * Get last error for stream f + * Get last error for stream f with optional Error* * * Return negative error value if there has been an error on previous * operations, return 0 if no error happened. + * Optional, it returns Error* in errp, but it may be NULL even if return = value + * is not 0. * */ -int qemu_file_get_error(QEMUFile *f) +int qemu_file_get_error_obj(QEMUFile *f, Error **errp) { + if (errp) { + *errp =3D f->last_error_obj ? error_copy(f->last_error_obj) : NULL; + } return f->last_error; } =20 -void qemu_file_set_error(QEMUFile *f, int ret) +/* + * Set the last error for stream f with optional Error* + */ +void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err) { - if (f->last_error =3D=3D 0) { + if (f->last_error =3D=3D 0 && ret) { f->last_error =3D ret; + error_propagate(&f->last_error_obj, err); + } else if (err) { + error_report_err(err); } } =20 +/* + * Get last error for stream f + * + * Return negative error value if there has been an error on previous + * operations, return 0 if no error happened. + * + */ +int qemu_file_get_error(QEMUFile *f) +{ + return qemu_file_get_error_obj(f, NULL); +} + +/* + * Set the last error for stream f + */ +void qemu_file_set_error(QEMUFile *f, int ret) +{ + qemu_file_set_error_obj(f, ret, NULL); +} + bool qemu_file_is_writable(QEMUFile *f) { return f->ops->writev_buffer; @@ -176,6 +209,7 @@ void qemu_fflush(QEMUFile *f) { ssize_t ret =3D 0; ssize_t expect =3D 0; + Error *local_error =3D NULL; =20 if (!qemu_file_is_writable(f)) { return; @@ -183,7 +217,8 @@ void qemu_fflush(QEMUFile *f) =20 if (f->iovcnt > 0) { expect =3D iov_size(f->iov, f->iovcnt); - ret =3D f->ops->writev_buffer(f->opaque, f->iov, f->iovcnt, f->pos= ); + ret =3D f->ops->writev_buffer(f->opaque, f->iov, f->iovcnt, f->pos, + &local_error); =20 qemu_iovec_release_ram(f); } @@ -195,7 +230,7 @@ void qemu_fflush(QEMUFile *f) * data set we requested, so sanity check that. */ if (ret !=3D expect) { - qemu_file_set_error(f, ret < 0 ? ret : -EIO); + qemu_file_set_error_obj(f, ret < 0 ? ret : -EIO, local_error); } f->buf_index =3D 0; f->iovcnt =3D 0; @@ -283,6 +318,7 @@ static ssize_t qemu_fill_buffer(QEMUFile *f) { int len; int pending; + Error *local_error =3D NULL; =20 assert(!qemu_file_is_writable(f)); =20 @@ -294,14 +330,16 @@ static ssize_t qemu_fill_buffer(QEMUFile *f) f->buf_size =3D pending; =20 len =3D f->ops->get_buffer(f->opaque, f->buf + pending, f->pos, - IO_BUF_SIZE - pending); + IO_BUF_SIZE - pending, &local_error); if (len > 0) { f->buf_size +=3D len; f->pos +=3D len; } else if (len =3D=3D 0) { - qemu_file_set_error(f, -EIO); + qemu_file_set_error_obj(f, -EIO, local_error); } else if (len !=3D -EAGAIN) { - qemu_file_set_error(f, len); + qemu_file_set_error_obj(f, len, local_error); + } else { + error_free(local_error); } =20 return len; @@ -327,7 +365,7 @@ int qemu_fclose(QEMUFile *f) ret =3D qemu_file_get_error(f); =20 if (f->ops->close) { - int ret2 =3D f->ops->close(f->opaque); + int ret2 =3D f->ops->close(f->opaque, NULL); if (ret >=3D 0) { ret =3D ret2; } @@ -338,6 +376,7 @@ int qemu_fclose(QEMUFile *f) if (f->last_error) { ret =3D f->last_error; } + error_free(f->last_error_obj); g_free(f); trace_qemu_file_fclose(); return ret; @@ -783,6 +822,6 @@ void qemu_put_counted_string(QEMUFile *f, const char *s= tr) void qemu_file_set_blocking(QEMUFile *f, bool block) { if (f->ops->set_blocking) { - f->ops->set_blocking(f->opaque, block); + f->ops->set_blocking(f->opaque, block, NULL); } } diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 13baf896bd..eb886db65f 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -32,7 +32,8 @@ * bytes actually read should be returned. */ typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, - int64_t pos, size_t size); + int64_t pos, size_t size, + Error **errp); =20 /* Close a file * @@ -41,7 +42,7 @@ typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uin= t8_t *buf, * The meaning of return value on success depends on the specific back-end= being * used. */ -typedef int (QEMUFileCloseFunc)(void *opaque); +typedef int (QEMUFileCloseFunc)(void *opaque, Error **errp); =20 /* Called to return the OS file descriptor associated to the QEMUFile. */ @@ -49,14 +50,15 @@ typedef int (QEMUFileGetFD)(void *opaque); =20 /* Called to change the blocking mode of the file */ -typedef int (QEMUFileSetBlocking)(void *opaque, bool enabled); +typedef int (QEMUFileSetBlocking)(void *opaque, bool enabled, Error **errp= ); =20 /* * This function writes an iovec to file. The handler must write all * of the data or return a negative errno value. */ typedef ssize_t (QEMUFileWritevBufferFunc)(void *opaque, struct iovec *iov, - int iovcnt, int64_t pos); + int iovcnt, int64_t pos, + Error **errp); =20 /* * This function provides hooks around different @@ -97,7 +99,8 @@ typedef QEMUFile *(QEMURetPathFunc)(void *opaque); * Existing blocking reads/writes must be woken * Returns 0 on success, -err on error */ -typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr); +typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr, + Error **errp); =20 typedef struct QEMUFileOps { QEMUFileGetBufferFunc *get_buffer; @@ -149,6 +152,8 @@ void qemu_update_position(QEMUFile *f, size_t size); void qemu_file_reset_rate_limit(QEMUFile *f); void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); int64_t qemu_file_get_rate_limit(QEMUFile *f); +int qemu_file_get_error_obj(QEMUFile *f, Error **errp); +void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err); void qemu_file_set_error(QEMUFile *f, int ret); int qemu_file_shutdown(QEMUFile *f); QEMUFile *qemu_file_get_return_path(QEMUFile *f); diff --git a/migration/savevm.c b/migration/savevm.c index 79ed44d475..a2a5f89b75 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -124,7 +124,7 @@ static struct mig_cmd_args { /* savevm/loadvm support */ =20 static ssize_t block_writev_buffer(void *opaque, struct iovec *iov, int io= vcnt, - int64_t pos) + int64_t pos, Error **errp) { int ret; QEMUIOVector qiov; @@ -139,12 +139,12 @@ static ssize_t block_writev_buffer(void *opaque, stru= ct iovec *iov, int iovcnt, } =20 static ssize_t block_get_buffer(void *opaque, uint8_t *buf, int64_t pos, - size_t size) + size_t size, Error **errp) { return bdrv_load_vmstate(opaque, buf, pos, size); } =20 -static int bdrv_fclose(void *opaque) +static int bdrv_fclose(void *opaque, Error **errp) { return bdrv_flush(opaque); } --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887028; cv=none; d=zoho.com; s=zohoarc; b=fESA99HDuxXXC8T7w+HLw8l4Qwvnffeeq4b137u6Jq8VIYb/ni48jTgi5wXgNKTWDQ05I/xE8dupDxoG5kfeHSXr0MsMcRif5Ofmpwo+2fYEb/49BS8O97pZt9HQQqaDDPaEYNWd5LKv5JfP/MJC7FkNfKI1OmFLMx9+QPn4YC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887028; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Gv8voWhcnjV8k39BOeekv81jKpXHlQDIKQIqnMdOcPw=; b=i1dQaobWv0acMHtVeLobojuUKTnyY8OOYfj7yNP5U4fKuDUWl5vwE3TLhnIW7lYdKhcOwSYJVrosaeLoNQjdxuZiPM9XnyqPFGBHY28YkFQ+TZF8G1lC+60i8FD6zwL/1st+/g/nbcqb3jeCJEzqyARFjHSi2KGeoSQVwnnBLRY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887028350746.5065450737504; Thu, 15 Aug 2019 09:37:08 -0700 (PDT) Received: from localhost ([::1]:44222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIkK-0002sf-Lo for importer@patchew.org; Thu, 15 Aug 2019 12:37:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47116) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIig-0001Iw-ET for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIic-000262-5z for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44012) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIib-00025q-Ue for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0779A300163C; Thu, 15 Aug 2019 16:35:17 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FA3160F8C; Thu, 15 Aug 2019 16:35:13 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:33 +0100 Message-Id: <20190815163504.18937-3-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 15 Aug 2019 16:35:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/33] hw/net: fix vmxnet3 live migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marcel Apfelbaum At some point vmxnet3 live migration stopped working and git-bisect didn't help finding a working version. The issue is the PCI configuration space is not being migrated successfully and MSIX remains masked at destination. Remove the migration differentiation between PCI and PCIe since the logic resides now inside VMSTATE_PCI_DEVICE. Remove also the VMXNET3_COMPAT_FLAG_DISABLE_PCIE based differentiation since at 'realize' time is decided if the device is PCI or PCIe, then the above macro is enough. Use the opportunity to move to the standard VMSTATE_MSIX instead of the deprecated SaveVMHandlers. Signed-off-by: Marcel Apfelbaum Message-Id: <20190705010711.23277-1-marcel.apfelbaum@gmail.com> Tested-by: Sukrit Bhatnagar Reviewed-by: Dmitry Fleytman Signed-off-by: Dr. David Alan Gilbert --- hw/net/vmxnet3.c | 52 ++---------------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 10d01d0058..8b17548b02 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2141,21 +2141,6 @@ vmxnet3_cleanup_msi(VMXNET3State *s) msi_uninit(d); } =20 -static void -vmxnet3_msix_save(QEMUFile *f, void *opaque) -{ - PCIDevice *d =3D PCI_DEVICE(opaque); - msix_save(d, f); -} - -static int -vmxnet3_msix_load(QEMUFile *f, void *opaque, int version_id) -{ - PCIDevice *d =3D PCI_DEVICE(opaque); - msix_load(d, f); - return 0; -} - static const MemoryRegionOps b0_ops =3D { .read =3D vmxnet3_io_bar0_read, .write =3D vmxnet3_io_bar0_write, @@ -2176,11 +2161,6 @@ static const MemoryRegionOps b1_ops =3D { }, }; =20 -static SaveVMHandlers savevm_vmxnet3_msix =3D { - .save_state =3D vmxnet3_msix_save, - .load_state =3D vmxnet3_msix_load, -}; - static uint64_t vmxnet3_device_serial_num(VMXNET3State *s) { uint64_t dsn_payload; @@ -2203,7 +2183,6 @@ static uint64_t vmxnet3_device_serial_num(VMXNET3Stat= e *s) =20 static void vmxnet3_pci_realize(PCIDevice *pci_dev, Error **errp) { - DeviceState *dev =3D DEVICE(pci_dev); VMXNET3State *s =3D VMXNET3(pci_dev); int ret; =20 @@ -2249,8 +2228,6 @@ static void vmxnet3_pci_realize(PCIDevice *pci_dev, E= rror **errp) pcie_dev_ser_num_init(pci_dev, VMXNET3_DSN_OFFSET, vmxnet3_device_serial_num(s)); } - - register_savevm_live(dev, "vmxnet3-msix", -1, 1, &savevm_vmxnet3_msix,= s); } =20 static void vmxnet3_instance_init(Object *obj) @@ -2440,29 +2417,6 @@ static const VMStateDescription vmstate_vmxnet3_int_= state =3D { } }; =20 -static bool vmxnet3_vmstate_need_pcie_device(void *opaque) -{ - VMXNET3State *s =3D VMXNET3(opaque); - - return !(s->compat_flags & VMXNET3_COMPAT_FLAG_DISABLE_PCIE); -} - -static bool vmxnet3_vmstate_test_pci_device(void *opaque, int version_id) -{ - return !vmxnet3_vmstate_need_pcie_device(opaque); -} - -static const VMStateDescription vmstate_vmxnet3_pcie_device =3D { - .name =3D "vmxnet3/pcie", - .version_id =3D 1, - .minimum_version_id =3D 1, - .needed =3D vmxnet3_vmstate_need_pcie_device, - .fields =3D (VMStateField[]) { - VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State), - VMSTATE_END_OF_LIST() - } -}; - static const VMStateDescription vmstate_vmxnet3 =3D { .name =3D "vmxnet3", .version_id =3D 1, @@ -2470,9 +2424,8 @@ static const VMStateDescription vmstate_vmxnet3 =3D { .pre_save =3D vmxnet3_pre_save, .post_load =3D vmxnet3_post_load, .fields =3D (VMStateField[]) { - VMSTATE_STRUCT_TEST(parent_obj, VMXNET3State, - vmxnet3_vmstate_test_pci_device, 0, - vmstate_pci_device, PCIDevice), + VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State), + VMSTATE_MSIX(parent_obj, VMXNET3State), VMSTATE_BOOL(rx_packets_compound, VMXNET3State), VMSTATE_BOOL(rx_vlan_stripping, VMXNET3State), VMSTATE_BOOL(lro_supported, VMXNET3State), @@ -2508,7 +2461,6 @@ static const VMStateDescription vmstate_vmxnet3 =3D { }, .subsections =3D (const VMStateDescription*[]) { &vmxstate_vmxnet3_mcast_list, - &vmstate_vmxnet3_pcie_device, NULL } }; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887173; cv=none; d=zoho.com; s=zohoarc; b=ArprQod8IucyxUdzFTR1MSdkSUsXoPRBPMGnjwUsWzt1rIXfVq1jgdmrbRoxFLRbXXhYgy1bi1hzu8UEnaFQLj30mAzk1UoFMuDyQsnGxHrh/5a3+d4o8am8jKxkz6jLgACMEiBvekZ1f609ZzMpXcAowGFfCkp4Ua20KI1z+Hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887173; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0Fxn6S1x5BiS8NaIxvjy0BIbfJe6GGb/DXu9/Iq+5CY=; b=F1MKTzUkSkKLUS/rCVZFurcVMW4R3+e+iWxyN9kR0XfB2cRf31dx1aQG9aoRCmAVFxPbYcnYrG9DwQU0j3WwJiOP4Ea1KkOLLf/T7BRZmJt6cik/8QEVqMyvZKfulpwbQ4m4+gCfrmLK5pq4cBNh6igGzz/2pY8pg0sD3pKIXqk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887173123878.1519325886943; Thu, 15 Aug 2019 09:39:33 -0700 (PDT) Received: from localhost ([::1]:44328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyImh-0006Tl-Aj for importer@patchew.org; Thu, 15 Aug 2019 12:39:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47132) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIii-0001L7-Pj for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIid-00026u-Qd for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIid-00026W-Ge for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8D448E37A; Thu, 15 Aug 2019 16:35:18 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50B5A60F8C; Thu, 15 Aug 2019 16:35:17 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:34 +0100 Message-Id: <20190815163504.18937-4-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 15 Aug 2019 16:35:18 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/33] migration: consolidate time info into populate_time_info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Consolidate time information fill up into its function for better readability. Signed-off-by: Wei Yang Message-Id: <20190716005411.4156-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 28342969ea..7c66da3a83 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -823,6 +823,25 @@ bool migration_is_setup_or_active(int state) } } =20 +static void populate_time_info(MigrationInfo *info, MigrationState *s) +{ + info->has_status =3D true; + info->has_setup_time =3D true; + info->setup_time =3D s->setup_time; + if (s->state =3D=3D MIGRATION_STATUS_COMPLETED) { + info->has_total_time =3D true; + info->total_time =3D s->total_time; + info->has_downtime =3D true; + info->downtime =3D s->downtime; + } else { + info->has_total_time =3D true; + info->total_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - + s->start_time; + info->has_expected_downtime =3D true; + info->expected_downtime =3D s->expected_downtime; + } +} + static void populate_ram_info(MigrationInfo *info, MigrationState *s) { info->has_ram =3D true; @@ -908,16 +927,8 @@ static void fill_source_migration_info(MigrationInfo *= info) case MIGRATION_STATUS_DEVICE: case MIGRATION_STATUS_POSTCOPY_PAUSED: case MIGRATION_STATUS_POSTCOPY_RECOVER: - /* TODO add some postcopy stats */ - info->has_status =3D true; - info->has_total_time =3D true; - info->total_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - - s->start_time; - info->has_expected_downtime =3D true; - info->expected_downtime =3D s->expected_downtime; - info->has_setup_time =3D true; - info->setup_time =3D s->setup_time; - + /* TODO add some postcopy stats */ + populate_time_info(info, s); populate_ram_info(info, s); populate_disk_info(info); break; @@ -926,14 +937,7 @@ static void fill_source_migration_info(MigrationInfo *= info) /* TODO: display COLO specific information (checkpoint info etc.) = */ break; case MIGRATION_STATUS_COMPLETED: - info->has_status =3D true; - info->has_total_time =3D true; - info->total_time =3D s->total_time; - info->has_downtime =3D true; - info->downtime =3D s->downtime; - info->has_setup_time =3D true; - info->setup_time =3D s->setup_time; - + populate_time_info(info, s); populate_ram_info(info, s); break; case MIGRATION_STATUS_FAILED: --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887179; cv=none; d=zoho.com; s=zohoarc; b=ag2FdzSNRIz8tDW/DWaMvMYUgH91tJNFkgarkHUQv4fHVqiEC9nFPg9fWQjYw7rkztV7J8FG9sOkA+ELuJiOuD7Kmit6ixXGyNIgZaWZYwBw7rXvvddCKHRelkuE7V7PK9hw+hnSqHQzhok5wKv35LjNoIkTdqwYoclPJSb411E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887179; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wkR3dpBN3LmDQQQh69XAQA6xOwiAoBxWqftsZW3+LSU=; b=Yuv3imIZnYoM8OgjsAGweQdJmgCEenuez76xMNwZfou1hbDSnkwwuNKHbQVt8mvTmKdQsJyRTzxMx055sVsPwl8kZokdgUHA0m98uqVdhW95nrpK+CwgkU0pPXrglM5eR8KRIHsBTovPV/QTO9TCR0TF9qRRS+Aj4x9WeGVHuxo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887179474876.1029362379685; Thu, 15 Aug 2019 09:39:39 -0700 (PDT) Received: from localhost ([::1]:44330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyImn-0006b4-U5 for importer@patchew.org; Thu, 15 Aug 2019 12:39:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIik-0001Mq-G5 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIif-00027V-Fd for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47944) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIif-00027C-AA for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D4D03084242; Thu, 15 Aug 2019 16:35:20 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E3883737; Thu, 15 Aug 2019 16:35:18 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:35 +0100 Message-Id: <20190815163504.18937-5-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 15 Aug 2019 16:35:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/33] migration/postcopy: the valid condition is one less then end X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang If one equals end, it means we have gone through the whole bitmap. Use a more restrict check to skip a unnecessary condition. Signed-off-by: Wei Yang Message-Id: <20190627020822.15485-2-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 889148dd84..68bc11c9e7 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2865,7 +2865,7 @@ static int postcopy_send_discard_bm_ram(MigrationStat= e *ms, for (current =3D 0; current < end; ) { unsigned long one =3D find_next_bit(unsentmap, end, current); =20 - if (one <=3D end) { + if (one < end) { unsigned long zero =3D find_next_zero_bit(unsentmap, end, one = + 1); unsigned long discard_length; =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887028; cv=none; d=zoho.com; s=zohoarc; b=NkGXFCKMWTYYNCV22WLnf8EqZYy8qWBKleZEnRvRQ+wZq8MiaygOWHQYhpTmT2eO/GVkOLmlYQ10bI+epfuQ7gV+y38CDCBuOMaPePAfg6R6wqnNvCHOINTLLLgoA4XQpz1HGona54Vh6Op4ZjoeOMI1jp0AbaZis89ORmpAs+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887028; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=348/HbUoq1+RTaLaOztJyKWEaB2TwQY2hrADteA+3Jo=; b=VZtFlN2CrX6UqnjxPC5Ycd3s77sBUayW6FEajLkxdb2hyg/m7XMtj5esHFO2l0Sy05+1uZu6+bYPZjzMVaYGHhoTZSU9QzfqN2L38vIgP+7YX87N5XBjhJC388Wa8bqnRSVizcfGbsC7eR+093k2vLdzn+sA/9IIWNY/uLSfyig= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887028855325.43675867998047; Thu, 15 Aug 2019 09:37:08 -0700 (PDT) Received: from localhost ([::1]:44236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIkN-0002yy-A5 for importer@patchew.org; Thu, 15 Aug 2019 12:37:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47153) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIik-0001N7-Pd for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIih-00028e-9j for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIih-00028N-4B for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B1FA30821A8; Thu, 15 Aug 2019 16:35:22 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id E28CA60F8C; Thu, 15 Aug 2019 16:35:20 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:36 +0100 Message-Id: <20190815163504.18937-6-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 15 Aug 2019 16:35:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/33] migration/postcopy: break the loop when there is no more page to discard X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang When one is equal or bigger then end, it means there is no page to discard. Just break the loop in this case instead of processing it. No functional change, just refactor it a little. Signed-off-by: Wei Yang Message-Id: <20190627020822.15485-3-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 68bc11c9e7..8a97dadec4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2864,23 +2864,23 @@ static int postcopy_send_discard_bm_ram(MigrationSt= ate *ms, =20 for (current =3D 0; current < end; ) { unsigned long one =3D find_next_bit(unsentmap, end, current); + unsigned long zero, discard_length; =20 - if (one < end) { - unsigned long zero =3D find_next_zero_bit(unsentmap, end, one = + 1); - unsigned long discard_length; + if (one >=3D end) { + break; + } =20 - if (zero >=3D end) { - discard_length =3D end - one; - } else { - discard_length =3D zero - one; - } - if (discard_length) { - postcopy_discard_send_range(ms, pds, one, discard_length); - } - current =3D one + discard_length; + zero =3D find_next_zero_bit(unsentmap, end, one + 1); + + if (zero >=3D end) { + discard_length =3D end - one; } else { - current =3D one; + discard_length =3D zero - one; + } + if (discard_length) { + postcopy_discard_send_range(ms, pds, one, discard_length); } + current =3D one + discard_length; } =20 return 0; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887391; cv=none; d=zoho.com; s=zohoarc; b=V/8ZXsudPWt8v9BwyWLA0cbLUP2mRl6+oYQ07kZNRAkReAs3YR1eF6fikkyVDQj7X8EKNZzwrtftwIB6H3vsgRu5o8sFVbv1AvBikBCKREYVzm1uyq0XKxwuODeGA7t6BU9W/nBvpiT4gUj7OzH5yvK4G4KF8aoGZCihHj5b8Ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887391; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=HRSnGZm0jT0o18ihaYjqNhygbX6Vw20SQJr8vvaSRNw=; b=JhInWXo2bXLho1qCCa9bu7zqKqWcNQoUndo7RTN66dYnvBTW16ekEGKvmfcq8W/dRKEwOnM84FRJ4HRyO9E9Rzdb1g6PwisyZiHvyrNuIWFrPMG2xUeuazF6zeC7IjPeNtO1zEObFS7/FLmvgq1sE4UEc+IigGb1knzEeOmrE4c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156588739155814.259818980505656; Thu, 15 Aug 2019 09:43:11 -0700 (PDT) Received: from localhost ([::1]:44362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIq9-0001j5-TE for importer@patchew.org; Thu, 15 Aug 2019 12:43:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47169) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIim-0001PL-TG for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIij-0002CL-2X for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIii-0002AS-Tc for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CC547FDCA; Thu, 15 Aug 2019 16:35:24 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id B61013737; Thu, 15 Aug 2019 16:35:22 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:37 +0100 Message-Id: <20190815163504.18937-7-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 15 Aug 2019 16:35:24 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/33] migration/postcopy: discard_length must not be 0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Since we break the loop when there is no more page to discard, we are sure the following process would find some page to discard. It is not necessary to check it again. Signed-off-by: Wei Yang Message-Id: <20190627020822.15485-4-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 8a97dadec4..4bb5e24459 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2877,9 +2877,7 @@ static int postcopy_send_discard_bm_ram(MigrationStat= e *ms, } else { discard_length =3D zero - one; } - if (discard_length) { - postcopy_discard_send_range(ms, pds, one, discard_length); - } + postcopy_discard_send_range(ms, pds, one, discard_length); current =3D one + discard_length; } =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887583; cv=none; d=zoho.com; s=zohoarc; b=KztmrLzBXWdvzuX/NlrqGJNrgoW920WN7INDbDwL8NFOaqwm56rOYRqTJ1D6U/a0vrfbr8/xhZKodTNUCtNtwaWv2Vhu/8KEtO/zSO7OYAq9vLH5Jvov9DFDViR1LxxbznBWQKBx0Mk48Dozye/n9DkKi8az9uIdl8SxJ04lxXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887583; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=48buIW7WoNr7+K4+LWHYND9Euyn2D6XZQgowPT9FJiE=; b=lOAQsoB+/BVpZJYjBB4uPIjfrN7QZW7v+lqKrufT8AvYz9L0iuTA2101jLerMlcjwKt9Dbk/1W8T9XUaymDjEd8Ml/dohPQIarG60XSU3kRqu8A5gd9HOgCILKhK5f4DnBngxcVYq15C1aCYzeswaphfReKMtAqtgIrK1/bt/5w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887583745810.6423158753447; Thu, 15 Aug 2019 09:46:23 -0700 (PDT) Received: from localhost ([::1]:44392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyItK-0005TY-4M for importer@patchew.org; Thu, 15 Aug 2019 12:46:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47204) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIir-0001WX-ED for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIin-0002FV-F4 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58802) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIin-0002F5-AC for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E186302C07A; Thu, 15 Aug 2019 16:35:28 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 889353737; Thu, 15 Aug 2019 16:35:24 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:38 +0100 Message-Id: <20190815163504.18937-8-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 15 Aug 2019 16:35:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/33] migration/postcopy: reduce one operation to calculate fixup_start_addr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Use the same way for run_end to calculate run_start, which saves one operation. Signed-off-by: Wei Yang Message-Id: <20190710050814.31344-2-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 4bb5e24459..da399f2c8a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2973,10 +2973,12 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, host_offset =3D run_start % host_ratio; if (host_offset) { do_fixup =3D true; - run_start -=3D host_offset; - fixup_start_addr =3D run_start; - /* For the next pass */ - run_start =3D run_start + host_ratio; + fixup_start_addr =3D run_start - host_offset; + /* + * This host page has gone, the next loop iteration starts + * from after the fixup + */ + run_start =3D fixup_start_addr + host_ratio; } else { /* Find the end of this run */ unsigned long run_end; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887459; cv=none; d=zoho.com; s=zohoarc; b=O6LQREivrwf7XpzdSmjjQrtNYhe9KsxeamYJYC1zizKKj59T54N0iaoOpJqaAIS+YaPVXkqYFmZIgfNA6shvtJdIgzwlLhwEvtg4bZDX4dsljdgb3xuT3vXHtkAQGq8YvnEeDXmRAb25Bbnuu13bgqXM6FPB8i6L8X55SIZFBKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887459; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=bom9XXBm+czF7aBj8ZiF8JTA4XRFOr08QSsRFUfJtCs=; b=V7qPfqN524yoyqnaHXki+/Fsn7OlU1KfktWvZo9BX2OEX8pT5e3v093wBT46LV4Rgzi9bkEX2CY8uZD8G+Hk8i/wrXwpikzy851PgOIL+qwmV5BN0u/GcXD2EWK4FT6xNHZPhNzFfQBnNYstv9NCLr5sLYmC266y/6heN5ayTwk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887459354402.88523852465255; Thu, 15 Aug 2019 09:44:19 -0700 (PDT) Received: from localhost ([::1]:44366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIrJ-0002vQ-GH for importer@patchew.org; Thu, 15 Aug 2019 12:44:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47220) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIit-0001aO-Td for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIip-0002GF-8l for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIip-0002Fy-3Q for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:31 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F9C58666C; Thu, 15 Aug 2019 16:35:30 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id E868160F8C; Thu, 15 Aug 2019 16:35:28 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:39 +0100 Message-Id: <20190815163504.18937-9-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 15 Aug 2019 16:35:30 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/33] migration/postcopy: do_fixup is true when host_offset is non-zero X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang This means it is not necessary to spare an extra variable to hold this condition. Use host_offset directly is fine. Signed-off-by: Wei Yang Message-Id: <20190710050814.31344-3-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index da399f2c8a..255f289bbb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2962,7 +2962,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, } =20 while (run_start < pages) { - bool do_fixup =3D false; unsigned long fixup_start_addr; unsigned long host_offset; =20 @@ -2972,7 +2971,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, */ host_offset =3D run_start % host_ratio; if (host_offset) { - do_fixup =3D true; fixup_start_addr =3D run_start - host_offset; /* * This host page has gone, the next loop iteration starts @@ -2994,7 +2992,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, */ host_offset =3D run_end % host_ratio; if (host_offset) { - do_fixup =3D true; fixup_start_addr =3D run_end - host_offset; /* * This host page has gone, the next loop iteration starts @@ -3010,7 +3007,7 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, } } =20 - if (do_fixup) { + if (host_offset) { unsigned long page; =20 /* Tell the destination to discard this page */ --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887374; cv=none; d=zoho.com; s=zohoarc; b=h6Ub/FB7xO1dgUDXJQJ/gjwcCZpnm+3D824P4EMDub7kfKPvs3W+mCKbG4BJtYMOB6Bz6pBD5ZvS8m2K9Km+MXLvZgMdzRl4HVDwo2pJFbgxUpu/8uMUV/re40VXG106yObi0Y0OHsJ9yAbEgR2CX5h2UsX0FqSyTobh8iMJR7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887374; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=nF4nAeHzi/YiKcjR3VBcitK6yOWPoucbDkvoiaeUbeY=; b=hBTHYvheupMVi/GhxEacqRRgQnuQOVd/4QVguJg52/Gl9GBoA8RyHiRzbsSdNqiVnbZP0ypF3zd+GN9JSwEdG2iOfvFdFJVEhprybpGvMrek19Axbi+Vbqy08/DIvxXn90h11lo+UGx2k9OvHT/N5tlhicCZIEkRYSEIHud2z7s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887374823868.9038227122205; Thu, 15 Aug 2019 09:42:54 -0700 (PDT) Received: from localhost ([::1]:44360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIps-0001PU-0E for importer@patchew.org; Thu, 15 Aug 2019 12:42:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47226) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIiu-0001ag-Iu for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIir-0002H3-5Z for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45644) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIir-0002Gm-0i for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4475A30A7BAE; Thu, 15 Aug 2019 16:35:32 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBAE0BAAC; Thu, 15 Aug 2019 16:35:30 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:40 +0100 Message-Id: <20190815163504.18937-10-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 15 Aug 2019 16:35:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/33] migration/savevm: flush file for iterable_only case X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang It would be proper to flush file even for iterable_only case. Signed-off-by: Wei Yang Message-Id: <20190709140924.13291-2-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index a2a5f89b75..0bfdceefcc 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1292,7 +1292,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, b= ool iterable_only, } =20 if (iterable_only) { - return 0; + goto flush; } =20 vmdesc =3D qjson_new(); @@ -1353,6 +1353,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, b= ool iterable_only, } qjson_destroy(vmdesc); =20 +flush: qemu_fflush(f); return 0; } --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887779; cv=none; d=zoho.com; s=zohoarc; b=ANb648Y8RbqqOzXWFHfC6gGBh3ZFQryA7ZrnJn4cW47cX/h9059jzQq9KQXloxcOA9YHftATgImcSwcN5Pkanlq3Uqq6ZEL55nonwHKnluQBAxQdjKl7gjXEJbGbnb/bp7loQeUbflFv8ftg8nBDSxCSs3oqOxgVKDC+jmBlaT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887779; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Zm2u1U4jc/8KbVm2rx6ZQWJLRntBX+l8avnngctay5o=; b=csdGANcMfThhLcg9iXwqbeh8s6TfCT88vxuRMbydux5Kz0RBVbXMdv5+GthJ384ew98yYXA0HITjAjTj1hTUJKzdYvwEDO3pChGsSxJ2CHzyIVlVgYvIePLsL9nAUWllBc07tn5qeQloWY9GbdFCK3WUSlV9ALBL5f1xn6GjArg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887779832893.9862287587629; Thu, 15 Aug 2019 09:49:39 -0700 (PDT) Received: from localhost ([::1]:44440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIwU-0000d0-84 for importer@patchew.org; Thu, 15 Aug 2019 12:49:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47246) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIiz-0001gi-Bs for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIiu-0002Kc-Lu for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38620) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIiu-0002JQ-EH for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:36 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79DB53002069; Thu, 15 Aug 2019 16:35:35 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E0A7BAAC; Thu, 15 Aug 2019 16:35:32 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:41 +0100 Message-Id: <20190815163504.18937-11-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 15 Aug 2019 16:35:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/33] migration/savevm: split qemu_savevm_state_complete_precopy() into two parts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang This is a preparation patch for further cleanup. No functional change, just wrap two major part of qemu_savevm_state_complete_precopy() into function. Signed-off-by: Wei Yang Message-Id: <20190709140924.13291-3-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 66 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 0bfdceefcc..63545a3026 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1246,23 +1246,12 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *= f) qemu_fflush(f); } =20 -int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only, - bool inactivate_disks) +static +int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy, + bool iterable_only) { - QJSON *vmdesc; - int vmdesc_len; SaveStateEntry *se; int ret; - bool in_postcopy =3D migration_in_postcopy(); - Error *local_err =3D NULL; - - if (precopy_notify(PRECOPY_NOTIFY_COMPLETE, &local_err)) { - error_report_err(local_err); - } - - trace_savevm_state_complete_precopy(); - - cpu_synchronize_all_states(); =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || @@ -1291,9 +1280,18 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, = bool iterable_only, } } =20 - if (iterable_only) { - goto flush; - } + return 0; +} + +static +int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, + bool in_postcopy, + bool inactivate_disks) +{ + QJSON *vmdesc; + int vmdesc_len; + SaveStateEntry *se; + int ret; =20 vmdesc =3D qjson_new(); json_prop_int(vmdesc, "page_size", qemu_target_page_size()); @@ -1353,6 +1351,40 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, = bool iterable_only, } qjson_destroy(vmdesc); =20 + return 0; +} + +int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only, + bool inactivate_disks) +{ + int ret; + Error *local_err =3D NULL; + bool in_postcopy =3D migration_in_postcopy(); + + if (precopy_notify(PRECOPY_NOTIFY_COMPLETE, &local_err)) { + error_report_err(local_err); + } + + trace_savevm_state_complete_precopy(); + + cpu_synchronize_all_states(); + + ret =3D qemu_savevm_state_complete_precopy_iterable(f, in_postcopy, + iterable_only); + if (ret) { + return ret; + } + + if (iterable_only) { + goto flush; + } + + ret =3D qemu_savevm_state_complete_precopy_non_iterable(f, in_postcopy, + inactivate_disks= ); + if (ret) { + return ret; + } + flush: qemu_fflush(f); return 0; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887573; cv=none; d=zoho.com; s=zohoarc; b=GLC9i461xOQTZ9aG0VBQF/V5jk1XdPQTQ+KNojPvsFbokPbsMq+kAzi4CYtmazjJ09DMnMSgVe9dANCZhRLSX+FVlbFmkgJJM9cQ+IousTgxSKjDp/HcAiak4ak+npMuhlLATOYreGqLqt1WlblfS9QGIzgScm8yQzCxNKFPDkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887573; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lbTMyes8t3+yhYQfiNDXrtwUsCYdNPijhBSU2aEup38=; b=Wi+n1BBoELjjVU690f+AJNeb2T+CF7ikAGVjuYhulGYKJPW6iM0UL/t9yxxhGqDT8wDFtuPz4lFJrpprjMjIKBPFKgl8nh8BZN1zHxS+bOLOnfQrAYFZp7awQZuR1Gcf/l74+hxR4HQb5+uu6H4ZvRzYZGbJNj7npwtG9FCOKHE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887573071689.7404551006821; Thu, 15 Aug 2019 09:46:13 -0700 (PDT) Received: from localhost ([::1]:44390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIt9-000583-9m for importer@patchew.org; Thu, 15 Aug 2019 12:46:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47269) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIj6-0001jO-4l for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIj0-0002PI-Bc for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54762) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIj0-0002Ol-5v for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7282065F58; Thu, 15 Aug 2019 16:35:41 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3C7FBAAC; Thu, 15 Aug 2019 16:35:35 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:42 +0100 Message-Id: <20190815163504.18937-12-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 15 Aug 2019 16:35:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/33] migration/savevm: move non SaveStateEntry condition check out of iteration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang in_postcopy and iterable_only are not SaveStateEntry specific, it would be more proper to check them out of iteration. Signed-off-by: Wei Yang Message-Id: <20190709140924.13291-4-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 63545a3026..69a827a92f 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1247,8 +1247,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) } =20 static -int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy, - bool iterable_only) +int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy) { SaveStateEntry *se; int ret; @@ -1257,7 +1256,6 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUF= ile *f, bool in_postcopy, if (!se->ops || (in_postcopy && se->ops->has_postcopy && se->ops->has_postcopy(se->opaque)) || - (in_postcopy && !iterable_only) || !se->ops->save_live_complete_precopy) { continue; } @@ -1369,10 +1367,11 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f,= bool iterable_only, =20 cpu_synchronize_all_states(); =20 - ret =3D qemu_savevm_state_complete_precopy_iterable(f, in_postcopy, - iterable_only); - if (ret) { - return ret; + if (!in_postcopy || iterable_only) { + ret =3D qemu_savevm_state_complete_precopy_iterable(f, in_postcopy= ); + if (ret) { + return ret; + } } =20 if (iterable_only) { --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887676; cv=none; d=zoho.com; s=zohoarc; b=aTADhyRgGeXJha7j03bjXyWkaq9fd5l8CxdwolPvMptD9U6+caGvhxHhYaoZWVOlGFcPdxvTVuTW3hn504+0iDel8kKtKQpKdKYayEInDvHs1WomY26og0M2ZRPMPCYCHTB76ye9wZoU9+yQ0SfXTS7bJAro/E/xpHBGRXCFm7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887676; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=RlBvcQGLECv1EnhnqkN54HwcEHEi+NYbYGFNb8vDz7c=; b=EXPPhnvJi7UpaYnHtlAgssXsujVZnOJDCCfr+pDXHGxGBgtyNrfptrlfABV384tsywNtR+R/mnUDTK/g6AsLFoyY7YBO/gaVnRfeJpW1izEEBqKU2rx+xQoORNqBJMHNUQ+bHNxq2mkLvWJ4LOrj6wqayD/beGBEtuNw8hofZa4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887676568111.64174937718008; Thu, 15 Aug 2019 09:47:56 -0700 (PDT) Received: from localhost ([::1]:44398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIuo-0006pe-PM for importer@patchew.org; Thu, 15 Aug 2019 12:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47286) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjD-0001pj-2M for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIj8-0002an-Ly for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45788) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIj8-0002Ze-Fb for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C521530A7B82; Thu, 15 Aug 2019 16:35:49 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCD9A138FF; Thu, 15 Aug 2019 16:35:41 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:43 +0100 Message-Id: <20190815163504.18937-13-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 15 Aug 2019 16:35:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/33] migration/postcopy: PostcopyState is already set in loadvm_postcopy_handle_advise() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang PostcopyState is already set to ADVISE at the beginning of loadvm_postcopy_handle_advise(). Remove the redundant set. Signed-off-by: Wei Yang Message-Id: <20190711080816.6405-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 69a827a92f..eed5e551da 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1648,8 +1648,6 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis, return -1; } =20 - postcopy_state_set(POSTCOPY_INCOMING_ADVISE); - return 0; } =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887924; cv=none; d=zoho.com; s=zohoarc; b=gz3I7Q/vn+7KSYnt8MnOQWzN3g0bHovq9kzOEYo4C6o8lHVEFZ0RloVGoGTiiSvdFMEZhUkcfvhTaZBOTWmiDqIk9oT9ynzowN7VXP+AvCrraSR7V5djCO81xm7Ytz1JppvkpfiXSYZaTWE+lCrNtSBIr+PBfaV0D+dnrI1MFOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887924; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=RH6qELtJgIy42/nbn8ddLXAKu+NREX5FtFEAGv51SbY=; b=Sa7yjiUf3vjwulEjQ2wNzUfb7twu8+nLKxfWdAlDsPpbfPxszRcpVM3Cxqvt80v1di2oCzS3kggNxOj8IhKsEMkw8zXXATBaB/nOYxOYuDfGXgGtkjBUPO5y3RiJKVGqowRZpq9Sj1HDu3HG2RoL6l4e3db8YMIQQXULBu4s9uU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887924541664.842294595352; Thu, 15 Aug 2019 09:52:04 -0700 (PDT) Received: from localhost ([::1]:44464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIyp-0004Cs-0d for importer@patchew.org; Thu, 15 Aug 2019 12:52:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47300) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjI-0001yV-0F for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjE-0002h1-2I for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44268) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjD-0002fk-Rf for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:35:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FBEE2A09B2; Thu, 15 Aug 2019 16:35:55 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A4BCBAAC; Thu, 15 Aug 2019 16:35:49 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:44 +0100 Message-Id: <20190815163504.18937-14-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 15 Aug 2019 16:35:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/33] migration/postcopy: start_postcopy could be true only when migrate_postcopy() return true X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang There is only one place to set start_postcopy to true, qmp_migrate_start_postcopy(), which make sure start_postcopy could be set to true when migrate_postcopy() return true. So start_postcopy is true implies the other one. Signed-off-by: Wei Yang Message-Id: <20190718083747.5859-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 7c66da3a83..8331e62831 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3103,8 +3103,7 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) =20 if (pending_size && pending_size >=3D s->threshold_size) { /* Still a significant amount to transfer */ - if (migrate_postcopy() && !in_postcopy && - pend_pre <=3D s->threshold_size && + if (!in_postcopy && pend_pre <=3D s->threshold_size && atomic_read(&s->start_postcopy)) { if (postcopy_start(s)) { error_report("%s: postcopy failed to start", __func__); --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887071; cv=none; d=zoho.com; s=zohoarc; b=WmVVXlApN0oQn6+FBwT5dG7x79Dh3gZdVIeWxaYrA1xBR80mOSWnFjJjzbJFAJnWA/2hr2oA5h5djT3AAdzhkMDTUdG9t+tQG6/4tA8EcrKxCeh8QvF8rdTuE3ePaMAI4ji+IYEdPvKxdTw1aYln1rT6UskgX6tUuYgtiZQbm0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887071; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=74EbTqHimDstu6E+Kl5aixFiymKOHdY0xmCl3UF2HRM=; b=EkGMds5vmpFjb54V53UeAOwQsf0EqDN9bFe3j5AA641ojIudNUrGS7tTUuXAkjeIdZcc+HWvMBtVGVYojrPl83r3rp+y10SlSsnE1hoqK8h63Dh1sDE0fScGl8vQ2k8AuO3QdlUOB94TzHPpxpf1UdLNiWkNv4gIPbkAY06a5lY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887071144468.3742107523419; Thu, 15 Aug 2019 09:37:51 -0700 (PDT) Received: from localhost ([::1]:44298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIl0-00041X-RU for importer@patchew.org; Thu, 15 Aug 2019 12:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47316) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjN-00026n-3O for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjJ-0002lw-2O for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjI-0002jk-To for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3924230917AB; Thu, 15 Aug 2019 16:36:00 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79D353737; Thu, 15 Aug 2019 16:35:55 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:45 +0100 Message-Id: <20190815163504.18937-15-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 15 Aug 2019 16:36:00 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 14/33] migration: use migration_in_postcopy() to check POSTCOPY_ACTIVE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Use common helper function to check the state. Signed-off-by: Wei Yang Message-Id: <20190719071129.11880-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 3036221ee8..0e73e759ca 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3140,7 +3140,7 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *= opaque, =20 CHECK_ERROR_STATE(); =20 - if (migrate_get_current()->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTI= VE) { + if (migration_in_postcopy()) { rcu_read_unlock(); return RAM_SAVE_CONTROL_NOT_SUPP; } @@ -3775,7 +3775,7 @@ static int qemu_rdma_registration_start(QEMUFile *f, = void *opaque, =20 CHECK_ERROR_STATE(); =20 - if (migrate_get_current()->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTI= VE) { + if (migration_in_postcopy()) { rcu_read_unlock(); return 0; } @@ -3810,7 +3810,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, v= oid *opaque, =20 CHECK_ERROR_STATE(); =20 - if (migrate_get_current()->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTI= VE) { + if (migration_in_postcopy()) { rcu_read_unlock(); return 0; } --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887778; cv=none; d=zoho.com; s=zohoarc; b=UBXxf5PySlyDitDJlsG3VMV6X5vK9nFqjAbyc4kpcAEYRx5mNqwKrcab8fvyz6nRggjptvhHzawfAXA3wQGyM6Nf1DEuFXrrsKdm8litDEXPKdJcyriH+Zc2C1gsc5wptptNUEfLZYzKawuSfhUd23mS2VpOR6lKylIkwUwv8jM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887778; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ev4FJ0jEJ5u9X6Ph3a+LQyXi0TdS9D1ihshSwpSMjCY=; b=cZ2tZF91peBRDIm5RirS5kr07Jyo0wxUHdig/km5T/vfXWmgRE+GaiLD1ImmrIEyUTG+uQNhjY5+uXWIoQrdUvJZNwnKGEksOl6iR5X59yuxNkyiM5fJiO08x5XI864S3uAJiXvDIRvLntjSWMcxEREl9e716NGDdHqtZzgIKbw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887778026514.7053037521251; Thu, 15 Aug 2019 09:49:38 -0700 (PDT) Received: from localhost ([::1]:44438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIwJ-0000O8-Oc for importer@patchew.org; Thu, 15 Aug 2019 12:49:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47354) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjU-0002Iy-Uh for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjQ-0002x4-VY for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48204) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjQ-0002wq-QY for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 271C7308404E; Thu, 15 Aug 2019 16:36:08 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82DEE3737; Thu, 15 Aug 2019 16:36:00 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:46 +0100 Message-Id: <20190815163504.18937-16-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 15 Aug 2019 16:36:08 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 15/33] migration: just pass RAMBlock is enough X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang RAMBlock->used_length is always passed to migration_bitmap_sync_range(), which could be retrieved from RAMBlock. Suggested-by: Paolo Bonzini Signed-off-by: Wei Yang Message-Id: <20190718012547.16373-1-richardw.yang@linux.intel.com> Reviewed-by: Peter Xu Reviewed-by: Paolo Bonzini Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 255f289bbb..97f241d6d9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1748,11 +1748,10 @@ static inline bool migration_bitmap_clear_dirty(RAM= State *rs, } =20 /* Called with RCU critical section */ -static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb, - ram_addr_t length) +static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb) { rs->migration_dirty_pages +=3D - cpu_physical_memory_sync_dirty_bitmap(rb, 0, length, + cpu_physical_memory_sync_dirty_bitmap(rb, 0, rb->used_length, &rs->num_dirty_pages_period); } =20 @@ -1841,7 +1840,7 @@ static void migration_bitmap_sync(RAMState *rs) qemu_mutex_lock(&rs->bitmap_mutex); rcu_read_lock(); RAMBLOCK_FOREACH_NOT_IGNORED(block) { - migration_bitmap_sync_range(rs, block, block->used_length); + migration_bitmap_sync_range(rs, block); } ram_counters.remaining =3D ram_bytes_remaining(); rcu_read_unlock(); @@ -4293,7 +4292,7 @@ static void colo_flush_ram_cache(void) memory_global_dirty_log_sync(); rcu_read_lock(); RAMBLOCK_FOREACH_NOT_IGNORED(block) { - migration_bitmap_sync_range(ram_state, block, block->used_length); + migration_bitmap_sync_range(ram_state, block); } rcu_read_unlock(); =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888081; cv=none; d=zoho.com; s=zohoarc; b=B/4rWDEvGAZSvVyxTSAnTz5x3C2erexouvajnVorPlPWsVPyguvs3GZ7L6wnXbvA84fKGWY/PQyzax0fQ/jidv4YDnLKfE0arHbvS68QNMGRMZOa8xwfl9peMtayb+h1VG4zM62UVBLqcN59fX+DgGxgyWN30JizrAf4K5HbhcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888081; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=csLftzuiZ91BkJAeHXfWEHCv+fMsyblvbq/YVkYuTCc=; b=bW+ADM9nNlC6QYyWorPd5EPM8SrnN3UvmMHu298g471oC4912Q5NGTrNV1ljNn++ODPPXukoIa2nUFgh8wz27X9sfdX56jQs33ylaiVNUO8nnwQO1ASYnjG110i7sb/SSRXUOx8GD29rpud3vifesp7QAJ9eJJWzbVYQ+rx5aY0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888081511585.002016679579; Thu, 15 Aug 2019 09:54:41 -0700 (PDT) Received: from localhost ([::1]:44508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ1J-0007qm-Tc for importer@patchew.org; Thu, 15 Aug 2019 12:54:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47371) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjZ-0002PB-Cj for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjT-00033D-Qf for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45956) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjT-00031W-Kb for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4DBD309B693; Thu, 15 Aug 2019 16:36:10 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71A90BAAC; Thu, 15 Aug 2019 16:36:08 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:47 +0100 Message-Id: <20190815163504.18937-17-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 15 Aug 2019 16:36:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 16/33] migration: equation is more proper than and to check LOADVM_QUIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang LOADVM_QUIT allows a command to quit all layers of nested loadvm loops, while current return value check is not that proper even it works now. Current return value check "ret & LOADVM_QUIT" would return true if bit[0] is 1. This would be true when ret is -1 which is used to indicate an error of handling a command. Since there is only one place return LOADVM_QUIT and no other combination of return value, use "ret =3D=3D LOADVM_QUIT" would be more proper. Signed-off-by: Wei Yang Message-Id: <20190718064257.29218-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index eed5e551da..412768216c 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2437,7 +2437,7 @@ retry: case QEMU_VM_COMMAND: ret =3D loadvm_process_command(f); trace_qemu_loadvm_state_section_command(ret); - if ((ret < 0) || (ret & LOADVM_QUIT)) { + if ((ret < 0) || (ret =3D=3D LOADVM_QUIT)) { goto out; } break; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888229; cv=none; d=zoho.com; s=zohoarc; b=Df/1n6F5xZYVw3Jmoz1M0bJarAORYU9JuuvLyKc1y3+jYfkiAK2aO03OthGk6WJBidlSE+NPv9lWq7U8/w9EAhReoU58+B6mzOnDNgak8+t97c1Bpe5byGvJ7OueiLo7IswtV9AbjErgf5fL1zG1RPVqYbR/NRS/XbbShsLzcwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888229; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sfI0tZxPaWJtVpkQV6ZUv3hU3Rf7oqJWzZUjtMXj2hE=; b=MlBrpwOj9bQyMmLqSQD2cvrvhoUA61rKQNxGCDCv/+WDRoBQJjZxSklpqkOGEMfHRRqqBvlKZcPjukAprVPkcIrCVQFtmdLBB6BOeD/ACUAc5BMeKFGx99EzhnUjUjgBMRXr2Q9YWjrF32l3ECDOWkyYBBXMIsIVUSjgGbXZFlM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888229741965.8180159886696; Thu, 15 Aug 2019 09:57:09 -0700 (PDT) Received: from localhost ([::1]:44544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ3k-0002T3-98 for importer@patchew.org; Thu, 15 Aug 2019 12:57:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47368) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjZ-0002Oi-6O for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjV-00039o-JO for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51968) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjV-000370-EH for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B311130860DF; Thu, 15 Aug 2019 16:36:12 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 356573737; Thu, 15 Aug 2019 16:36:11 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:48 +0100 Message-Id: <20190815163504.18937-18-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 15 Aug 2019 16:36:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 17/33] migration: return -EINVAL directly when version_id mismatch X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang It is not reasonable to continue when version_id mismatch. Signed-off-by: Wei Yang Message-Id: <20190722075339.25121-2-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 97f241d6d9..6a75aedc91 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4334,7 +4334,7 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) seq_iter++; =20 if (version_id !=3D 4) { - ret =3D -EINVAL; + return -EINVAL; } =20 if (!migrate_use_compression()) { --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887841; cv=none; d=zoho.com; s=zohoarc; b=Aub85KDGuYUymPG7V3GpJzJHXK7n/ZHh7Sw2p5uVzQHaUbsBkVGg2r7fwQmdD4fD7R1rulyinDo9zUoECk9xco/jvftMPDQrgrDceAmj+sz6Qc6kOHoXzRs0K4EObr9wBROv3Yq8uR/I29t7WlqTVTgdAKXoWs8RLgb272CqfrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887841; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3Q+tKA4ZpFu3pQcosP/d3X8Ttodg6JVt4+nmU3ZRstU=; b=eiULT8gyeVhyitg8VkPJ9uJ4ItBSudeQdv7kFOdUzMKCfIkeM3Oc83ipdE7zfL1lwEZAzUDYKbyym+pRFT5y1Lc2oG+LIRodcPIQhgzjRpttMzWHChkTgKlfOYgP2rr6TTnsO8Ge3djvdD2J9iK0ZZzt/gp5Y/7PIMQFg8KJRyk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887841153529.7609758929723; Thu, 15 Aug 2019 09:50:41 -0700 (PDT) Received: from localhost ([::1]:44444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIxT-0001uO-KF for importer@patchew.org; Thu, 15 Aug 2019 12:50:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47387) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjc-0002Tv-Dx for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjY-0003DL-NN for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48266) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjY-0003Cy-Fv for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2612307C820; Thu, 15 Aug 2019 16:36:15 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 094A43737; Thu, 15 Aug 2019 16:36:12 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:49 +0100 Message-Id: <20190815163504.18937-19-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 15 Aug 2019 16:36:15 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 18/33] migration: extract ram_load_precopy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang After cleanup, it would be clear to audience there are two cases ram_load: * precopy * postcopy And it is not necessary to check postcopy_running on each iteration for precopy. Signed-off-by: Wei Yang Reviewed-by: Dr. David Alan Gilbert Message-Id: <20190725002023.2335-3-richardw.yang@linux.intel.com> Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 73 +++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 6a75aedc91..a44e9c0abc 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4318,40 +4318,26 @@ static void colo_flush_ram_cache(void) trace_colo_flush_ram_cache_end(); } =20 -static int ram_load(QEMUFile *f, void *opaque, int version_id) +/** + * ram_load_precopy: load pages in precopy case + * + * Returns 0 for success or -errno in case of error + * + * Called in precopy mode by ram_load(). + * rcu_read_lock is taken prior to this being called. + * + * @f: QEMUFile where to send the data + */ +static int ram_load_precopy(QEMUFile *f) { - int flags =3D 0, ret =3D 0, invalid_flags =3D 0; - static uint64_t seq_iter; - int len =3D 0; - /* - * If system is running in postcopy mode, page inserts to host memory = must - * be atomic - */ - bool postcopy_running =3D postcopy_is_running(); + int flags =3D 0, ret =3D 0, invalid_flags =3D 0, len =3D 0; /* ADVISE is earlier, it shows the source has the postcopy capability = on */ bool postcopy_advised =3D postcopy_is_advised(); - - seq_iter++; - - if (version_id !=3D 4) { - return -EINVAL; - } - if (!migrate_use_compression()) { invalid_flags |=3D RAM_SAVE_FLAG_COMPRESS_PAGE; } - /* This RCU critical section can be very long running. - * When RCU reclaims in the code start to become numerous, - * it will be necessary to reduce the granularity of this - * critical section. - */ - rcu_read_lock(); - - if (postcopy_running) { - ret =3D ram_load_postcopy(f); - } =20 - while (!postcopy_running && !ret && !(flags & RAM_SAVE_FLAG_EOS)) { + while (!ret && !(flags & RAM_SAVE_FLAG_EOS)) { ram_addr_t addr, total_ram_bytes; void *host =3D NULL; uint8_t ch; @@ -4502,6 +4488,39 @@ static int ram_load(QEMUFile *f, void *opaque, int v= ersion_id) } } =20 + return ret; +} + +static int ram_load(QEMUFile *f, void *opaque, int version_id) +{ + int ret =3D 0; + static uint64_t seq_iter; + /* + * If system is running in postcopy mode, page inserts to host memory = must + * be atomic + */ + bool postcopy_running =3D postcopy_is_running(); + + seq_iter++; + + if (version_id !=3D 4) { + return -EINVAL; + } + + /* + * This RCU critical section can be very long running. + * When RCU reclaims in the code start to become numerous, + * it will be necessary to reduce the granularity of this + * critical section. + */ + rcu_read_lock(); + + if (postcopy_running) { + ret =3D ram_load_postcopy(f); + } else { + ret =3D ram_load_precopy(f); + } + ret |=3D wait_for_decompress_done(); rcu_read_unlock(); trace_ram_load_complete(ret, seq_iter); --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887231; cv=none; d=zoho.com; s=zohoarc; b=NPQdl2fN9B4zoY8tFam5MAvk3emcgiw7Pk7yInwRzgZFedg/CSTKN0NXZvOrcvLeDCwSg/5aA8/Ha85tHlrB3C9jXDhVVX2rm1PhnunHFdJO16QTPlqS4vpeE8Kq9ifVTFBcnnDbtJ7Bl2HziMIxggTTMGfQHbvetiF25EcvJ4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887231; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1yxhNnDyOc3S2v5wsUE3K3CmQ839fp5X8d4eZiVxdCA=; b=AAq+DF/NRCUSs7VxZQYITWHRK2DC2neNysBJOGl0+SEgc5qOvelXyAkfsRuw1bo3r3p2gwuojCwxSG6VNRYRLcB8ZaI+2/PV8jciDheZhUpTyiXJ/0NrAFWpkWiQEtNCSKkms/IsUdNEj0Kr9fEtpCnwVLG+gE6ujx8TVhjEOyY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887231116357.79847485573794; Thu, 15 Aug 2019 09:40:31 -0700 (PDT) Received: from localhost ([::1]:44332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyInd-0007YS-Sp for importer@patchew.org; Thu, 15 Aug 2019 12:40:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47407) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIji-0002eG-Hg for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjb-0003Ef-JY for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44620) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjb-0003EM-CD for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AACE02A09A2; Thu, 15 Aug 2019 16:36:18 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18EC73737; Thu, 15 Aug 2019 16:36:15 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:50 +0100 Message-Id: <20190815163504.18937-20-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 15 Aug 2019 16:36:18 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 19/33] migration/postcopy: make PostcopyDiscardState a static variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang In postcopy-ram.c, we provide three functions to discard certain RAMBlock range: * postcopy_discard_send_init() * postcopy_discard_send_range() * postcopy_discard_send_finish() Currently, we allocate/deallocate PostcopyDiscardState for each RAMBlock on sending discard information to destination. This is not necessary and the same data area could be reused for each RAMBlock. This patch defines PostcopyDiscardState a static variable. By doing so: 1) avoid memory allocation and deallocation to the system 2) avoid potential failure of memory allocation 3) hide some details for their users Signed-off-by: Wei Yang Message-Id: <20190724010721.2146-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/postcopy-ram.c | 70 +++++++++++++++++----------------------- migration/postcopy-ram.h | 13 +++----- migration/ram.c | 30 +++++++---------- 3 files changed, 46 insertions(+), 67 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 9faacacc9e..2cb1a69752 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1377,22 +1377,16 @@ void postcopy_fault_thread_notify(MigrationIncoming= State *mis) * asking to discard individual ranges. * * @ms: The current migration state. - * @offset: the bitmap offset of the named RAMBlock in the migration - * bitmap. + * @offset: the bitmap offset of the named RAMBlock in the migration bitma= p. * @name: RAMBlock that discards will operate on. - * - * returns: a new PDS. */ -PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms, - const char *name) +static PostcopyDiscardState pds =3D {0}; +void postcopy_discard_send_init(MigrationState *ms, const char *name) { - PostcopyDiscardState *res =3D g_malloc0(sizeof(PostcopyDiscardState)); - - if (res) { - res->ramblock_name =3D name; - } - - return res; + pds.ramblock_name =3D name; + pds.cur_entry =3D 0; + pds.nsentwords =3D 0; + pds.nsentcmds =3D 0; } =20 /** @@ -1401,30 +1395,29 @@ PostcopyDiscardState *postcopy_discard_send_init(Mi= grationState *ms, * be sent later. * * @ms: Current migration state. - * @pds: Structure initialised by postcopy_discard_send_init(). * @start,@length: a range of pages in the migration bitmap in the * RAM block passed to postcopy_discard_send_init() (length=3D1 is one p= age) */ -void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState = *pds, - unsigned long start, unsigned long length) +void postcopy_discard_send_range(MigrationState *ms, unsigned long start, + unsigned long length) { size_t tp_size =3D qemu_target_page_size(); /* Convert to byte offsets within the RAM block */ - pds->start_list[pds->cur_entry] =3D start * tp_size; - pds->length_list[pds->cur_entry] =3D length * tp_size; - trace_postcopy_discard_send_range(pds->ramblock_name, start, length); - pds->cur_entry++; - pds->nsentwords++; + pds.start_list[pds.cur_entry] =3D start * tp_size; + pds.length_list[pds.cur_entry] =3D length * tp_size; + trace_postcopy_discard_send_range(pds.ramblock_name, start, length); + pds.cur_entry++; + pds.nsentwords++; =20 - if (pds->cur_entry =3D=3D MAX_DISCARDS_PER_COMMAND) { + if (pds.cur_entry =3D=3D MAX_DISCARDS_PER_COMMAND) { /* Full set, ship it! */ qemu_savevm_send_postcopy_ram_discard(ms->to_dst_file, - pds->ramblock_name, - pds->cur_entry, - pds->start_list, - pds->length_list); - pds->nsentcmds++; - pds->cur_entry =3D 0; + pds.ramblock_name, + pds.cur_entry, + pds.start_list, + pds.length_list); + pds.nsentcmds++; + pds.cur_entry =3D 0; } } =20 @@ -1433,24 +1426,21 @@ void postcopy_discard_send_range(MigrationState *ms= , PostcopyDiscardState *pds, * bitmap code. Sends any outstanding discard messages, frees the PDS * * @ms: Current migration state. - * @pds: Structure initialised by postcopy_discard_send_init(). */ -void postcopy_discard_send_finish(MigrationState *ms, PostcopyDiscardState= *pds) +void postcopy_discard_send_finish(MigrationState *ms) { /* Anything unsent? */ - if (pds->cur_entry) { + if (pds.cur_entry) { qemu_savevm_send_postcopy_ram_discard(ms->to_dst_file, - pds->ramblock_name, - pds->cur_entry, - pds->start_list, - pds->length_list); - pds->nsentcmds++; + pds.ramblock_name, + pds.cur_entry, + pds.start_list, + pds.length_list); + pds.nsentcmds++; } =20 - trace_postcopy_discard_send_finish(pds->ramblock_name, pds->nsentwords, - pds->nsentcmds); - - g_free(pds); + trace_postcopy_discard_send_finish(pds.ramblock_name, pds.nsentwords, + pds.nsentcmds); } =20 /* diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 9d55536fd1..9c8bd2bae0 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -43,10 +43,8 @@ int postcopy_ram_prepare_discard(MigrationIncomingState = *mis); =20 /* * Called at the start of each RAMBlock by the bitmap code. - * Returns a new PDS */ -PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms, - const char *name); +void postcopy_discard_send_init(MigrationState *ms, const char *name); =20 /* * Called by the bitmap code for each chunk to discard. @@ -55,15 +53,14 @@ PostcopyDiscardState *postcopy_discard_send_init(Migrat= ionState *ms, * @start,@length: a range of pages in the migration bitmap in the * RAM block passed to postcopy_discard_send_init() (length=3D1 is one pa= ge) */ -void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState = *pds, - unsigned long start, unsigned long length= ); +void postcopy_discard_send_range(MigrationState *ms, unsigned long start, + unsigned long length); =20 /* * Called at the end of each RAMBlock by the bitmap code. - * Sends any outstanding discard messages, frees the PDS. + * Sends any outstanding discard messages. */ -void postcopy_discard_send_finish(MigrationState *ms, - PostcopyDiscardState *pds); +void postcopy_discard_send_finish(MigrationState *ms); =20 /* * Place a page (from) at (host) efficiently diff --git a/migration/ram.c b/migration/ram.c index a44e9c0abc..f428639af5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2850,12 +2850,9 @@ void ram_postcopy_migrated_memory_release(MigrationS= tate *ms) * with the dirtymap; so a '1' means it's either dirty or unsent. * * @ms: current migration state - * @pds: state for postcopy * @block: RAMBlock to discard */ -static int postcopy_send_discard_bm_ram(MigrationState *ms, - PostcopyDiscardState *pds, - RAMBlock *block) +static int postcopy_send_discard_bm_ram(MigrationState *ms, RAMBlock *bloc= k) { unsigned long end =3D block->used_length >> TARGET_PAGE_BITS; unsigned long current; @@ -2876,7 +2873,7 @@ static int postcopy_send_discard_bm_ram(MigrationStat= e *ms, } else { discard_length =3D zero - one; } - postcopy_discard_send_range(ms, pds, one, discard_length); + postcopy_discard_send_range(ms, one, discard_length); current =3D one + discard_length; } =20 @@ -2902,16 +2899,15 @@ static int postcopy_each_ram_send_discard(Migration= State *ms) int ret; =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { - PostcopyDiscardState *pds =3D - postcopy_discard_send_init(ms, block->idstr); + postcopy_discard_send_init(ms, block->idstr); =20 /* * Postcopy sends chunks of bitmap over the wire, but it * just needs indexes at this point, avoids it having * target page specific code. */ - ret =3D postcopy_send_discard_bm_ram(ms, pds, block); - postcopy_discard_send_finish(ms, pds); + ret =3D postcopy_send_discard_bm_ram(ms, block); + postcopy_discard_send_finish(ms); if (ret) { return ret; } @@ -2934,11 +2930,9 @@ static int postcopy_each_ram_send_discard(MigrationS= tate *ms) * @unsent_pass: if true we need to canonicalize partially unsent host pag= es * otherwise we need to canonicalize partially dirty host pa= ges * @block: block that contains the page we want to canonicalize - * @pds: state for postcopy */ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_= pass, - RAMBlock *block, - PostcopyDiscardState *pds) + RAMBlock *block) { RAMState *rs =3D ram_state; unsigned long *bitmap =3D block->bmap; @@ -3018,8 +3012,7 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, * (any partially sent pages were already discarded * by the previous unsent_pass) */ - postcopy_discard_send_range(ms, pds, fixup_start_addr, - host_ratio); + postcopy_discard_send_range(ms, fixup_start_addr, host_rat= io); } =20 /* Clean up the bitmap */ @@ -3062,18 +3055,17 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, */ static int postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) { - PostcopyDiscardState *pds =3D - postcopy_discard_send_init(ms, block->idstr); + postcopy_discard_send_init(ms, block->idstr); =20 /* First pass: Discard all partially sent host pages */ - postcopy_chunk_hostpages_pass(ms, true, block, pds); + postcopy_chunk_hostpages_pass(ms, true, block); /* * Second pass: Ensure that all partially dirty host pages are made * fully dirty. */ - postcopy_chunk_hostpages_pass(ms, false, block, pds); + postcopy_chunk_hostpages_pass(ms, false, block); =20 - postcopy_discard_send_finish(ms, pds); + postcopy_discard_send_finish(ms); return 0; } =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887441; cv=none; d=zoho.com; s=zohoarc; b=kff98c3GoGn2wBcyHGcPRCToRMnGrYxrv8NHD0g0Op7c8MlbMCWtDSZkTNeuYT44w3cVN1bThnUPbHnnoYf1sd3sJTDoS0wsNnzxEgF1PVRyXxr0i8Ng9co1T7v1NFZKT3br0KRBByr7cB2Nevtyoo3EwGUx2zcoBh1xC7x6xFw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887441; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=D1ueMGPQVVhWIZ7GLlUEWHyNfJiQAL9QPvhUI2zCeAw=; b=UZQf+ZBtOk3JSuvjIsmQy8LbqNkRCm9/1MgTjdUCUfymf0/SXxzSzVKkDb55/LPTeIfcpwycBYTlrbIxGagmsze0NUXkRmu7stvjyPscaHIT07alJGJxcxdrQgPRhYObgruHUiuBYPyaJMgY5UBjOxrBn8ZjhsKAvkujZpyA9FY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15658874414331000.6532442443673; Thu, 15 Aug 2019 09:44:01 -0700 (PDT) Received: from localhost ([::1]:44364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIr2-0002h3-3i for importer@patchew.org; Thu, 15 Aug 2019 12:44:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47415) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjk-0002h9-Ca for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjf-0003G0-58 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIje-0003Fg-UG for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41BFF8666C; Thu, 15 Aug 2019 16:36:22 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 007F23737; Thu, 15 Aug 2019 16:36:18 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:51 +0100 Message-Id: <20190815163504.18937-21-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 15 Aug 2019 16:36:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 20/33] migration/postcopy: simplify calculation of run_start and fixup_start_addr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang The purpose of the calculation is to find a HostPage which is partially dirty. * fixup_start_addr points to the start of the HostPage to discard * run_start points to the next HostPage to check While in the middle stage, there would two cases for run_start: * aligned with HostPage means this is not partially dirty * not aligned means this is partially dirty When it is aligned, no work and calculation is necessary. run_start already points to the start of next HostPage and is ready to continue. When it is not aligned, the calculation could be simplified with: * fixup_start_addr =3D QEMU_ALIGN_DOWN(run_start, host_ratio) * run_start =3D QEMU_ALIGN_UP(run_start, host_ratio) By doing so, run_start always points to the next HostPage to check. fixup_start_addr always points to the HostPage to discard. Signed-off-by: Wei Yang Message-Id: <20190806004648.8659-2-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index f428639af5..d2184c3cfc 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2955,7 +2955,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, } =20 while (run_start < pages) { - unsigned long fixup_start_addr; unsigned long host_offset; =20 /* @@ -2963,45 +2962,26 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, * page, then we need to fixup this host page. */ host_offset =3D run_start % host_ratio; - if (host_offset) { - fixup_start_addr =3D run_start - host_offset; - /* - * This host page has gone, the next loop iteration starts - * from after the fixup - */ - run_start =3D fixup_start_addr + host_ratio; - } else { + if (!host_offset) { /* Find the end of this run */ - unsigned long run_end; if (unsent_pass) { - run_end =3D find_next_bit(unsentmap, pages, run_start + 1); + run_start =3D find_next_bit(unsentmap, pages, run_start + = 1); } else { - run_end =3D find_next_zero_bit(bitmap, pages, run_start + = 1); + run_start =3D find_next_zero_bit(bitmap, pages, run_start = + 1); } /* * If the end isn't at the start of a host page, then the * run doesn't finish at the end of a host page * and we need to discard. */ - host_offset =3D run_end % host_ratio; - if (host_offset) { - fixup_start_addr =3D run_end - host_offset; - /* - * This host page has gone, the next loop iteration starts - * from after the fixup - */ - run_start =3D fixup_start_addr + host_ratio; - } else { - /* - * No discards on this iteration, next loop starts from - * next sent/dirty page - */ - run_start =3D run_end + 1; - } + host_offset =3D run_start % host_ratio; } =20 if (host_offset) { unsigned long page; + unsigned long fixup_start_addr =3D QEMU_ALIGN_DOWN(run_start, + host_ratio); + run_start =3D QEMU_ALIGN_UP(run_start, host_ratio); =20 /* Tell the destination to discard this page */ if (unsent_pass || !test_bit(fixup_start_addr, unsentmap)) { --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887660; cv=none; d=zoho.com; s=zohoarc; b=GH2zfVI1uHfNg/qCuSYPwKE9j02UEMFUUJtVd6H0iAylYwHGQSriAapaFoHiBG6Ovh27bYJXke3vT/OBL3T1y1by/uP6rF5YnI/hLvIgHjczzI3JWwpP0kTW6tEfOX6qLJGJnDgiLjMlAal3GunsDz2XtBrVmrt4eROKYnPsxIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887660; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wkX2ZZLhmhRZhbHrGqETLwsN2tbjqGPrQDCKD29PoRc=; b=Lrho++kRqWYVYe/2/whb6ZK5niCusu7iz2P6iSlXbbpT5bdbB5qRZTiTdI58lXqqwcH8sVKAo2G3J2SahaeCZDWDHVh6Ga1NYx/G/bmlJMCIR7pHjjkzsm3fGyQS9knnS1Vg+4g/Z9guEPgLX5N285p6XOQTxfduzrDSyh2MDQM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887660216130.87347802615614; Thu, 15 Aug 2019 09:47:40 -0700 (PDT) Received: from localhost ([::1]:44394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIuY-0006W9-EB for importer@patchew.org; Thu, 15 Aug 2019 12:47:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47442) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjq-0002pt-A6 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjm-0003Ix-QO for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40390) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjm-0003Il-LC for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B004E51EE1; Thu, 15 Aug 2019 16:36:29 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B8713737; Thu, 15 Aug 2019 16:36:22 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:52 +0100 Message-Id: <20190815163504.18937-22-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 15 Aug 2019 16:36:30 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 21/33] migration/postcopy: use QEMU_IS_ALIGNED to replace host_offset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Use QEMU_IS_ALIGNED for the check, it would be more consistent with other align calculations. Signed-off-by: Wei Yang Message-Id: <20190806004648.8659-3-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index d2184c3cfc..eee68a7991 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2955,14 +2955,12 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, } =20 while (run_start < pages) { - unsigned long host_offset; =20 /* * If the start of this run of pages is in the middle of a host * page, then we need to fixup this host page. */ - host_offset =3D run_start % host_ratio; - if (!host_offset) { + if (QEMU_IS_ALIGNED(run_start, host_ratio)) { /* Find the end of this run */ if (unsent_pass) { run_start =3D find_next_bit(unsentmap, pages, run_start + = 1); @@ -2974,10 +2972,9 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, bool unsent_pass, * run doesn't finish at the end of a host page * and we need to discard. */ - host_offset =3D run_start % host_ratio; } =20 - if (host_offset) { + if (!QEMU_IS_ALIGNED(run_start, host_ratio)) { unsigned long page; unsigned long fixup_start_addr =3D QEMU_ALIGN_DOWN(run_start, host_ratio); --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887827; cv=none; d=zoho.com; s=zohoarc; b=ePGgeMps5RvwHphqNAzjo3MWi8AQkC/XHLJA7T+7nudrU1DxDXoyLT18xhYv5cG9MtnUmLTuj6IROH+3p9KgSkUs5lmBwZcj9feTgCg94IkpTqmpeHatL/Tl8m36em3bUJC0Q26RtXmDodmNotRfmdssOAUephscg8p5p0hhOlM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887827; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7xPBkzV+/lHkrGlm9jsm3Pfh3Wi/FjBej9DR+4dIq4c=; b=V6ymCR47rycHmAqA1dipNVUtmeWazn05Sv27e+2nWC9Dwft+vhOy73ULsLTDv5r/BTGma+iFXDpiKzZkDRbVBUSvOuj6TYJxs1Q8b7MVsbKykXtdNEVibFFLj0gyVhX+cNKD4de/GA5Nh90/9kO5fmClKN8Cp/l/k9r0kp+0yjQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887827218881.882768074009; Thu, 15 Aug 2019 09:50:27 -0700 (PDT) Received: from localhost ([::1]:44442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIxF-0001b2-6e for importer@patchew.org; Thu, 15 Aug 2019 12:50:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47451) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjs-0002sh-0w for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjo-0003Ju-G8 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1246) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjo-0003Jb-B7 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9602D11A1A; Thu, 15 Aug 2019 16:36:31 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04F85BAB7; Thu, 15 Aug 2019 16:36:29 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:53 +0100 Message-Id: <20190815163504.18937-23-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 15 Aug 2019 16:36:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 22/33] hmp: Remove migration capabilities from "info migrate" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang With the growth of migration capabilities, it is not proper to display them in "info migrate". Users are recommended to use "info migrate_capabiltiies" to list them. Signed-off-by: Wei Yang Suggested-by: Dr. David Alan Gilbert Message-Id: <20190806003645.8426-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- monitor/hmp-cmds.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 5ca3ebe942..35788c0645 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -220,24 +220,11 @@ static char *SocketAddress_to_str(SocketAddress *addr) void hmp_info_migrate(Monitor *mon, const QDict *qdict) { MigrationInfo *info; - MigrationCapabilityStatusList *caps, *cap; =20 info =3D qmp_query_migrate(NULL); - caps =3D qmp_query_migrate_capabilities(NULL); =20 migration_global_dump(mon); =20 - /* do not display parameters during setup */ - if (info->has_status && caps) { - monitor_printf(mon, "capabilities: "); - for (cap =3D caps; cap; cap =3D cap->next) { - monitor_printf(mon, "%s: %s ", - MigrationCapability_str(cap->value->capability), - cap->value->state ? "on" : "off"); - } - monitor_printf(mon, "\n"); - } - if (info->has_status) { monitor_printf(mon, "Migration status: %s", MigrationStatus_str(info->status)); @@ -370,7 +357,6 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) monitor_printf(mon, "]\n"); } qapi_free_MigrationInfo(info); - qapi_free_MigrationCapabilityStatusList(caps); } =20 void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict) --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887965; cv=none; d=zoho.com; s=zohoarc; b=E4zRg0LyOum8OZFld0gBbcroxSZNDAQ1tBv2a8SfW0DVw19EejUA/+591bnjSNzZznbWqeD89hI23QwNvzegcnu2hjfUuw8sk1jFJLMMGup9wEvYMs4TiguXVeddfzAQRMOYHYXIhamARoKorTffhNhxixpLbyUQvKWP1CCd98A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887965; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wxIrRljw7LhMsD7hBo2nA6ZewjbFnLVU5ka4RYAqMvg=; b=cLP2qAo3vNAqtk27P2KjnR1TIajLFDjogquYsnd05dfK9v9EPfoFfVoAk5EXVl6H6kH8cw9iE1oQ9vcdKyeq61AZAY1JqJf7pusa6pPuhx4AlhNYMR6jW82Orec5XQsBEC+YLrKE6mftmjrTFvRwvBX11cDc8GKk4sS+h0rXAa0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887965462710.0568419579565; Thu, 15 Aug 2019 09:52:45 -0700 (PDT) Received: from localhost ([::1]:44472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIzT-0005IY-QP for importer@patchew.org; Thu, 15 Aug 2019 12:52:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47470) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjv-0002yb-SA for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjq-0003Ls-84 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36422) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjq-0003KI-2U for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60F02309BF09; Thu, 15 Aug 2019 16:36:33 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD4523737; Thu, 15 Aug 2019 16:36:31 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:54 +0100 Message-Id: <20190815163504.18937-24-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 15 Aug 2019 16:36:33 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 23/33] migration: remove unused field bytes_xfer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang MigrationState->bytes_xfer is only set to 0 in migrate_init(). Remove this unnecessary field. Signed-off-by: Wei Yang Message-Id: <20190402003106.17614-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 1 - migration/migration.h | 1 - 2 files changed, 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 8331e62831..12b8e5dbe5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1699,7 +1699,6 @@ void migrate_init(MigrationState *s) * parameters/capabilities that the user set, and * locks. */ - s->bytes_xfer =3D 0; s->cleanup_bh =3D 0; s->to_dst_file =3D NULL; s->state =3D MIGRATION_STATUS_NONE; diff --git a/migration/migration.h b/migration/migration.h index 1fdd7b21fd..5bc60709db 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -132,7 +132,6 @@ struct MigrationState DeviceState parent_obj; =20 /*< public >*/ - size_t bytes_xfer; QemuThread thread; QEMUBH *cleanup_bh; QEMUFile *to_dst_file; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888370; cv=none; d=zoho.com; s=zohoarc; b=OgZH59wUNnUjvhSGOpE/hQ70tZwuKR+bpFmxep98PolL1yLymutiaS2nRkvp8+TR4Jm2iiJVliDy44JD4Afz5kmnlWLHo9Yz0dyXTNtE7q/JcvxjvykxA+kCRFc3dfpWAiAFKS2TpZyRcF9s7fpAC6BBjR5w2wRGQo8YmCzw0Ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888370; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BnsFMZ50I1yDRxlWof1T9G+R9Nz8EhUKC/0PSDEXmPc=; b=ciQKKkV6C11vuse7IAwQ9M51nZxe29wnMw4PbHt2huFb1ZATazn3jHBIvHQNdOlgxbijJLxTzq0Xr3wuzQJijN42z9aX5DxdpiYqWq9pr91kD/Iu9zoHb04z5jEiHXcdVg5P6/aNcRdgh/4JUQKr7oR19y5qBWEn5EL7d4G9e4U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888370865156.71911585490693; Thu, 15 Aug 2019 09:59:30 -0700 (PDT) Received: from localhost ([::1]:44562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ61-000518-PB for importer@patchew.org; Thu, 15 Aug 2019 12:59:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47474) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjw-0002z2-4w for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjs-0003Oj-4U for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39416) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjr-0003NN-TP for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:36 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31F0F3001D30; Thu, 15 Aug 2019 16:36:35 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC9A6BAAC; Thu, 15 Aug 2019 16:36:33 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:55 +0100 Message-Id: <20190815163504.18937-25-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 15 Aug 2019 16:36:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 24/33] migration: always initialise ram_counters for a new migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Ivan Ren This patch fix a multifd migration bug in migration speed calculation, this problem can be reproduced as follows: 1. start a vm and give a heavy memory write stress to prevent the vm be successfully migrated to destination 2. begin a migration with multifd 3. migrate for a long time [actually, this can be measured by transferred b= ytes] 4. migrate cancel 5. begin a new migration with multifd, the migration will directly run into migration_completion phase Reason as follows: Migration update bandwidth and s->threshold_size in function migration_update_counters after BUFFER_DELAY time: current_bytes =3D migration_total_bytes(s); transferred =3D current_bytes - s->iteration_initial_bytes; time_spent =3D current_time - s->iteration_start_time; bandwidth =3D (double)transferred / time_spent; s->threshold_size =3D bandwidth * s->parameters.downtime_limit; In multifd migration, migration_total_bytes function return qemu_ftell(s->to_dst_file) + ram_counters.multifd_bytes. s->iteration_initial_bytes will be initialized to 0 at every new migration, but ram_counters is a global variable, and history migration data will be accumulated. So if the ram_counters.multifd_bytes is big enough, it may lead pending_size >=3D s->threshold_size become false in migration_iteration_run after the first migration_update_counters. Signed-off-by: Ivan Ren Reviewed-by: Juan Quintela Reviewed-by: Wei Yang Suggested-by: Wei Yang Message-Id: <1564741121-1840-1-git-send-email-ivanren@tencent.com> Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 25 +++++++++++++++++++------ migration/savevm.c | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 12b8e5dbe5..c49e9dc035 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1911,6 +1911,11 @@ static bool migrate_prepare(MigrationState *s, bool = blk, bool blk_inc, } =20 migrate_init(s); + /* + * set ram_counters memory to zero for a + * new migration + */ + memset(&ram_counters, 0, sizeof(ram_counters)); =20 return true; } @@ -3034,6 +3039,17 @@ static void migration_calculate_complete(MigrationSt= ate *s) } } =20 +static void update_iteration_initial_status(MigrationState *s) +{ + /* + * Update these three fields at the same time to avoid mismatch info l= ead + * wrong speed calculation. + */ + s->iteration_start_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + s->iteration_initial_bytes =3D migration_total_bytes(s); + s->iteration_initial_pages =3D ram_get_total_transferred_pages(); +} + static void migration_update_counters(MigrationState *s, int64_t current_time) { @@ -3069,9 +3085,7 @@ static void migration_update_counters(MigrationState = *s, =20 qemu_file_reset_rate_limit(s->to_dst_file); =20 - s->iteration_start_time =3D current_time; - s->iteration_initial_bytes =3D current_bytes; - s->iteration_initial_pages =3D ram_get_total_transferred_pages(); + update_iteration_initial_status(s); =20 trace_migrate_transferred(transferred, time_spent, bandwidth, s->threshold_size); @@ -3194,7 +3208,7 @@ static void *migration_thread(void *opaque) rcu_register_thread(); =20 object_ref(OBJECT(s)); - s->iteration_start_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + update_iteration_initial_status(s); =20 qemu_savevm_state_header(s->to_dst_file); =20 @@ -3259,8 +3273,7 @@ static void *migration_thread(void *opaque) * the local variables. This is important to avoid * breaking transferred_bytes and bandwidth calculation */ - s->iteration_start_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALT= IME); - s->iteration_initial_bytes =3D 0; + update_iteration_initial_status(s); } =20 current_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); diff --git a/migration/savevm.c b/migration/savevm.c index 412768216c..1ac15301ad 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1456,6 +1456,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) } =20 migrate_init(ms); + memset(&ram_counters, 0, sizeof(ram_counters)); ms->to_dst_file =3D f; =20 qemu_mutex_unlock_iothread(); --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887980; cv=none; d=zoho.com; s=zohoarc; b=SRRUpdovC14aGrAhTIzs+H5i7nCBWhNfYsdGsSwFitvazh1rxn6cHxnoN/ixO6yGQElx3kP92zZA76t7UzNSeFpbuRbUmQxkt7Rj1sM3hmhO9a5J3CDlIWkgEMptPKyx8BC2HJaQnagi+TeL2N3c/pxxIwnHJVjvBJFe0f7Jwpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887980; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lmXjMBogxuAu52YJwltfP1qXmrQTaFAjI9KgW7/yets=; b=VExuFvJgU0C6Sd31U82M5wcaOQM52qOkh4ge5cpwFduM5Zoi8EXQFrYP6CBtMOpD2TFmzdAhQjhHhXO5WyXpnOfwUJnOiQx+UO4zzK3bWRYCk1C9CSjHPcgPAr4Hvwcp89F1PdQEyoOjpiW6Nt7VZPVnPxwTX1pu8ulVgYy4Ozc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156588798018655.20778307637852; Thu, 15 Aug 2019 09:53:00 -0700 (PDT) Received: from localhost ([::1]:44480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIzi-0005eo-Gg for importer@patchew.org; Thu, 15 Aug 2019 12:52:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47482) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjx-000310-Gf for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjt-0003St-Qa for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36138) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjt-0003Rh-Le for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 011C1307CDEA; Thu, 15 Aug 2019 16:36:37 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BB7A3737; Thu, 15 Aug 2019 16:36:35 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:56 +0100 Message-Id: <20190815163504.18937-26-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 15 Aug 2019 16:36:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 25/33] migration: add qemu_file_update_transfer interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Ivan Ren Add qemu_file_update_transfer for just update bytes_xfer for speed limitation. This will be used for further migration feature such as multifd migration. Signed-off-by: Ivan Ren Reviewed-by: Wei Yang Reviewed-by: Juan Quintela Message-Id: <1564464816-21804-2-git-send-email-ivanren@tencent.com> Signed-off-by: Dr. David Alan Gilbert --- migration/qemu-file.c | 5 +++++ migration/qemu-file.h | 1 + 2 files changed, 6 insertions(+) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index c04a7a891b..e33c46764f 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -654,6 +654,11 @@ void qemu_file_reset_rate_limit(QEMUFile *f) f->bytes_xfer =3D 0; } =20 +void qemu_file_update_transfer(QEMUFile *f, int64_t len) +{ + f->bytes_xfer +=3D len; +} + void qemu_put_be16(QEMUFile *f, unsigned int v) { qemu_put_byte(f, v >> 8); diff --git a/migration/qemu-file.h b/migration/qemu-file.h index eb886db65f..d064940b8c 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -150,6 +150,7 @@ int qemu_peek_byte(QEMUFile *f, int offset); void qemu_file_skip(QEMUFile *f, int size); void qemu_update_position(QEMUFile *f, size_t size); void qemu_file_reset_rate_limit(QEMUFile *f); +void qemu_file_update_transfer(QEMUFile *f, int64_t len); void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); int64_t qemu_file_get_rate_limit(QEMUFile *f); int qemu_file_get_error_obj(QEMUFile *f, Error **errp); --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565887917; cv=none; d=zoho.com; s=zohoarc; b=VSRyQFSK0FYG94i8BjR6S7k7/BqPup7Kd1h31gRSedWFm7pZuyTrKl4CudUXMscndeMkJAkGJb11n+x3mifuCSCrfWkZW196jyHtpYX+Z4bvxOp2WeH28bf+ca7mWTliCXr9cbrnJoBqSy8OgGFtd8FzHYL1hcutkDS7a0kyW/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565887917; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sUR5TaP2JU1WqSaDat6rRRnfuiOdpA8wkBxHCVXjeCs=; b=fefh7+Qo/sKGl6HHo20PM1W9KHW07xQZHBOcO17CfFW+qtCDzLMk1Fp88MdTz80JURmKCu4181KTEOm1vMsyWpBpHrnDjX+8MxpPHxrmh3mnziPYm1fk0XDtrOsVELvGO+6P73WVSe9t4NCHLbMfPtwN+Mc5ex/GBRmk+sO93Yg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565887917029286.7237922696322; Thu, 15 Aug 2019 09:51:57 -0700 (PDT) Received: from localhost ([::1]:44462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIyh-0003zv-9S for importer@patchew.org; Thu, 15 Aug 2019 12:51:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47496) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIjz-00034H-G2 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjv-0003Tj-PD for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36162) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjv-0003TG-Ga for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C74B1307CDD1; Thu, 15 Aug 2019 16:36:38 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D4723737; Thu, 15 Aug 2019 16:36:37 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:57 +0100 Message-Id: <20190815163504.18937-27-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 15 Aug 2019 16:36:38 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 26/33] migration: add speed limit for multifd migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Ivan Ren Limit the speed of multifd migration through common speed limitation qemu file. Signed-off-by: Ivan Ren Message-Id: <1564464816-21804-3-git-send-email-ivanren@tencent.com> Reviewed-by: Wei Yang Reviewed-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index eee68a7991..1179519345 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -922,7 +922,7 @@ struct { * false. */ =20 -static int multifd_send_pages(void) +static int multifd_send_pages(RAMState *rs) { int i; static int next_channel; @@ -954,6 +954,7 @@ static int multifd_send_pages(void) multifd_send_state->pages =3D p->pages; p->pages =3D pages; transferred =3D ((uint64_t) pages->used) * TARGET_PAGE_SIZE + p->packe= t_len; + qemu_file_update_transfer(rs->f, transferred); ram_counters.multifd_bytes +=3D transferred; ram_counters.transferred +=3D transferred;; qemu_mutex_unlock(&p->mutex); @@ -962,7 +963,7 @@ static int multifd_send_pages(void) return 1; } =20 -static int multifd_queue_page(RAMBlock *block, ram_addr_t offset) +static int multifd_queue_page(RAMState *rs, RAMBlock *block, ram_addr_t of= fset) { MultiFDPages_t *pages =3D multifd_send_state->pages; =20 @@ -981,12 +982,12 @@ static int multifd_queue_page(RAMBlock *block, ram_ad= dr_t offset) } } =20 - if (multifd_send_pages() < 0) { + if (multifd_send_pages(rs) < 0) { return -1; } =20 if (pages->block !=3D block) { - return multifd_queue_page(block, offset); + return multifd_queue_page(rs, block, offset); } =20 return 1; @@ -1054,7 +1055,7 @@ void multifd_save_cleanup(void) multifd_send_state =3D NULL; } =20 -static void multifd_send_sync_main(void) +static void multifd_send_sync_main(RAMState *rs) { int i; =20 @@ -1062,7 +1063,7 @@ static void multifd_send_sync_main(void) return; } if (multifd_send_state->pages->used) { - if (multifd_send_pages() < 0) { + if (multifd_send_pages(rs) < 0) { error_report("%s: multifd_send_pages fail", __func__); return; } @@ -1083,6 +1084,7 @@ static void multifd_send_sync_main(void) p->packet_num =3D multifd_send_state->packet_num++; p->flags |=3D MULTIFD_FLAG_SYNC; p->pending_job++; + qemu_file_update_transfer(rs->f, p->packet_len); qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); } @@ -2078,7 +2080,7 @@ static int ram_save_page(RAMState *rs, PageSearchStat= us *pss, bool last_stage) static int ram_save_multifd_page(RAMState *rs, RAMBlock *block, ram_addr_t offset) { - if (multifd_queue_page(block, offset) < 0) { + if (multifd_queue_page(rs, block, offset) < 0) { return -1; } ram_counters.normal++; @@ -3447,7 +3449,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) ram_control_before_iterate(f, RAM_CONTROL_SETUP); ram_control_after_iterate(f, RAM_CONTROL_SETUP); =20 - multifd_send_sync_main(); + multifd_send_sync_main(*rsp); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); =20 @@ -3535,7 +3537,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) ram_control_after_iterate(f, RAM_CONTROL_ROUND); =20 out: - multifd_send_sync_main(); + multifd_send_sync_main(rs); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); ram_counters.transferred +=3D 8; @@ -3594,7 +3596,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) =20 rcu_read_unlock(); =20 - multifd_send_sync_main(); + multifd_send_sync_main(rs); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888469; cv=none; d=zoho.com; s=zohoarc; b=G67EuusYF41IovztXcaIR5prSIqPdQJYC1Nr8CAjO7shdwSz08VeGnpk4mT1dik6FrcxS9C9+6WkOpkTZK2dCnDsv483CIJk4+huXuuDKmjFOF1/T8DfNwJ1U9MHNMvOHSL3bV0MWvqQwJmWlPFG8HhIRYO440JmcWILAq4VsD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888469; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=AjXSx0Vbxv1RUFOXK7gO8Iqv2dZkGai2S4ZNAJSvvE0=; b=BQ5Dg6i5NU+WOT/Q2/Lic1dUk1aKB7uuBiAcnK/E3p3uq9oIu05yrBoNEOnGQDtXN7ysCx99IZnCbZnEjhWm9M4m9NG353J1f9w1Qkty/DGMVHTlR65kuO5LL8KOPgfT8rAF1Dvrfjc7rjbJQZCbgQXAutSJLpX+tO3AF0CWQls= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888469460681.6411664442528; Thu, 15 Aug 2019 10:01:09 -0700 (PDT) Received: from localhost ([::1]:44596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ7c-0006pY-BI for importer@patchew.org; Thu, 15 Aug 2019 13:01:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47506) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIk2-0003AU-WC for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIjx-0003Ul-Eq for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIjx-0003UQ-9x for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96329C057EC6; Thu, 15 Aug 2019 16:36:40 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DCD4BA79; Thu, 15 Aug 2019 16:36:38 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:58 +0100 Message-Id: <20190815163504.18937-28-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 15 Aug 2019 16:36:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 27/33] migration: update ram_counters for multifd sync packet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Ivan Ren Multifd sync will send MULTIFD_FLAG_SYNC flag info to destination, add these bytes to ram_counters record. Signed-off-by: Ivan Ren Suggested-by: Wei Yang Message-Id: <1564464816-21804-4-git-send-email-ivanren@tencent.com> Reviewed-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 1179519345..30f13ffbdd 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1085,6 +1085,8 @@ static void multifd_send_sync_main(RAMState *rs) p->flags |=3D MULTIFD_FLAG_SYNC; p->pending_job++; qemu_file_update_transfer(rs->f, p->packet_len); + ram_counters.multifd_bytes +=3D p->packet_len; + ram_counters.transferred +=3D p->packet_len; qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); } --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888560; cv=none; d=zoho.com; s=zohoarc; b=Cg3M07cOOvzfzbgSWxoEpvmniaig4LlSzJ7V19BWYBLxchiBbZ8FjubT2B/6d6LEqAnEvR/MWbX5Z+b12p03Y/Ts+cecn1MySwJCb9MIaSX1yB+6BrLBi+XrielCISERXJe0fm9j9VyrKMV5tyRJ5PQgYMTvgiKK9kyhz42VeB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888560; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6NIIXKChV5ygFr/EQ9/yFy/CbzdZ6tM95YgwkarJXzo=; b=G1sYUYlxyFjPPMNUkq29byAsreTxip7ZesSvdI9WDfTCrQYiW5tnSbfJX1Gi3z99tQ3IJlixpn0p8f17MqxcMpX2Qk8JOVc365QOtDrxc7WaS4ui2mKxXUw5PwHDBy1WQ+RoA1Qd5hnPjcIadia0+v4mtxiqfA+y0b1RGdTShjU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888560898951.7646113564612; Thu, 15 Aug 2019 10:02:40 -0700 (PDT) Received: from localhost ([::1]:44636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ95-0008DU-OV for importer@patchew.org; Thu, 15 Aug 2019 13:02:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47518) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIk5-0003Ey-Nh for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIk2-0003Wd-4Y for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIk1-0003WB-Vx for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8EAA8535C; Thu, 15 Aug 2019 16:36:44 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0B7F3737; Thu, 15 Aug 2019 16:36:40 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:34:59 +0100 Message-Id: <20190815163504.18937-29-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 15 Aug 2019 16:36:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 28/33] migration: rename migration_bitmap_sync_range to ramblock_sync_dirty_bitmap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Rename for better understanding of the code. Suggested-by: Paolo Bonzini Signed-off-by: Wei Yang Message-Id: <20190808033155.30162-1-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 30f13ffbdd..9e6cc1e685 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1752,7 +1752,7 @@ static inline bool migration_bitmap_clear_dirty(RAMSt= ate *rs, } =20 /* Called with RCU critical section */ -static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb) +static void ramblock_sync_dirty_bitmap(RAMState *rs, RAMBlock *rb) { rs->migration_dirty_pages +=3D cpu_physical_memory_sync_dirty_bitmap(rb, 0, rb->used_length, @@ -1844,7 +1844,7 @@ static void migration_bitmap_sync(RAMState *rs) qemu_mutex_lock(&rs->bitmap_mutex); rcu_read_lock(); RAMBLOCK_FOREACH_NOT_IGNORED(block) { - migration_bitmap_sync_range(rs, block); + ramblock_sync_dirty_bitmap(rs, block); } ram_counters.remaining =3D ram_bytes_remaining(); rcu_read_unlock(); @@ -4265,7 +4265,7 @@ static void colo_flush_ram_cache(void) memory_global_dirty_log_sync(); rcu_read_lock(); RAMBLOCK_FOREACH_NOT_IGNORED(block) { - migration_bitmap_sync_range(ram_state, block); + ramblock_sync_dirty_bitmap(ram_state, block); } rcu_read_unlock(); =20 --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888110; cv=none; d=zoho.com; s=zohoarc; b=oMhKJjjvnjQ3Dly/9/HIggq4wP8BuFjGLk/ybfPqhJEIHCkVY8Z+03OBOlNQ9Aram1JfslVnCJJ13K7Xc6kYwYBlvL60k3C88s3WbGt1wEgRFqWP+0ebkirf0Rf3Kyq7jJmpNfItzwYl2wI/UVZhfvTp7JABGePY5rYQzUYKgw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888110; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pxeLh+esl+/zog1sLSw/cbqTjhqSyksd4aKClxJLRVo=; b=hM2ohi5UE27BVm9ufeb+vz53Dt+34DyGLJFbjeFXPIeVJ+q8bT4kjk9sIK9SuK6QKiasbiUDj95oCbo6im3CRik5gdU024rw4dC5DiV1LT5ZXPHjOnqSp0cClHN5BdcYo/4OXPCW4Xd6l1vIZKHYp3mDxvIvy8/qGgb6ZXprjyc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888110318749.7937942829085; Thu, 15 Aug 2019 09:55:10 -0700 (PDT) Received: from localhost ([::1]:44514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ1o-0000Pm-UW for importer@patchew.org; Thu, 15 Aug 2019 12:55:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47538) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIk9-0003Ke-7u for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIk3-0003XS-JF for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40566) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIk3-0003X3-EQ for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB7E54FCCE; Thu, 15 Aug 2019 16:36:46 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EE31BAAC; Thu, 15 Aug 2019 16:36:45 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:35:00 +0100 Message-Id: <20190815163504.18937-30-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 15 Aug 2019 16:36:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 29/33] migration/postcopy: use mis->bh instead of allocating a QEMUBH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang For migration incoming side, it either quit in precopy or postcopy. It is safe to use the mis->bh for both instead of allocating a dedicated QEMUBH for postcopy. Signed-off-by: Wei Yang Reviewed-by: Dr. David Alan Gilbert Message-Id: <20190805053146.32326-1-richardw.yang@linux.intel.com> Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 1ac15301ad..6369a4ff7a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1866,16 +1866,10 @@ static int loadvm_postcopy_handle_listen(MigrationI= ncomingState *mis) return 0; } =20 - -typedef struct { - QEMUBH *bh; -} HandleRunBhData; - static void loadvm_postcopy_handle_run_bh(void *opaque) { Error *local_err =3D NULL; - HandleRunBhData *data =3D opaque; - MigrationIncomingState *mis =3D migration_incoming_get_current(); + MigrationIncomingState *mis =3D opaque; =20 /* TODO we should move all of this lot into postcopy_ram.c or a shared= code * in migration.c @@ -1907,15 +1901,13 @@ static void loadvm_postcopy_handle_run_bh(void *opa= que) runstate_set(RUN_STATE_PAUSED); } =20 - qemu_bh_delete(data->bh); - g_free(data); + qemu_bh_delete(mis->bh); } =20 /* After all discards we can start running and asking for pages */ static int loadvm_postcopy_handle_run(MigrationIncomingState *mis) { PostcopyState ps =3D postcopy_state_set(POSTCOPY_INCOMING_RUNNING); - HandleRunBhData *data; =20 trace_loadvm_postcopy_handle_run(); if (ps !=3D POSTCOPY_INCOMING_LISTENING) { @@ -1923,9 +1915,8 @@ static int loadvm_postcopy_handle_run(MigrationIncomi= ngState *mis) return -1; } =20 - data =3D g_new(HandleRunBhData, 1); - data->bh =3D qemu_bh_new(loadvm_postcopy_handle_run_bh, data); - qemu_bh_schedule(data->bh); + mis->bh =3D qemu_bh_new(loadvm_postcopy_handle_run_bh, mis); + qemu_bh_schedule(mis->bh); =20 /* We need to finish reading the stream from the package * and also stop reading anything more from the stream that loaded the --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888623; cv=none; d=zoho.com; s=zohoarc; b=PNpoIxkHNOJbxTMCwVYGzazZ8QCGinQ7GYM4Vmo67C9N0Zq9u5a3u68e0T2Lb+x0e0DmP0fWyiH6hSFm4T999iwIJGxlK3uNmYh4SMiizpw3OOqIebQcolXOopBsSmlm+QFF/hmEIcYlQR42RR88Lbq27TAOVCU5gABwPitWcts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=epOAXGP+EcrOibRn/d9a85S4pXj5x5+42sTF+c3ha5g=; b=QGJe93lRmrUabnPNbYJMEfT1KfUeqdxKXhSBwk701d0AKFJLylKKXn8K1sxlUoQCkVfKPPAeKBBv9LPfHI3zpGzVc7T8D0NV1O49qZaZ7w3xavON458X/sVkC/bMDsxLrsMq0L5ZDmz/cCN1z1wqm93P08TMxFKgHyusuSONVkY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888623578750.3095423038267; Thu, 15 Aug 2019 10:03:43 -0700 (PDT) Received: from localhost ([::1]:44644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJA6-0000iy-5K for importer@patchew.org; Thu, 15 Aug 2019 13:03:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47534) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIk8-0003K7-TO for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIk5-0003YF-Cs for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41021) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIk5-0003Xs-7w for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C0FC307D985; Thu, 15 Aug 2019 16:36:48 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F4EF3737; Thu, 15 Aug 2019 16:36:46 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:35:01 +0100 Message-Id: <20190815163504.18937-31-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 15 Aug 2019 16:36:48 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 30/33] qemu-file: move qemu_{get, put}_counted_string() declarations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Move migration helpers for strings under include/, so they can be used outside of migration/ Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Juan Quintela Message-Id: <20190808150325.21939-2-marcandre.lureau@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- include/migration/qemu-file-types.h | 4 ++++ migration/qemu-file.h | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/migration/qemu-file-types.h b/include/migration/qemu-f= ile-types.h index c0a1988155..2867e3da84 100644 --- a/include/migration/qemu-file-types.h +++ b/include/migration/qemu-file-types.h @@ -161,6 +161,10 @@ static inline void qemu_get_sbe64s(QEMUFile *f, int64_= t *pv) qemu_get_be64s(f, (uint64_t *)pv); } =20 +size_t qemu_get_counted_string(QEMUFile *f, char buf[256]); + +void qemu_put_counted_string(QEMUFile *f, const char *name); + int qemu_file_rate_limit(QEMUFile *f); =20 #endif diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d064940b8c..b6303dbeef 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -161,8 +161,6 @@ QEMUFile *qemu_file_get_return_path(QEMUFile *f); void qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); =20 -size_t qemu_get_counted_string(QEMUFile *f, char buf[256]); - void ram_control_before_iterate(QEMUFile *f, uint64_t flags); void ram_control_after_iterate(QEMUFile *f, uint64_t flags); void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data); @@ -181,6 +179,4 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t bl= ock_offset, ram_addr_t offset, size_t size, uint64_t *bytes_sent); =20 -void qemu_put_counted_string(QEMUFile *f, const char *name); - #endif --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888691; cv=none; d=zoho.com; s=zohoarc; b=Q0gwJyfVTYD/lq0dCox113OQttLSVHyICY00L3maTLT7UpDlUDLGUFWGM0Ex/tiRqsb/2c3Yi9rBJ0hvzYvySbIdDxwGY5OgDf4gDEytSi2Z+C9WDx1BFXFQ8mhts7nlrI3r891mk7HQIlA61WNJCO8Pa8DVhAA12IWj5hyTujg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888691; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=RfvkNwb6EC8brFpiufFbQvu13zIbmOb7QgQmyQXteTA=; b=IiX9JbdMHbLW60N1zD2aliXia0tLmMvnpKsuGtu7KEJ7/Qv1ThW8vDXnxVsMIOyKkdWRh1gJuLEuDxSzfB8jCTvPZP0A6Q0B169LV4/DiGaHo1yJOtIzCo9ukMZv8e4I9sADjHdA+BrnBUGprwkhKdJi1teiVwXlD4KVPltglVQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888691863233.02093839098075; Thu, 15 Aug 2019 10:04:51 -0700 (PDT) Received: from localhost ([::1]:44658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJBA-0001cb-OH for importer@patchew.org; Thu, 15 Aug 2019 13:04:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47548) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIkA-0003Ms-RX for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIk7-0003ZE-6m for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIk7-0003Yk-1w for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B0283084242; Thu, 15 Aug 2019 16:36:50 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4EA83737; Thu, 15 Aug 2019 16:36:48 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:35:02 +0100 Message-Id: <20190815163504.18937-32-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 15 Aug 2019 16:36:50 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 31/33] migration: Add traces for multifd terminate threads X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Message-Id: <20190814020218.1868-2-quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 4 ++++ migration/trace-events | 2 ++ 2 files changed, 6 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 9e6cc1e685..b542929a7c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -997,6 +997,8 @@ static void multifd_send_terminate_threads(Error *err) { int i; =20 + trace_multifd_send_terminate_threads(err !=3D NULL); + if (err) { MigrationState *s =3D migrate_get_current(); migrate_set_error(s, err); @@ -1258,6 +1260,8 @@ static void multifd_recv_terminate_threads(Error *err) { int i; =20 + trace_multifd_recv_terminate_threads(err !=3D NULL); + if (err) { MigrationState *s =3D migrate_get_current(); migrate_set_error(s, err); diff --git a/migration/trace-events b/migration/trace-events index d8e54c367a..886ce70ca0 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -85,12 +85,14 @@ multifd_recv(uint8_t id, uint64_t packet_num, uint32_t = used, uint32_t flags, uin multifd_recv_sync_main(long packet_num) "packet num %ld" multifd_recv_sync_main_signal(uint8_t id) "channel %d" multifd_recv_sync_main_wait(uint8_t id) "channel %d" +multifd_recv_terminate_threads(bool error) "error %d" multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %d packets %" PRIu64 " pages %" PRIu64 multifd_recv_thread_start(uint8_t id) "%d" multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d f= lags 0x%x next packet size %d" multifd_send_sync_main(long packet_num) "packet num %ld" multifd_send_sync_main_signal(uint8_t id) "channel %d" multifd_send_sync_main_wait(uint8_t id) "channel %d" +multifd_send_terminate_threads(bool error) "error %d" multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %d packets %" PRIu64 " pages %" PRIu64 multifd_send_thread_start(uint8_t id) "%d" ram_discard_range(const char *rbname, uint64_t start, size_t len) "%s: sta= rt: %" PRIx64 " %zx" --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888334; cv=none; d=zoho.com; s=zohoarc; b=U5JNJMyi+s3YqSrJ1sjfoBACzi1xvtmjoRK8GuGQwJ4muyhdHlessawo4q2ZLVf6zNHER1fNcVUmeUOqBHo5hG+hGA0GZD57Vs2cRwTurNAe28pZFobtqmVfTqRpIDmNrFOPos5yyHTd/DLtpqWskJDVgQiXDvMqKiiM7DNKi+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888334; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gQJSj5qI3Q/JPf/AKjRmdlL5CZXeGtoUVG+iHSAW+9Q=; b=KRPMM6JiPvDdnjNvAYxGrUFrfKZb9P65dL9LIXIp8g0FEbIXhKbTbcVZcjSnGB3+K5ss/hkocsDzcyAC7H0HR2wbG8Wsa6XENFe6qdbz46KQ31jV5BfJMF9rI1ZtVZMS6Yy5FqK0upRpoTN+iWLZzDxBegs/3NMtNQPrDlPIkdw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156588833415832.74746614950743; Thu, 15 Aug 2019 09:58:54 -0700 (PDT) Received: from localhost ([::1]:44554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ5R-0004HI-3y for importer@patchew.org; Thu, 15 Aug 2019 12:58:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47564) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIkD-0003UR-Pl for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIk9-0003a6-3Q for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51788) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIk8-0003Zj-RW for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E03A8E22B; Thu, 15 Aug 2019 16:36:52 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4A953737; Thu, 15 Aug 2019 16:36:50 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:35:03 +0100 Message-Id: <20190815163504.18937-33-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 15 Aug 2019 16:36:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 32/33] migration: Make global sem_sync semaphore by channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Juan Quintela This makes easy to debug things because when you want for all threads to arrive at that semaphore, you know which one your are waiting for. Signed-off-by: Juan Quintela Message-Id: <20190814020218.1868-3-quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index b542929a7c..c7aa3d9a2c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -661,6 +661,8 @@ typedef struct { uint64_t num_packets; /* pages sent through this channel */ uint64_t num_pages; + /* syncs main thread and channels */ + QemuSemaphore sem_sync; } MultiFDSendParams; =20 typedef struct { @@ -896,8 +898,6 @@ struct { MultiFDSendParams *params; /* array of pages to sent */ MultiFDPages_t *pages; - /* syncs main thread and channels */ - QemuSemaphore sem_sync; /* global number of generated multifd packets */ uint64_t packet_num; /* send channels ready */ @@ -1039,6 +1039,7 @@ void multifd_save_cleanup(void) p->c =3D NULL; qemu_mutex_destroy(&p->mutex); qemu_sem_destroy(&p->sem); + qemu_sem_destroy(&p->sem_sync); g_free(p->name); p->name =3D NULL; multifd_pages_clear(p->pages); @@ -1048,7 +1049,6 @@ void multifd_save_cleanup(void) p->packet =3D NULL; } qemu_sem_destroy(&multifd_send_state->channels_ready); - qemu_sem_destroy(&multifd_send_state->sem_sync); g_free(multifd_send_state->params); multifd_send_state->params =3D NULL; multifd_pages_clear(multifd_send_state->pages); @@ -1096,7 +1096,7 @@ static void multifd_send_sync_main(RAMState *rs) MultiFDSendParams *p =3D &multifd_send_state->params[i]; =20 trace_multifd_send_sync_main_wait(p->id); - qemu_sem_wait(&multifd_send_state->sem_sync); + qemu_sem_wait(&p->sem_sync); } trace_multifd_send_sync_main(multifd_send_state->packet_num); } @@ -1156,7 +1156,7 @@ static void *multifd_send_thread(void *opaque) qemu_mutex_unlock(&p->mutex); =20 if (flags & MULTIFD_FLAG_SYNC) { - qemu_sem_post(&multifd_send_state->sem_sync); + qemu_sem_post(&p->sem_sync); } qemu_sem_post(&multifd_send_state->channels_ready); } else if (p->quit) { @@ -1179,7 +1179,7 @@ out: */ if (ret !=3D 0) { if (flags & MULTIFD_FLAG_SYNC) { - qemu_sem_post(&multifd_send_state->sem_sync); + qemu_sem_post(&p->sem_sync); } qemu_sem_post(&multifd_send_state->channels_ready); } @@ -1225,7 +1225,6 @@ int multifd_save_setup(void) multifd_send_state =3D g_malloc0(sizeof(*multifd_send_state)); multifd_send_state->params =3D g_new0(MultiFDSendParams, thread_count); multifd_send_state->pages =3D multifd_pages_init(page_count); - qemu_sem_init(&multifd_send_state->sem_sync, 0); qemu_sem_init(&multifd_send_state->channels_ready, 0); =20 for (i =3D 0; i < thread_count; i++) { @@ -1233,6 +1232,7 @@ int multifd_save_setup(void) =20 qemu_mutex_init(&p->mutex); qemu_sem_init(&p->sem, 0); + qemu_sem_init(&p->sem_sync, 0); p->quit =3D false; p->pending_job =3D 0; p->id =3D i; --=20 2.21.0 From nobody Tue Nov 11 19:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565888082; cv=none; d=zoho.com; s=zohoarc; b=Lseql6alMfrBacabEutmW7lKRCriUqjylojDKRUakORtlofwHtaPtbLCLajhhuYNj4vCXoWtdhGPnizzxABsWD1y8R5xJlBk5BNpypb9dW4uIK/h4M7X25IkPsBxDp4nMO9OSp65aAdPLxeMLw/B11b1h9sPEmexsviKD2Ulos8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565888082; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lHI61ESveNIJRh2vdw/jaKFQl4+Si/FhPAjFqxANzXI=; b=mLq+zLKfL9BTDk2wlv516aikT4p08OtY2I66Wn4jDDkSTQvPusrCLagn46acb4EQPEPIh/dGXm0rm4+mqvdqXvy3WjoimItYFCyAE1Ww45o3d1+g8ao8vBZQF/1YKa8xbMmVMTqKMXKzkvihOxpzcv1uJP9Bkr863PFavnVHttk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565888082273558.002021859087; Thu, 15 Aug 2019 09:54:42 -0700 (PDT) Received: from localhost ([::1]:44500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyJ1C-0007dg-E7 for importer@patchew.org; Thu, 15 Aug 2019 12:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47570) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIkF-0003Wl-2B for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:37:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIkA-0003bc-UL for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIkA-0003bD-N9 for qemu-devel@nongnu.org; Thu, 15 Aug 2019 12:36:54 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0A675AFF8; Thu, 15 Aug 2019 16:36:53 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76DE1BAAC; Thu, 15 Aug 2019 16:36:52 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2019 17:35:04 +0100 Message-Id: <20190815163504.18937-34-dgilbert@redhat.com> In-Reply-To: <20190815163504.18937-1-dgilbert@redhat.com> References: <20190815163504.18937-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 15 Aug 2019 16:36:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 33/33] migration: add some multifd traces X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, yury-kotov@yandex-team.ru, richardw.yang@linux.intel.com, marcandre.lureau@redhat.com, ivanren@tencent.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Message-Id: <20190814020218.1868-6-quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 3 +++ migration/trace-events | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index c7aa3d9a2c..35552c090b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1170,6 +1170,7 @@ static void *multifd_send_thread(void *opaque) =20 out: if (local_err) { + trace_multifd_send_error(p->id); multifd_send_terminate_threads(local_err); } =20 @@ -1200,6 +1201,7 @@ static void multifd_new_send_channel_async(QIOTask *t= ask, gpointer opaque) QIOChannel *sioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *local_err =3D NULL; =20 + trace_multifd_new_send_channel_async(p->id); if (qio_task_propagate_error(task, &local_err)) { migrate_set_error(migrate_get_current(), local_err); multifd_save_cleanup(); @@ -1486,6 +1488,7 @@ bool multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) atomic_read(&multifd_recv_state->count)); return false; } + trace_multifd_recv_new_channel(id); =20 p =3D &multifd_recv_state->params[id]; if (p->c !=3D NULL) { diff --git a/migration/trace-events b/migration/trace-events index 886ce70ca0..00ffcd5930 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -81,14 +81,18 @@ migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_bitmap_clear_dirty(char *str, uint64_t start, uint64_t size, uns= igned long page) "rb %s start 0x%"PRIx64" size 0x%"PRIx64" page 0x%lx" migration_throttle(void) "" +multifd_new_send_channel_async(uint8_t id) "channel %d" multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d f= lags 0x%x next packet size %d" +multifd_recv_new_channel(uint8_t id) "channel %d" multifd_recv_sync_main(long packet_num) "packet num %ld" multifd_recv_sync_main_signal(uint8_t id) "channel %d" multifd_recv_sync_main_wait(uint8_t id) "channel %d" multifd_recv_terminate_threads(bool error) "error %d" multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %d packets %" PRIu64 " pages %" PRIu64 multifd_recv_thread_start(uint8_t id) "%d" +multifd_save_setup_wait(uint8_t id) "%d" multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d f= lags 0x%x next packet size %d" +multifd_send_error(uint8_t id) "channel %d" multifd_send_sync_main(long packet_num) "packet num %ld" multifd_send_sync_main_signal(uint8_t id) "channel %d" multifd_send_sync_main_wait(uint8_t id) "channel %d" --=20 2.21.0