From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Wei Yang <richardw.yang@linux.intel.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [PATCH 2/2] migration/compress: disable compress if failed to setup
Date: Thu, 7 Nov 2019 12:11:25 +0000 [thread overview]
Message-ID: <20191107121125.GI2816@work-vm> (raw)
In-Reply-To: <20191012023932.1863-3-richardw.yang@linux.intel.com>
* Wei Yang (richardw.yang@linux.intel.com) wrote:
> In current logic, if compress_threads_save_setup() returns -1 the whole
> migration would fail, while we could handle it gracefully by disable
> compress.
I think it's fine for migration to fail here; the user askd for
compression - if it doesn't work then it's OK to fail and they can
switch it off; since it fails right at the start there's nothing lost.
Dave
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
> migration/migration.c | 9 +++++++++
> migration/migration.h | 1 +
> migration/ram.c | 15 ++++++++-------
> 3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 5f7e4d15e9..02b95f4223 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2093,6 +2093,15 @@ bool migrate_use_compression(void)
> return s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS];
> }
>
> +void migrate_disable_compression(void)
> +{
> + MigrationState *s;
> +
> + s = migrate_get_current();
> +
> + s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS] = false;
> +}
> +
> int migrate_compress_level(void)
> {
> MigrationState *s;
> diff --git a/migration/migration.h b/migration/migration.h
> index 4f2fe193dc..51368d3a6e 100644
> --- a/migration/migration.h
> +++ b/migration/migration.h
> @@ -309,6 +309,7 @@ bool migrate_use_return_path(void);
> uint64_t ram_get_total_transferred_pages(void);
>
> bool migrate_use_compression(void);
> +void migrate_disable_compression(void);
> int migrate_compress_level(void);
> int migrate_compress_threads(void);
> int migrate_compress_wait_thread(void);
> diff --git a/migration/ram.c b/migration/ram.c
> index 96c9b16402..39279161a8 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -533,12 +533,12 @@ static void compress_threads_save_cleanup(void)
> comp_param = NULL;
> }
>
> -static int compress_threads_save_setup(void)
> +static void compress_threads_save_setup(void)
> {
> int i, thread_count;
>
> if (!migrate_use_compression()) {
> - return 0;
> + return;
> }
> thread_count = migrate_compress_threads();
> compress_threads = g_new0(QemuThread, thread_count);
> @@ -569,11 +569,14 @@ static int compress_threads_save_setup(void)
> do_data_compress, comp_param + i,
> QEMU_THREAD_JOINABLE);
> }
> - return 0;
> + return;
>
> exit:
> compress_threads_save_cleanup();
> - return -1;
> + migrate_disable_compression();
> + error_report("%s: failed to setup compress threads, compress disabled",
> + __func__);
> + return;
> }
>
> /* Multiple fd's */
> @@ -3338,9 +3341,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
> RAMState **rsp = opaque;
> RAMBlock *block;
>
> - if (compress_threads_save_setup()) {
> - return -1;
> - }
> + compress_threads_save_setup();
>
> /* migration has already setup the bitmap, reuse it. */
> if (!migration_in_colo_state()) {
> --
> 2.17.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2019-11-07 12:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 2:39 [PATCH 0/2] migration/compress: refine the compress case Wei Yang
2019-10-12 2:39 ` [PATCH 1/2] migration/compress: compress QEMUFile is not writable Wei Yang
2019-11-07 11:59 ` Dr. David Alan Gilbert
2019-11-07 12:08 ` Wei Yang
2020-01-27 15:32 ` Juan Quintela
2019-10-12 2:39 ` [PATCH 2/2] migration/compress: disable compress if failed to setup Wei Yang
2019-11-07 12:11 ` Dr. David Alan Gilbert [this message]
2020-01-27 15:13 ` Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191107121125.GI2816@work-vm \
--to=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richardw.yang@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).