mbox series

[V1,0/4] Live Update reboot mode

Message ID 1697748466-373230-1-git-send-email-steven.sistare@oracle.com
Headers show
Series Live Update reboot mode | expand

Message

Steven Sistare Oct. 19, 2023, 8:47 p.m. UTC
Add a mode migration parameter that can be used to select alternate
migration algorithms.  The default mode is normal, representing the
current migration algorithm, and does not need to be explicitly set.

Provide the cpr-reboot migration mode for live update, which saves state to
a file.  This allows one to quit qemu, reboot to an updated kernel, install
an updated version of qemu, and resume via the migrate-incoming command.
The caller must specify a migration URI that writes to and reads from a file,
and must set the mode parameter before invoking the migrate or migrate-incoming
commands.

Unlike normal mode, the use of certain local storage options does not block
cpr-reboot mode, but the caller must not modify guest block devices between
the quit and restart.  The guest RAM memory-backend must be shared, and the
@x-ignore-shared migration capability must be set, to avoid saving RAM to the
file.  Guest RAM must be non-volatile across reboot, which can be achieved by
backing it with a dax device, or /dev/shm PKRAM as proposed in
https://lore.kernel.org/lkml/1617140178-8773-1-git-send-email-anthony.yznaga@oracle.com
but this is not enforced.  The restarted qemu arguments must match those used
to initially start qemu, plus the -incoming option.

This patch series contains minimal functionality.  Future patches will enhance
reboot mode by preserving vfio devices for suspended guests.  They will also
add a new mode for updating qemu using the exec system call, which will keep
vfio devices and certain character devices alive.

Here is an example of updating the host kernel using reboot mode.

window 1                                        | window 2
                                                |
# qemu-system-$arch -monitor stdio              |
  mem-path=/dev/dax0.0 ...                      |
QEMU 8.1.50 monitor - type 'help' for more info |
(qemu) info status                              |
VM status: running                              |
                                                | # yum update kernel-uek
(qemu) migrate_set_capability x-ignore-shared on|
(qemu) migrate_set_parameter mode cpr-reboot    |
(qemu) migrate -d file:vm.state                 |
(qemu) info status                              |
VM status: paused (postmigrate)                 |
(qemu) quit                                     |
                                                |
# systemctl kexec                               |
kexec_core: Starting new kernel                 |
...                                             |
                                                |
# qemu-system-$arch -monitor stdio              |
  mem-path=/dev/dax0.0 -incoming defer ...      |
QEMU 8.1.50 monitor - type 'help' for more info |
(qemu) info status                              |
VM status: paused (inmigrate)                   |
(qemu) migrate_set_capability x-ignore-shared on|
(qemu) migrate_set_parameter mode cpr-reboot    |
(qemu) migrate_incoming file:vm.state           |
(qemu) info status                              |
VM status: running                              |

Steve Sistare (4):
  migration: mode parameter
  migration: per-mode blockers
  cpr: relax some blockers
  cpr: reboot mode

 backends/tpm/tpm_emulator.c         |  2 +-
 block/parallels.c                   |  2 +-
 block/qcow.c                        |  2 +-
 block/vdi.c                         |  2 +-
 block/vhdx.c                        |  2 +-
 block/vmdk.c                        |  2 +-
 block/vpc.c                         |  2 +-
 block/vvfat.c                       |  2 +-
 hw/9pfs/9p.c                        |  2 +-
 hw/core/qdev-properties-system.c    | 12 +++++
 hw/scsi/vhost-scsi.c                |  2 +-
 hw/virtio/vhost.c                   |  2 +-
 include/hw/qdev-properties-system.h |  4 ++
 include/migration/blocker.h         | 44 +++++++++++++++--
 include/migration/misc.h            |  1 +
 migration/migration-hmp-cmds.c      |  8 ++++
 migration/migration.c               | 95 ++++++++++++++++++++++++++++++++-----
 migration/options.c                 | 21 ++++++++
 migration/options.h                 |  1 +
 qapi/migration.json                 | 41 ++++++++++++++--
 stubs/migr-blocker.c                | 10 ++++
 target/i386/nvmm/nvmm-all.c         |  3 +-
 22 files changed, 230 insertions(+), 32 deletions(-)

Comments

Steven Sistare Oct. 19, 2023, 9:18 p.m. UTC | #1
BTW, this series depends on the patch "migration: simplify blockers".

- Steve

