qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta@ionos.com>
To: David Hildenbrand <david@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Rik van Riel <riel@surriel.com>,
	Qemu Developers <qemu-devel@nongnu.org>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [RFC] virtio_pmem: enable live migration support
Date: Wed, 12 Jan 2022 17:48:12 +0100	[thread overview]
Message-ID: <CALzYo304SsT92kNkscj5SyGAwsBOR2tk-Sk+3STBWkhxOYv+Lg@mail.gmail.com> (raw)
In-Reply-To: <CALzYo30gkF=8pTzyxsCOHUnHHBp-xrf8FWpLg-SVJFDScujXWw@mail.gmail.com>

> > >>>> I mean, that would be fundamentally broken, because the fsync() would
> > >>>> corrupt the file. So I assume in a sane environment, the dst could only
> > >>>> have stale clean pagecache pages. And we'd have to get rid of these to
> > >>>> re-read everything from file.
> > >>>
> > >>> In case of write back cache mode, we could still have stale dirty
> > >>> pages at the destination
> > >>> host and destination fsync is not the right thing to do. We need to
> > >>> invalidate these pages
> > >>> (Can we invalidate dirty pages resident in page cache with
> > >>> POSIX_FADV_DONTNEED as
> > >>> well?) man pages say, we cannot (unless i misunderstood it).
> > >>>
> > >>
> > >> I think you'd have to fsync + POSIX_FADV_DONTNEED. But I am still
> > >> confused how we could end up with dirty pagecache pages on the
> > >> destination. In my opinion, there should only be clean pagecache pages
> > >> -- can someone enlighten me? :)
> > >
> > > because of activity on the page cache pages corresponding to mmap region
> > > in the past which is not synced yet or not reclaimed yet. Maybe this
> > > is hypothetical
> > > or not possible, happy to learn?
> >
> > Right, but assume the following *sane*
> >
> > #1 H0 starts and runs VM.
> > #2 H0 migrates VM to H1.
> > #3 H1 runs VM.
> > #4 H1 migrates VM to H0.
> > #5 H0 runs VM.
> >
> > We'd expect a proper fsync during #2, writing back any dirty pages to
> > the memory backend. Otherwise, #3 would already be broken. Similarly,
> > we'd expect a proper fsync during #4.
> >
> > I assume during #4 we could find clean pagecache pages that are actually
> > invalid, because the underlying file was changed by H1. So we have to
> > make sure to invalidate all pagecache pages (all clean).
>
> Yes, you mean fsync on source host before migration starts. My point
> is something
> like another process mmap same backend file on destination host and/or
> guest/qemu
> crashing abruptly.

In that case we should not start guest if we cannot invalidate all the
corresponding
page cache pages before starting guest i.e mmaping virtio-pmem backend file.

Thank you for the discussion!

Best regards,
Pankaj


      reply	other threads:[~2022-01-12 16:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 12:01 [RFC] virtio_pmem: enable live migration support Pankaj Gupta
2022-01-12 10:36 ` David Hildenbrand
2022-01-12 15:44   ` Pankaj Gupta
2022-01-12 15:49     ` David Hildenbrand
2022-01-12 16:08       ` Pankaj Gupta
2022-01-12 16:26         ` David Hildenbrand
2022-01-12 16:42           ` Pankaj Gupta
2022-01-12 16:48             ` Pankaj Gupta [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=CALzYo304SsT92kNkscj5SyGAwsBOR2tk-Sk+3STBWkhxOYv+Lg@mail.gmail.com \
    --to=pankaj.gupta@ionos.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=mst@redhat.com \
    --cc=pankaj.gupta.linux@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riel@surriel.com \
    --cc=stefanha@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 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).