qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	xen-devel <xen-devel@lists.xen.org>,
	Alex Bligh <alex@alex.org.uk>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [Xen-devel] [PATCHv3] QEMU(upstream): Disable xen's use of O_DIRECT by default as it results in crashes.
Date: Tue, 19 Mar 2013 11:43:24 +0100	[thread overview]
Message-ID: <5148414C.7060303@redhat.com> (raw)
In-Reply-To: <CAFLBxZbL4JC9SBgHzehtfpcjtR5OQN90SPFSTsXRLrpTWUSBsQ@mail.gmail.com>

Il 19/03/2013 11:06, George Dunlap ha scritto:
> On Mon, Mar 18, 2013 at 6:00 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> Il 18/03/2013 18:38, George Dunlap ha scritto:
>>>>>
>>>> This might be a difference between Xen and KVM. On Xen migration is
>>>> made to a server in a paused state, and it's only unpaused when
>>>> the migration to B is complete. There's a sort of extra handshake at
>>>> the end.
>>>
>>> I think what you mean is that all the memory is handled by Xen and the
>>> toolstack, not by qemu.  The qemu state is sent as the very last thing,
>>> after all of the memory, and therefore (you are arguing) that qemu is
>>> not started, and the files cannot be opened, until after the migration
>>> is nearly complete, and certainly until after the file is closed on the
>>> sending side.
>>
>> That would be quite dangerous.  Files aren't closed until after QEMU
>> exits; at this point whatever problem you have launching QEMU on the
>> destination would be unrecoverable.
> 
> But if I understand your concern correctly, you were concerned about
> the following scenario:
> R1. Receiver qemu opens file
> R2. Something causes receiver kernel to cache parts of file (maybe
> optimistic read-ahead)

For some image formats, metadata is cached inside QEMU on startup.
There is a callback to invalidate QEMU's cache at the end of migration,
but that does not extend to the page cache.

> S1. Sender qemu writes to file
> S2. Sender qemu does final flush
> S3. Sender qemu closes file
> R3. Receiver reads stale blocks from cache
> 
> Even supposing that Xen doesn't actually shut down qemu until it is
> started on the remote side, as long as the file isn't opened by qemu
> until after S2, we should be safe, right?  It would look like this:
> 
> S1. Sender qemu writes to file
> S2. Sender qemu does final flush
> R1. Receiver qemu opens file
> R2. Receiver kernel caches file
> S3. Sender qemu closes file
> 
> This is all assuming that:
> 1. The barrier operations / write flush are effective at getting the
> data back on to the NFS server
> 2. The receiver qemu doesn't open the file until after the last flush
> by the sender.
> 
> Number 1 has been tested by Alex I believe, and is mentioned in the
> changeset log; so if #2 is true, then we should be safe.  I'll try to
> verify that today.

Thanks.

>> Even for successful migration, it would also be bad for downtime (QEMU
>> isn't exactly lightning-fast to start).  And even if failure weren't
>> catastrophic, it would be a pity to transfer a few gigs of memory and
>> then find out that QEMU isn't present in the destination. :)
> 
> Well, if qemu isn't present at the destination, that's definitely user
> error. :-)  In any case, I know that he migrate can resume if it
> fails, so I suspect that the qemu is just paused on the sending side
> until the migration is known to complete.  As long as the last write
> was flushed to the NFS server before the receiver opens the file, we
> should be safe.

Note that the close really must happen before the next open.  Otherwise
the file metadata might not be up-to-date on the destination, too.