On 10/19/2023 4:47 PM, Steve Sistare wrote:
> Add a mode migration parameter that can be used to select alternate
> migration algorithms.  The default mode is normal, representing the
> current migration algorithm, and does not need to be explicitly set.
> 
> Provide the cpr-reboot migration mode for live update, which saves state to
> a file.  This allows one to quit qemu, reboot to an updated kernel, install
> an updated version of qemu, and resume via the migrate-incoming command.
> The caller must specify a migration URI that writes to and reads from a file,
> and must set the mode parameter before invoking the migrate or migrate-incoming
> commands.
> 
> Unlike normal mode, the use of certain local storage options does not block
> cpr-reboot mode, but the caller must not modify guest block devices between
> the quit and restart.  The guest RAM memory-backend must be shared, and the
> @x-ignore-shared migration capability must be set, to avoid saving RAM to the
> file.  Guest RAM must be non-volatile across reboot, which can be achieved by
> backing it with a dax device, or /dev/shm PKRAM as proposed in
> https://lore.kernel.org/lkml/1617140178-8773-1-git-send-email-anthony.yznaga@oracle.com
> but this is not enforced.  The restarted qemu arguments must match those used
> to initially start qemu, plus the -incoming option.
> 
> This patch series contains minimal functionality.  Future patches will enhance
> reboot mode by preserving vfio devices for suspended guests.  They will also
> add a new mode for updating qemu using the exec system call, which will keep
> vfio devices and certain character devices alive.
> 
> Here is an example of updating the host kernel using reboot mode.
> 
> window 1                                        | window 2
>                                                 |
> # qemu-system-$arch -monitor stdio              |
>   mem-path=/dev/dax0.0 ...                      |
> QEMU 8.1.50 monitor - type 'help' for more info |
> (qemu) info status                              |
> VM status: running                              |
>                                                 | # yum update kernel-uek
> (qemu) migrate_set_capability x-ignore-shared on|
> (qemu) migrate_set_parameter mode cpr-reboot    |
> (qemu) migrate -d file:vm.state                 |
> (qemu) info status                              |
> VM status: paused (postmigrate)                 |
> (qemu) quit                                     |
>                                                 |
> # systemctl kexec                               |
> kexec_core: Starting new kernel                 |
> ...                                             |
>                                                 |
> # qemu-system-$arch -monitor stdio              |
>   mem-path=/dev/dax0.0 -incoming defer ...      |
> QEMU 8.1.50 monitor - type 'help' for more info |
> (qemu) info status                              |
> VM status: paused (inmigrate)                   |
> (qemu) migrate_set_capability x-ignore-shared on|
> (qemu) migrate_set_parameter mode cpr-reboot    |
> (qemu) migrate_incoming file:vm.state           |
> (qemu) info status                              |
> VM status: running                              |
> 
> Steve Sistare (4):
>   migration: mode parameter
>   migration: per-mode blockers
>   cpr: relax some blockers
>   cpr: reboot mode
> 
>  backends/tpm/tpm_emulator.c         |  2 +-
>  block/parallels.c                   |  2 +-
>  block/qcow.c                        |  2 +-
>  block/vdi.c                         |  2 +-
>  block/vhdx.c                        |  2 +-
>  block/vmdk.c                        |  2 +-
>  block/vpc.c                         |  2 +-
>  block/vvfat.c                       |  2 +-
>  hw/9pfs/9p.c                        |  2 +-
>  hw/core/qdev-properties-system.c    | 12 +++++
>  hw/scsi/vhost-scsi.c                |  2 +-
>  hw/virtio/vhost.c                   |  2 +-
>  include/hw/qdev-properties-system.h |  4 ++
>  include/migration/blocker.h         | 44 +++++++++++++++--
>  include/migration/misc.h            |  1 +
>  migration/migration-hmp-cmds.c      |  8 ++++
>  migration/migration.c               | 95 ++++++++++++++++++++++++++++++++-----
>  migration/options.c                 | 21 ++++++++
>  migration/options.h                 |  1 +
>  qapi/migration.json                 | 41 ++++++++++++++--
>  stubs/migr-blocker.c                | 10 ++++
>  target/i386/nvmm/nvmm-all.c         |  3 +-
>  22 files changed, 230 insertions(+), 32 deletions(-)
>
Juan Quintela Oct. 20, 2023, 9:23 a.m. UTC | #2
Steven Sistare <steven.sistare@oracle.com> wrote:
> BTW, this series depends on the patch "migration: simplify blockers".

simplify blockers and simplify notifiers are in the PULL request just
sent.

Later, Juan.