From: Peter Xu <peterx@redhat.com>
To: Catherine Ho <catherine.hecx@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Juan Quintela <quintela@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] hostmem-file: warn when memory-backend-file, share=on and in incoming migration
Date: Mon, 8 Apr 2019 15:04:39 +0800 [thread overview]
Message-ID: <20190408070439.GC4340@xz-x1> (raw)
In-Reply-To: <CAEn6zmE3tjtZrusqZptkgqi2CFaNndsVHekr9=uxS=YptcbQzQ@mail.gmail.com>
On Mon, Apr 08, 2019 at 02:15:36PM +0800, Catherine Ho wrote:
> Hi Peter Xu
>
> On Mon, 8 Apr 2019 at 11:25, Peter Xu <peterx@redhat.com> wrote:
>
> > On Sun, Apr 07, 2019 at 10:19:05PM -0400, Catherine Ho wrote:
> > > Currently it is not forbidden to use "-object
> > memory-backend-file,share=on"
> > > and together with "-incoming". But after incoming migration is finished,
> > > the memory-backend-file will be definitely written if share=on. So the
> > > memory-backend-file can only be used once, but failed in the 2nd time
> > > incoming.
> > >
> > > Thus it gives a warning and the users can run the qemu if they really
> > > want to do it.
> > >
> > > Signed-off-by: Catherine Ho <catherine.hecx@gmail.com>
> > > ---
> > > backends/hostmem-file.c | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> > > diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> > > index 37ac6445d2..59429ee0b4 100644
> > > --- a/backends/hostmem-file.c
> > > +++ b/backends/hostmem-file.c
> > > @@ -16,6 +16,7 @@
> > > #include "sysemu/hostmem.h"
> > > #include "sysemu/sysemu.h"
> > > #include "qom/object_interfaces.h"
> > > +#include "migration/migration.h"
> > >
> > > /* hostmem-file.c */
> > > /**
> > > @@ -79,6 +80,16 @@ file_backend_memory_alloc(HostMemoryBackend *backend,
> > Error **errp)
> > > }
> > > }
> > >
> > > + /*
> > > + * In ignore shared case, if share=on for host memory backend file,
> > > + * the ram might be written after incoming process is finished. Thus
> > > + * the memory backend can't be reused for 2nd/3rd... incoming
> > > + */
> > > + if (backend->share && migrate_ignore_shared()
> > > + && runstate_check(RUN_STATE_INMIGRATE))
> > > + warn_report("share=on for memory backend file might be "
> > > + "conflicted with incoming in ignore shared
> > case");
> >
> > I feel like this message wasn't really clear to me... you want to
> > warn people these data might not match with each other, right? How
> > about simply state it:
> >
> > NOTE: Please make sure the data on the shared memory backend file
> > and the data from the incoming migration stream contains matching
> > contents, otherwise...
> >
>
> Sorry for my vague expression.
> The background is [1]
> I happened to use "-object memory-backend-file,share=on" and together with
> "-incoming".
> It worked fine in 1st incoming migration but failed in 2nd, 3rd incoming
> migration.
> Because qemu uses qemu_ram_mmap(..., MAP_SHARED,...) when share=on, the
> memory-backend-file will be written after 1st incoming migration.
> Finally I realized that this was caused by "share=on" flag, and after I
> removed it,
> the memory-backend-file will not be changed any more.
>
> So do you think it will be better that qemu gives the user a clear warning
> that
> incoming migration will change the data in memory-backend-file with
> "share=on" ?
Hmm... "a shared memory backend file" would already be clear to me
that it will be modified, but it might be subjective.
Regards,
--
Peter Xu
WARNING: multiple messages have this Message-ID (diff)
From: Peter Xu <peterx@redhat.com>
To: Catherine Ho <catherine.hecx@gmail.com>
Cc: Juan Quintela <quintela@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] hostmem-file: warn when memory-backend-file, share=on and in incoming migration
Date: Mon, 8 Apr 2019 15:04:39 +0800 [thread overview]
Message-ID: <20190408070439.GC4340@xz-x1> (raw)
Message-ID: <20190408070439.gPk7AbH7q9DKFyhAgthiAoKZyvAMGTVl_7WYQUkpEhs@z> (raw)
In-Reply-To: <CAEn6zmE3tjtZrusqZptkgqi2CFaNndsVHekr9=uxS=YptcbQzQ@mail.gmail.com>
On Mon, Apr 08, 2019 at 02:15:36PM +0800, Catherine Ho wrote:
> Hi Peter Xu
>
> On Mon, 8 Apr 2019 at 11:25, Peter Xu <peterx@redhat.com> wrote:
>
> > On Sun, Apr 07, 2019 at 10:19:05PM -0400, Catherine Ho wrote:
> > > Currently it is not forbidden to use "-object
> > memory-backend-file,share=on"
> > > and together with "-incoming". But after incoming migration is finished,
> > > the memory-backend-file will be definitely written if share=on. So the
> > > memory-backend-file can only be used once, but failed in the 2nd time
> > > incoming.
> > >
> > > Thus it gives a warning and the users can run the qemu if they really
> > > want to do it.
> > >
> > > Signed-off-by: Catherine Ho <catherine.hecx@gmail.com>
> > > ---
> > > backends/hostmem-file.c | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> > > diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> > > index 37ac6445d2..59429ee0b4 100644
> > > --- a/backends/hostmem-file.c
> > > +++ b/backends/hostmem-file.c
> > > @@ -16,6 +16,7 @@
> > > #include "sysemu/hostmem.h"
> > > #include "sysemu/sysemu.h"
> > > #include "qom/object_interfaces.h"
> > > +#include "migration/migration.h"
> > >
> > > /* hostmem-file.c */
> > > /**
> > > @@ -79,6 +80,16 @@ file_backend_memory_alloc(HostMemoryBackend *backend,
> > Error **errp)
> > > }
> > > }
> > >
> > > + /*
> > > + * In ignore shared case, if share=on for host memory backend file,
> > > + * the ram might be written after incoming process is finished. Thus
> > > + * the memory backend can't be reused for 2nd/3rd... incoming
> > > + */
> > > + if (backend->share && migrate_ignore_shared()
> > > + && runstate_check(RUN_STATE_INMIGRATE))
> > > + warn_report("share=on for memory backend file might be "
> > > + "conflicted with incoming in ignore shared
> > case");
> >
> > I feel like this message wasn't really clear to me... you want to
> > warn people these data might not match with each other, right? How
> > about simply state it:
> >
> > NOTE: Please make sure the data on the shared memory backend file
> > and the data from the incoming migration stream contains matching
> > contents, otherwise...
> >
>
> Sorry for my vague expression.
> The background is [1]
> I happened to use "-object memory-backend-file,share=on" and together with
> "-incoming".
> It worked fine in 1st incoming migration but failed in 2nd, 3rd incoming
> migration.
> Because qemu uses qemu_ram_mmap(..., MAP_SHARED,...) when share=on, the
> memory-backend-file will be written after 1st incoming migration.
> Finally I realized that this was caused by "share=on" flag, and after I
> removed it,
> the memory-backend-file will not be changed any more.
>
> So do you think it will be better that qemu gives the user a clear warning
> that
> incoming migration will change the data in memory-backend-file with
> "share=on" ?
Hmm... "a shared memory backend file" would already be clear to me
that it will be modified, but it might be subjective.
Regards,
--
Peter Xu
next prev parent reply other threads:[~2019-04-08 7:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 2:19 [Qemu-devel] [PATCH] hostmem-file: warn when memory-backend-file, share=on and in incoming migration Catherine Ho
2019-04-08 2:19 ` Catherine Ho
2019-04-08 3:25 ` Peter Xu
2019-04-08 3:25 ` Peter Xu
2019-04-08 6:15 ` Catherine Ho
2019-04-08 6:15 ` Catherine Ho
2019-04-08 7:04 ` Peter Xu [this message]
2019-04-08 7:04 ` Peter Xu
2019-04-08 8:43 ` [Qemu-devel] [PATCH v2] " Catherine Ho
2019-04-08 8:43 ` Catherine Ho
2019-04-08 10:35 ` [Qemu-devel] [PATCH] " Igor Mammedov
2019-04-08 10:35 ` Igor Mammedov
2019-04-09 2:21 ` Catherine Ho
2019-04-09 2:21 ` Catherine Ho
2019-04-10 14:59 ` Dr. David Alan Gilbert
2019-04-10 14:59 ` Dr. David Alan Gilbert
2019-04-10 15:36 ` Catherine Ho
2019-04-10 15:36 ` Catherine Ho
2019-04-10 16:57 ` Dr. David Alan Gilbert
2019-04-10 16:57 ` Dr. David Alan Gilbert
2019-04-11 1:25 ` Catherine Ho
2019-04-11 1:25 ` Catherine Ho
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=20190408070439.GC4340@xz-x1 \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=catherine.hecx@gmail.com \
--cc=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
/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).