Paolo

  reply	other threads:[~2013-03-19 10:43 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 12:18 [Qemu-devel] [PATCHv3] QEMU(upstream): Disable xen's use of O_DIRECT by default as it results in crashes Alex Bligh
2013-03-18 13:03 ` Stefan Hajnoczi
2013-03-18 13:19   ` Alex Bligh
2013-03-18 13:32 ` Paolo Bonzini
2013-03-18 13:49   ` Alex Bligh
2013-03-18 14:05     ` Paolo Bonzini
2013-03-18 14:30       ` Alex Bligh
2013-03-18 14:49         ` Paolo Bonzini
2013-03-18 15:40           ` Alex Bligh
2013-03-18 16:19             ` Paolo Bonzini
2013-03-18 16:53               ` Alex Bligh
2013-03-18 17:38                 ` George Dunlap
2013-03-18 17:47                   ` Alex Bligh
2013-03-18 18:00                   ` Paolo Bonzini
2013-03-19 10:06                     ` [Qemu-devel] [Xen-devel] " George Dunlap
2013-03-19 10:43                       ` Paolo Bonzini [this message]
2013-03-19 10:51                         ` George Dunlap
2013-03-19 11:14                           ` Paolo Bonzini
2013-03-19 11:21                             ` George Dunlap
2013-03-19 15:12                               ` George Dunlap
2013-03-19 15:29                                 ` George Dunlap
2013-03-19 19:15                                   ` Alex Bligh
2013-03-20 10:24                                     ` Stefano Stabellini
2013-03-20 10:37                                       ` George Dunlap
2013-03-20 11:08                                         ` Paolo Bonzini
2013-03-20 11:20                                           ` Alex Bligh
2013-03-20 11:57                                       ` David Scott
2013-03-19 11:44                             ` Alex Bligh
2013-03-19 11:49                               ` Paolo Bonzini
2013-03-19 15:13                         ` Stefano Stabellini
2013-03-19 16:53                           ` Paolo Bonzini
2013-03-19 17:03                             ` Stefano Stabellini
2013-03-20  8:33                           ` Alex Bligh
2013-03-20  9:26                             ` Paolo Bonzini
2013-03-29 17:19                               ` Stefano Stabellini
2013-03-31 19:53                                 ` Alex Bligh
2013-04-01 15:32                                   ` [Qemu-devel] [PATCH] [RFC] Xen PV backend: Move call to bdrv_new from blk_init to blk_connect Alex Bligh
2013-04-01 15:44                                     ` Stefano Stabellini
2013-04-01 20:56                                       ` Alex Bligh
2013-04-02 11:08                                         ` Stefano Stabellini
2013-04-05 10:31                                           ` [Qemu-devel] [PATCHv2 1/2] " Alex Bligh
2013-04-05 10:31                                             ` [Qemu-devel] [PATCHv2 2/2] Xen PV backend: Disable use of O_DIRECT by default as it results in crashes Alex Bligh
2013-04-05 14:22                                             ` [Qemu-devel] [PATCHv2 1/2] Xen PV backend: Move call to bdrv_new from blk_init to blk_connect Stefano Stabellini
2013-04-05 15:42                                               ` [Qemu-devel] [PATCHv3 " Alex Bligh
2013-04-05 15:42                                                 ` [Qemu-devel] [PATCHv3 2/2] Xen PV backend: Disable use of O_DIRECT by default as it results in crashes Alex Bligh
2013-04-05 15:43                                               ` [Qemu-devel] [PATCHv2 1/2] Xen PV backend: Move call to bdrv_new from blk_init to blk_connect Alex Bligh
2013-04-05 10:32                                           ` [Qemu-devel] [PATCHv2 1/2] Xen PV backend (for qemu-upstream-4.2-testing): " Alex Bligh
2013-04-05 10:32                                             ` [Qemu-devel] [PATCHv2 2/2] Xen PV backend (for qemu-upstream-4.2-testing): Disable use of O_DIRECT by default as it results in crashes Alex Bligh
2013-04-05 10:34                                           ` [Qemu-devel] [PATCH] [RFC] Xen PV backend: Move call to bdrv_new from blk_init to blk_connect Alex Bligh
2013-04-01 16:35                                   ` [Qemu-devel] [Xen-devel] [PATCHv3] QEMU(upstream): Disable xen's use of O_DIRECT by default as it results in crashes Alex Bligh

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=5148414C.7060303@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=alex@alex.org.uk \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xen.org \
    /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).