From: Peter Xu <peterx@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Leonardo Bras Soares Passos" <lsoaresp@redhat.com>,
"David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH v2 4/4] migration: Allow postcopy_ram_supported_by_host() to report err
Date: Tue, 25 Apr 2023 21:10:37 -0400 [thread overview]
Message-ID: <ZEh6DUILNIpUKmYO@x1n> (raw)
In-Reply-To: <87y1mnzm4j.fsf@secure.mitica>
On Wed, Apr 19, 2023 at 09:51:24PM +0200, Juan Quintela wrote:
> Peter Xu <peterx@redhat.com> wrote:
> > Instead of print it to STDERR, bring the error upwards so that it can be
> > reported via QMP responses.
> >
> > E.g.:
> >
> > { "execute": "migrate-set-capabilities" ,
> > "arguments": { "capabilities":
> > [ { "capability": "postcopy-ram", "state": true } ] } }
> >
> > { "error":
> > { "class": "GenericError",
> > "desc": "Postcopy is not supported: Host backend files need to be TMPFS
> > or HUGETLBFS only" } }
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > migration/migration.c | 9 +++---
> > migration/postcopy-ram.c | 61 ++++++++++++++++++++++------------------
> > migration/postcopy-ram.h | 3 +-
> > migration/savevm.c | 3 +-
> > 4 files changed, 42 insertions(+), 34 deletions(-)
> >
> > diff --git a/migration/migration.c b/migration/migration.c
> > index bda4789193..ac15fa6092 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -1313,6 +1313,7 @@ static bool migrate_caps_check(bool *cap_list,
> > MigrationCapabilityStatusList *cap;
> > bool old_postcopy_cap;
> > MigrationIncomingState *mis = migration_incoming_get_current();
> > + Error *local_err = NULL;
>
> This variable can be declared in the only block that uses it.
Sure, though I just remembered I can use ERRP_GUARD(), hence I'll go with
that.
>
> > diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> > index bbb8af61ae..0713ddeeef 100644
> > --- a/migration/postcopy-ram.c
> > +++ b/migration/postcopy-ram.c
> > @@ -282,11 +282,14 @@ static bool request_ufd_features(int ufd, uint64_t features)
> > return true;
> > }
> >
> > -static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis)
> > +static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis,
> > + Error **errp)
> > {
> > uint64_t asked_features = 0;
> > static uint64_t supported_features;
> >
> > + assert(errp);
> > +
>
> Is this right? My impression was that you have to live with errp being NULL.
Right it knows, I just wanted to make sure error msg got captured, but we
don't really need to worrry here, all callers are in this case I believe.
Let me also switch to ERRP_GUARD() just to still avoid error_abort being
passed in, so we can still abort with a full message.
>
> error_setg() knows how to handle it being NULL:
>
> error_setg() -> error_setg_internal() -> error_setv()
>
> static void error_setv(Error **errp,
> const char *src, int line, const char *func,
> ErrorClass err_class, const char *fmt, va_list ap,
> const char *suffix)
> {
> ....
> if (errp == NULL) {
> return;
> }
>
>
> > -static int test_ramblock_postcopiable(RAMBlock *rb)
> > +static int test_ramblock_postcopiable(RAMBlock *rb, Error **errp)
>
> In patch 3 you do this other change:
>
> -static int test_ramblock_postcopiable(RAMBlock *rb, void *opaque)
> +static int test_ramblock_postcopiable(RAMBlock *rb)
>
> Can you do with a single change?
>
> The idea of the patch is right.
I saw that patch 3 already merged. I'll just spin this one, thanks!
--
Peter Xu
prev parent reply other threads:[~2023-04-26 1:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 16:17 [PATCH v2 0/4] migration/hostmem: Allow to fail early for postcopy on specific fs type Peter Xu
2023-04-19 16:17 ` [PATCH v2 1/4] util/mmap-alloc: qemu_fd_getfs() Peter Xu
2023-04-19 16:31 ` David Hildenbrand
2023-04-19 19:34 ` Juan Quintela
2023-04-19 16:17 ` [PATCH v2 2/4] vl.c: Create late backends before migration object Peter Xu
2023-04-19 16:31 ` David Hildenbrand
2023-04-19 19:35 ` Juan Quintela
2023-04-19 16:17 ` [PATCH v2 3/4] migration/postcopy: Detect file system on dest host Peter Xu
2023-04-19 19:42 ` Juan Quintela
2023-04-19 16:17 ` [PATCH v2 4/4] migration: Allow postcopy_ram_supported_by_host() to report err Peter Xu
2023-04-19 19:51 ` Juan Quintela
2023-04-26 1:10 ` Peter Xu [this message]
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=ZEh6DUILNIpUKmYO@x1n \
--to=peterx@redhat.com \
--cc=berrange@redhat.com \
--cc=david@redhat.com \
--cc=lsoaresp@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.