[Qemu-devel] [PATCH v2 0/5] Add ignore-external migration capability

Yury Kotov posted 5 patches 5 years, 2 months ago
Only 4 patches received!
There is a newer version of this series
exec.c                    |  38 ++++++-------
include/exec/cpu-common.h |   7 +--
migration/migration.c     |   9 ++++
migration/migration.h     |  11 +++-
migration/postcopy-ram.c  |  48 +++++++++--------
migration/ram.c           |  86 ++++++++++++++++++++++++++----
migration/rdma.c          |   9 ++--
migration/savevm.c        | 101 +++++++++++++++++++++++++++++++++++
qapi/migration.json       |   5 +-
stubs/ram-block.c         |  15 ++++++
tests/migration-test.c    | 109 +++++++++++++++++++++++++++++++-------
util/vfio-helpers.c       |   6 +--
12 files changed, 361 insertions(+), 83 deletions(-)
[Qemu-devel] [PATCH v2 0/5] Add ignore-external migration capability
Posted by Yury Kotov 5 years, 2 months ago
Hi,

The series adds a migration capability, which allows to skip shared RAM blocks
during the migration. It's useful for fast local migration. E.g. to update QEMU
for the running guests.

Usage example:
1. Start source VM:
   qemu-system-x86 \
     -m 4G \
     -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
     -numa node,memdev=mem0 \
     -qmp unix:/tmp/qemu-qmp-1.sock,server,nowait \

2. Start target VM:
   qemu-system-x86 \
     -m 4G \
     -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
     -numa node,memdev=mem0 \
     -qmp unix:/tmp/qemu-qmp-2.sock,server,nowait \
     -incoming defer

3. Enable ignore-external capability on both VMs:
   { "execute": "migrate-set-capabilities" , "arguments":
     { "capabilities": [ { "capability": "x-ignore-external", "state": true } ] } }

4. Start migration.

Another use case I keep in mind is to migrate to file. Usage is very similar.

V1 to V2:
* Keep migration stream compatibility
* Reuse the existing code to ignore unwanted RAMBlocks
* Add capability validation feature
* ignore-external -> ignore-shared

Regards,
Yury

Yury Kotov (5):
  exec: Change RAMBlockIterFunc definition
  migration: Move qemu_ram_foreach_migratable_block to migration code
  migration: Introduce ignore-shared capability
  tests/migration-test: Add a test for ignore-shared capability
  migration: Add capabilities validation

 exec.c                    |  38 ++++++-------
 include/exec/cpu-common.h |   7 +--
 migration/migration.c     |   9 ++++
 migration/migration.h     |  11 +++-
 migration/postcopy-ram.c  |  48 +++++++++--------
 migration/ram.c           |  86 ++++++++++++++++++++++++++----
 migration/rdma.c          |   9 ++--
 migration/savevm.c        | 101 +++++++++++++++++++++++++++++++++++
 qapi/migration.json       |   5 +-
 stubs/ram-block.c         |  15 ++++++
 tests/migration-test.c    | 109 +++++++++++++++++++++++++++++++-------
 util/vfio-helpers.c       |   6 +--
 12 files changed, 361 insertions(+), 83 deletions(-)

-- 
2.20.1


Re: [Qemu-devel] [PATCH v2 0/5] Add ignore-external migration capability
Posted by Yury Kotov 5 years, 2 months ago
Ping

04.02.2019, 16:27, "Yury Kotov" <yury-kotov@yandex-team.ru>:
> Hi,
>
> The series adds a migration capability, which allows to skip shared RAM blocks
> during the migration. It's useful for fast local migration. E.g. to update QEMU
> for the running guests.
>
> Usage example:
> 1. Start source VM:
>    qemu-system-x86 \
>      -m 4G \
>      -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
>      -numa node,memdev=mem0 \
>      -qmp unix:/tmp/qemu-qmp-1.sock,server,nowait \
>
> 2. Start target VM:
>    qemu-system-x86 \
>      -m 4G \
>      -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
>      -numa node,memdev=mem0 \
>      -qmp unix:/tmp/qemu-qmp-2.sock,server,nowait \
>      -incoming defer
>
> 3. Enable ignore-external capability on both VMs:
>    { "execute": "migrate-set-capabilities" , "arguments":
>      { "capabilities": [ { "capability": "x-ignore-external", "state": true } ] } }
>
> 4. Start migration.
>
> Another use case I keep in mind is to migrate to file. Usage is very similar.
>
> V1 to V2:
> * Keep migration stream compatibility
> * Reuse the existing code to ignore unwanted RAMBlocks
> * Add capability validation feature
> * ignore-external -> ignore-shared
>
> Regards,
> Yury
>
> Yury Kotov (5):
>   exec: Change RAMBlockIterFunc definition
>   migration: Move qemu_ram_foreach_migratable_block to migration code
>   migration: Introduce ignore-shared capability
>   tests/migration-test: Add a test for ignore-shared capability
>   migration: Add capabilities validation
>
>  exec.c | 38 ++++++-------
>  include/exec/cpu-common.h | 7 +--
>  migration/migration.c | 9 ++++
>  migration/migration.h | 11 +++-
>  migration/postcopy-ram.c | 48 +++++++++--------
>  migration/ram.c | 86 ++++++++++++++++++++++++++----
>  migration/rdma.c | 9 ++--
>  migration/savevm.c | 101 +++++++++++++++++++++++++++++++++++
>  qapi/migration.json | 5 +-
>  stubs/ram-block.c | 15 ++++++
>  tests/migration-test.c | 109 +++++++++++++++++++++++++++++++-------
>  util/vfio-helpers.c | 6 +--
>  12 files changed, 361 insertions(+), 83 deletions(-)
>
> --
> 2.20.1

