Stefan Hajnoczi <[email protected]> writes:

> On Fri, Mar 01, 2019 at 10:30:07AM -0600, Eric Blake wrote:
>> On 3/1/19 10:09 AM, Stefan Hajnoczi wrote:
>> > Commit dd577a26ff03b6829721b1ffbbf9e7c411b72378 ("block/file-posix:
>> > implement bdrv_co_invalidate_cache() on Linux") introduced page cache
>> > invalidation so that cache.direct=off live migration is safe on Linux.
>> > 
>> > The invalidation takes a significant amount of time when the file is
>> > large and present in the page cache.  Normally this is not the case for
>> > cross-host live migration but it can happen when migrating between QEMU
>> > processes on the same host.
>> > 
>> > On same-host migration we don't need to invalidate pages for correctness
>> > anyway, so an option to skip page cache invalidation is useful.  I
>> > investigated optimizing invalidation and detecting same-host migration,
>> > but both are hard to achieve so a user-visible option will suffice.
>> > 
>> > Suggested-by: Neil Skrypuch <[email protected]>
>> > Tested-by: Neil Skrypuch <[email protected]>
>> > Reviewed-by: Stefano Garzarella <[email protected]>
>> > Reviewed-by: Eric Blake <[email protected]>
>> > Signed-off-by: Stefan Hajnoczi <[email protected]>
>> > ---
>> > v2:
>> >  * Remove outdated comment about libvirt feature detection [danpb]
>> 
>> Question - if we used qapi's 'if':COND to only declare the field on
>> platforms where we know at compile time that we can support it, would
>> that be enough for libvirt to introspect that if the field exists then
>> migration is safe, without having to rely on an query-qemu-features command?
>
> Yes, although this raises another question:
>
> The drop-cache implementation is not #ifdefed in file-posix.c.  If we
> make the QMP schema conditional, should we also #ifdef the command-line
> option in raw_runtime_opts[] to prevent QEMU from silently ignoring this
> option?

Silently ignoring user directives is generally a bad idea.  Possible
exceptions include directives of a "$frobnicate if you can" kind.

Reply via email to