All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC 0/2] block/file-posix: allow -drive cache.direct=off live migration
@ 2018-04-19  7:52 Stefan Hajnoczi
  2018-04-19  7:52 ` [Qemu-devel] [RFC 1/2] block/file-posix: implement bdrv_co_invalidate_cache() on Linux Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Stefan Hajnoczi @ 2018-04-19  7:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Max Reitz, Kevin Wolf, Sergio Lopez, qemu-block,
	Dr. David Alan Gilbert, Stefan Hajnoczi

file-posix.c only supports shared storage live migration with -drive
cache.direct=off due to cache consistency issues.  There are two main shared
storage configurations: files on NFS and host block devices on SAN LUNs.

The problem is that QEMU starts on the destination host before the source host
has written everything out to the disk.  The page cache on the destination host
may contain stale data read when QEMU opened the image file (before migration
handover).  Using O_DIRECT avoids this problem but prevents users from taking
advantage of the host page cache.

Although cache=none is the recommended setting for virtualization use cases,
there are scenarios where cache=writeback makes sense.  If the guest has much
less RAM than the host or many guests share the same backing file, then the
host page cache can significantly improve disk I/O performance.

This patch series implements .bdrv_co_invalidate_cache() for block/file-posix.c
on Linux so that shared storage live migration works.  I have sent it as an RFC
because cache consistency is not binary, there are corner cases which I've
described in the actual patch, and this may require more discussion.

Regarding NFS, QEMU relies on O_DIRECT rather than the close-to-open
consistency model (see nfs(5)), which is the basic guarantee provided by NFS.
After this patch cache consistency is no longer provided by O_DIRECT.

This patch series relies on fdatasync(2) (source) +
posix_fadvise(POSIX_FADV_DONTNEED) (destination) instead.  I believe it is safe
for both NFS and SAN LUNs.  Maybe we should use fsync(2) instead of
fdatasync(2) so that NFS has up-to-date inode metadata?

Stefan Hajnoczi (2):
  block/file-posix: implement bdrv_co_invalidate_cache() on Linux
  block/file-posix: verify page cache is not used

 block/file-posix.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-04-27 12:22 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  7:52 [Qemu-devel] [RFC 0/2] block/file-posix: allow -drive cache.direct=off live migration Stefan Hajnoczi
2018-04-19  7:52 ` [Qemu-devel] [RFC 1/2] block/file-posix: implement bdrv_co_invalidate_cache() on Linux Stefan Hajnoczi
2018-04-19  8:13   ` Fam Zheng
2018-04-20  3:15     ` Stefan Hajnoczi
2018-04-20  3:36       ` Fam Zheng
2018-04-20  6:13       ` Kevin Wolf
2018-04-19  9:18   ` Dr. David Alan Gilbert
2018-04-20  3:21     ` Stefan Hajnoczi
2018-04-20  6:27       ` Kevin Wolf
2018-04-19  7:52 ` [Qemu-devel] [RFC 2/2] block/file-posix: verify page cache is not used Stefan Hajnoczi
2018-04-19  9:05   ` Dr. David Alan Gilbert
2018-04-20  3:02     ` Stefan Hajnoczi
2018-04-20  6:25       ` Kevin Wolf
2018-04-24 14:04         ` Stefan Hajnoczi
2018-04-24 14:29           ` Kevin Wolf
2018-04-27 10:06             ` Stefan Hajnoczi
2018-04-19 16:09 ` [Qemu-devel] [RFC 0/2] block/file-posix: allow -drive cache.direct=off live migration Eric Blake
2018-04-20  3:05   ` Stefan Hajnoczi
2018-04-20 13:53     ` Eric Blake
2018-04-24 13:43       ` Stefan Hajnoczi

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.