Re: [Qemu-devel] [PATCH v2 0/5] Add ignore-external migration capability
Posted by Dr. David Alan Gilbert 5 years, 2 months ago
* Yury Kotov (yury-kotov@yandex-team.ru) wrote:
> Hi,
> 
> The series adds a migration capability, which allows to skip shared RAM blocks
> during the migration. It's useful for fast local migration. E.g. to update QEMU
> for the running guests.
> 
> Usage example:
> 1. Start source VM:
>    qemu-system-x86 \
>      -m 4G \
>      -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
>      -numa node,memdev=mem0 \
>      -qmp unix:/tmp/qemu-qmp-1.sock,server,nowait \
> 
> 2. Start target VM:
>    qemu-system-x86 \
>      -m 4G \
>      -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
>      -numa node,memdev=mem0 \
>      -qmp unix:/tmp/qemu-qmp-2.sock,server,nowait \
>      -incoming defer
> 
> 3. Enable ignore-external capability on both VMs:
>    { "execute": "migrate-set-capabilities" , "arguments":
>      { "capabilities": [ { "capability": "x-ignore-external", "state": true } ] } }
> 
> 4. Start migration.
> 
> Another use case I keep in mind is to migrate to file. Usage is very similar.

Hi,
  I've cc'd in Eric, Lai and Peter, all who were asking for something
similar last year;  can you all confirm this patch does what you need or
can work with what you needed to do?

Dave

> V1 to V2:
> * Keep migration stream compatibility
> * Reuse the existing code to ignore unwanted RAMBlocks
> * Add capability validation feature
> * ignore-external -> ignore-shared
> 
> Regards,
> Yury
> 
> Yury Kotov (5):
>   exec: Change RAMBlockIterFunc definition
>   migration: Move qemu_ram_foreach_migratable_block to migration code
>   migration: Introduce ignore-shared capability
>   tests/migration-test: Add a test for ignore-shared capability
>   migration: Add capabilities validation
> 
>  exec.c                    |  38 ++++++-------
>  include/exec/cpu-common.h |   7 +--
>  migration/migration.c     |   9 ++++
>  migration/migration.h     |  11 +++-
>  migration/postcopy-ram.c  |  48 +++++++++--------
>  migration/ram.c           |  86 ++++++++++++++++++++++++++----
>  migration/rdma.c          |   9 ++--
>  migration/savevm.c        | 101 +++++++++++++++++++++++++++++++++++
>  qapi/migration.json       |   5 +-
>  stubs/ram-block.c         |  15 ++++++
>  tests/migration-test.c    | 109 +++++++++++++++++++++++++++++++-------
>  util/vfio-helpers.c       |   6 +--
>  12 files changed, 361 insertions(+), 83 deletions(-)
> 
> -- 
> 2.20.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

Re: [Qemu-devel] [PATCH v2 0/5] Add ignore-external migration capability
Posted by Daniel P. Berrangé 5 years, 2 months ago
On Mon, Feb 11, 2019 at 04:03:57PM +0000, Dr. David Alan Gilbert wrote:
> * Yury Kotov (yury-kotov@yandex-team.ru) wrote:
> > Hi,
> > 
> > The series adds a migration capability, which allows to skip shared RAM blocks
> > during the migration. It's useful for fast local migration. E.g. to update QEMU
> > for the running guests.
> > 
> > Usage example:
> > 1. Start source VM:
> >    qemu-system-x86 \
> >      -m 4G \
> >      -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
> >      -numa node,memdev=mem0 \
> >      -qmp unix:/tmp/qemu-qmp-1.sock,server,nowait \
> > 
> > 2. Start target VM:
> >    qemu-system-x86 \
> >      -m 4G \
> >      -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \
> >      -numa node,memdev=mem0 \
> >      -qmp unix:/tmp/qemu-qmp-2.sock,server,nowait \
> >      -incoming defer
> > 
> > 3. Enable ignore-external capability on both VMs:
> >    { "execute": "migrate-set-capabilities" , "arguments":
> >      { "capabilities": [ { "capability": "x-ignore-external", "state": true } ] } }
> > 
> > 4. Start migration.
> > 
> > Another use case I keep in mind is to migrate to file. Usage is very similar.
> 
> Hi,
>   I've cc'd in Eric, Lai and Peter, all who were asking for something
> similar last year;  can you all confirm this patch does what you need or
> can work with what you needed to do?

x-ignore-external is a global setting so affects all memory-backend-file
instances. The obvious question is where there is any reasonable/conceivable
scenario in which QEMU would have multiple "-object memory-backend-file"
intsances and it be neccessary/desirable to migrate some, but skip migrate
of others ?

Could there ever be a device backend which is using a memory region
to communicate with an external process, where you would need to have
a new instance for the migration target QEMU, and explicitly not reuse
the source QEMU's memory-backend-file storage  ?

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|