[PATCH V1 04/32] savevm: HMP Command for cprsave

2020-07-30 Thread Steve Sistare
Enable HMP access to the cprsave QMP command. Usage: cprsave Signed-off-by: Maran Wilson Signed-off-by: Steve Sistare --- hmp-commands.hx | 18 ++ include/monitor/hmp.h | 1 + monitor/hmp-cmds.c| 10 ++ 3 files changed, 29 insertions(+) diff --git a/hmp

[PATCH V1 03/32] savevm: QMP command for cprsave

2020-07-30 Thread Steve Sistare
drivers suspend methods flush outstanding requests and re-initialize the devices, and thus there is no device state to save and restore. Signed-off-by: Steve Sistare Signed-off-by: Maran Wilson --- include/migration/vmstate.h | 1 + include/sysemu/sysemu.h | 2 ++ migration/block.c

[PATCH V1 01/32] savevm: add vmstate handler iterators

2020-07-30 Thread Steve Sistare
Provide the SAVEVM_FOREACH and SAVEVM_FORALL macros to loop over all save VM state handlers. The former will filter handlers based on the operation in the later patch "savevm: VM handlers mode mask". The latter loops over all handlers. No functional change. Signed-off-by: Ste

[PATCH V1 08/32] savevm: HMP command for cprinfo

2020-07-30 Thread Steve Sistare
Enable HMP access to the cprinfo QMP command. Usage: cprinfo Signed-off-by: Steve Sistare --- hmp-commands.hx | 13 + include/monitor/hmp.h | 1 + monitor/hmp-cmds.c| 10 ++ 3 files changed, 24 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index

[PATCH V1 32/32] vfio-pci: improved tracing

2020-07-30 Thread Steve Sistare
trace_vfio_descriptors trace_ram_block_add Signed-off-by: Steve Sistare --- accel/kvm/kvm-all.c| 8 ++-- accel/kvm/trace-events | 3 ++- exec.c | 3 +++ hw/pci/msix.c | 1 + hw/pci/pci.c | 10 ++ hw/pci/trace-events| 5 +++-- hw/vfio

[PATCH V1 07/32] savevm: QMP command for cprinfo

2020-07-30 Thread Steve Sistare
Provide the cprinfo QMP command. This returns a string with a space- separated list of modes supported by cprsave, and can be used by clients as a feature test to check if the running QEMU instance supports cprsave. Syntax: {'command':'cprinfo', 'returns':'str'} Signed-off-by: Steve Sistare

[PATCH V1 16/32] oslib: add qemu_clr_cloexec

2020-07-30 Thread Steve Sistare
Signed-off-by: Steve Sistare --- include/qemu/osdep.h | 1 + util/oslib-posix.c | 9 + util/oslib-win32.c | 4 3 files changed, 14 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 45c217a..bb28df1 100644 --- a/include/qemu/osdep.h +++ b/include/qemu

[PATCH V1 22/32] char: qio_channel_socket_accept reuse fd

2020-07-30 Thread Steve Sistare
From: Mark Kanda Add an fd argument to qio_channel_socket_accept. If not -1, the channel uses that fd instead of accepting a new socket connection. All callers pass -1 in this patch, so no functional change. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- include/io/channel

[PATCH V1 28/32] char: restore terminal on restart

2020-07-30 Thread Steve Sistare
If stdin is is a char backend device, then restore original stdin terminal settings in before re-exec'ing. Otherwise, the new qemu sees the modified settings as initial settings, and does not restore the true initial settings when it exits. Signed-off-by: Steve Sistare --- chardev/char-stdio.c

[PATCH V1 25/32] char: save/restore chardev pty fds

2020-07-30 Thread Steve Sistare
Save and restore pty descriptors across cprsave and cprload. Signed-off-by: Steve Sistare --- chardev/char-pty.c | 38 +++--- chardev/char.c | 2 ++ include/chardev/char.h | 1 + 3 files changed, 30 insertions(+), 11 deletions(-) diff --git

[PATCH V1 30/32] vfio-pci: save and restore

2020-07-30 Thread Steve Sistare
state of the device. However, the reconstruction is not complete until cprload is called, and vfio_pci_post_load uses the msi data to rebuild interrupt structures and attach the interrupts to the new KVM instance. Lastly, vfio device reset is suppressed when the VM is started. Signed-off-by: Steve

[PATCH V1 10/32] kvmclock: restore paused KVM clock

2020-07-30 Thread Steve Sistare
lid) return; <-- instead, return here kvm_update_clock() kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, ) <-- overwritten Signed-off-by: Steve Sistare --- hw/i386/kvm/clock.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/i386/kvm/clo

[PATCH V1 09/32] savevm: prevent cprsave if memory is volatile

2020-07-30 Thread Steve Sistare
cprsave and cprload require that guest ram be backed by an externally visible shared file. Check that in cprsave. Signed-off-by: Steve Sistare --- exec.c| 32 include/exec/memory.h | 2 ++ migration/savevm.c| 4 3 files changed, 38

[PATCH V1 31/32] vfio-pci: trace pci config

2020-07-30 Thread Steve Sistare
Add new trace points trace_vfio_pci_config and trace_vfio_msix_table to dump PCI config space and MSI data. Signed-off-by: Steve Sistare --- hw/vfio/pci.c| 99 hw/vfio/trace-events | 2 ++ 2 files changed, 101 insertions(+) diff

[PATCH V1 11/32] cpu: disable ticks when suspended

2020-07-30 Thread Steve Sistare
to suspended in qemu_system_suspend did not disable ticks. To fix, call cpu_disable_ticks from save_cpr_snapshot. Signed-off-by: Steve Sistare --- migration/savevm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index f101039..00f493b 100644

[PATCH V1 17/32] util: env var helpers

2020-07-30 Thread Steve Sistare
Add functions for saving fd's and ram extents in the environment via setenv, and for reading them back via getenv. Signed-off-by: Steve Sistare Signed-off-by: Mark Kanda --- MAINTAINERS | 7 +++ include/qemu/cutils.h | 1 + include/qemu/env.h| 31 util

[PATCH V1 05/32] savevm: QMP command for cprload

2020-07-30 Thread Steve Sistare
operations. If the VM was running at cprsave time, then VM execution resumes. Syntax: {'command':'cprload', 'data':{'file':'str'}} Signed-off-by: Steve Sistare Signed-off-by: Maran Wilson --- include/sysemu/sysemu.h | 2 ++ migration/savevm.c | 34 ++ monitor

[PATCH V1 21/32] exec, memory: exec(3) to restart

2020-07-30 Thread Steve Sistare
the (typically updated) qemu binary with the original argv. On qemu restart, ram_block_add() finds the env vars that describe preserved RAM segments and does not reallocate them. Signed-off-by: Steve Sistare --- exec.c| 36 ++-- include/exec/memory.h | 2

[PATCH V1 24/32] ui: save/restore vnc socket fds

2020-07-30 Thread Steve Sistare
From: Mark Kanda Iterate through the VNC displays and save/restore the socket fds. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- include/sysemu/sysemu.h | 2 + migration/savevm.c | 3 + ui/vnc.c| 153 +++- 3

[PATCH V1 26/32] monitor: save/restore QMP negotiation status

2020-07-30 Thread Steve Sistare
From: Mark Kanda Save and restore QMP compatibility negotiation status across cprsave and cprload. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- include/sysemu/sysemu.h | 1 + migration/savevm.c | 1 + monitor/qmp.c | 42

[PATCH V1 13/32] gdbstub: gdb support for suspended state

2020-07-30 Thread Steve Sistare
Modify the gdb server so a continue command appears to resume execution when in RUN_STATE_SUSPENDED. Do not print the next gdb prompt, but do not actually resume instruction fetch. While in this "fake" running mode, a ctrl-C returns the user to the gdb prompt. Signed-off-by: Ste

[PATCH V1 27/32] vhost: reset vhost devices upon cprsave

2020-07-30 Thread Steve Sistare
. To fix, reset the owner prior to exec. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hw/virtio/vhost.c | 12 include/sysemu/sysemu.h | 1 + migration/savevm.c | 1 + 3 files changed, 14 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index

[PATCH V1 00/32] Live Update

2020-07-30 Thread Steve Sistare
| VM status: running | Mark Kanda (5): char: qio_channel_socket_accept reuse fd char: save/restore chardev socket fds ui: save/restore vnc socket fds monitor: save/restore QMP negotiation status vhost: reset vhost devices upon cprsave Steve Sistare

[PATCH V1 06/32] savevm: HMP Command for cprload

2020-07-30 Thread Steve Sistare
Enable HMP access to the cprload QMP command. Usage: cprload Signed-off-bu: Maran Wilson Signed-off-by: Steve Sistare --- hmp-commands.hx | 13 + include/monitor/hmp.h | 1 + monitor/hmp-cmds.c| 8 3 files changed, 22 insertions(+) diff --git a/hmp

[PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart

2020-07-30 Thread Steve Sistare
memory. Subsequent patches complete its implementation. Signed-off-by: Steve Sistare --- hmp-commands.hx | 4 +++- include/migration/vmstate.h | 1 + migration/savevm.c | 4 +++- monitor/qmp-cmds.c | 2 +- qapi/migration.json | 1 + 5 files changed, 9

[PATCH V1 12/32] vl: pause option

2020-07-30 Thread Steve Sistare
-by: Steve Sistare --- qemu-options.hx | 9 + softmmu/vl.c| 15 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/qemu-options.hx b/qemu-options.hx index 708583b..8505cf2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3668,6 +3668,15 @@ SRST

[PATCH V1 15/32] vl: QEMU_START_FREEZE env var

2020-07-30 Thread Steve Sistare
. If QEMU_START_FREEZE is set, then set autostart=0, like the -S option. Signed-off-by: Steve Sistare --- softmmu/vl.c | 5 + 1 file changed, 5 insertions(+) diff --git a/softmmu/vl.c b/softmmu/vl.c index 951994f..7016e39 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4501,6 +4501,11 @@ void qemu_init(int

[PATCH V1 19/32] memory: ram_block_add cosmetic changes

2020-07-30 Thread Steve Sistare
Massage the code to simplify the later patch "exec, memory: exec(3) to restart". No functional change. Signed-off-by: Steve Sistare --- exec.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/exec.c b/exec.c index 02160e0..359e437 100644 --

[PATCH V1 20/32] vl: add helper to request re-exec

2020-07-30 Thread Steve Sistare
-by: Steve Sistare --- include/sysemu/sysemu.h | 1 + softmmu/vl.c| 30 ++ 2 files changed, 31 insertions(+) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 5360da5..4dfc4ca 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h

[PATCH V1 29/32] pci: export pci_update_mappings

2020-07-30 Thread Steve Sistare
Allow pci_update_mappings to be called from other modules. No change in functionality. Signed-off-by: Steve Sistare --- hw/pci/pci.c | 3 +-- include/hw/pci/pci.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index de0fae1..7343e00

[PATCH V1 02/32] savevm: VM handlers mode mask

2020-07-30 Thread Steve Sistare
by SAVEVM_FOREACH if its mask includes the savevm_state.mode. Unmodified handler declarations have a zero mask field, which implicitly enables the handler for all modes. No functional change for the VMS_MIGRATE and VMS_SNAPSHOT modes. Signed-off-by: Steve Sistare --- include/migration/register.h | 3

[PATCH V1 18/32] osdep: import MADV_DOEXEC

2020-07-30 Thread Steve Sistare
/ Signed-off-by: Steve Sistare --- include/qemu/osdep.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index bb28df1..7ce555a 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -390,6 +390,11 @@ void qemu_anon_ram_free(void *ptr, size_t

[PATCH V1 23/32] char: save/restore chardev socket fds

2020-07-30 Thread Steve Sistare
From: Mark Kanda Iterate through the character devices and save/restore the socket fds. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- chardev/char-socket.c | 35 +++ chardev/char.c | 14 ++ include/chardev/char.h | 5

[PATCH V1] gdbstub: suspended state support

2021-01-06 Thread Steve Sistare
Modify the gdb server so a continue command appears to resume execution when in RUN_STATE_SUSPENDED. Do not print the next gdb prompt, but do not actually resume instruction fetch. While in this "fake" running mode, a ctrl-C returns the user to the gdb prompt. Signed-off-by: Ste

[PATCH v3] vl: pause option

2021-01-06 Thread Steve Sistare
) signal SIGCONT Breakpoint 1, rcu_init () at util/rcu.c:380 Signed-off-by: Steve Sistare --- qemu-options.hx | 14 ++ softmmu/vl.c| 32 2 files changed, 46 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx

[PATCH V1] vfio-pci: improved tracing

2020-11-02 Thread Steve Sistare
x4000 ":3a:10.0 base BAR 3" Signed-off-by: Steve Sistare --- accel/kvm/kvm-all.c| 8 ++-- accel/kvm/trace-events | 3 ++- exec.c | 3 +++ hw/pci/msix.c | 1 + hw/pci/pci.c | 10 ++ hw/pci/trace-events| 5 +++-- hw/vfio/common

[PATCH V1] gdbstub: gdb support for suspended state

2020-11-02 Thread Steve Sistare
Modify the gdb server so a continue command appears to resume execution when in RUN_STATE_SUSPENDED. Do not print the next gdb prompt, but do not actually resume instruction fetch. While in this "fake" running mode, a ctrl-C returns the user to the gdb prompt. Signed-off-by: Ste

[PATCH V2] vl: pause option

2020-11-02 Thread Steve Sistare
to Daniel P. Berrange for suggesting SIGSTOP. Signed-off-by: Steve Sistare --- qemu-options.hx | 14 ++ softmmu/vl.c| 23 +++ 2 files changed, 37 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 708583b..42edd70 100644 --- a/qemu-options.hx

[PATCH V2 06/22] vl: add helper to request re-exec

2021-01-05 Thread Steve Sistare
-by: Steve Sistare --- include/sysemu/sysemu.h | 1 + softmmu/vl.c| 30 ++ 2 files changed, 31 insertions(+) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 408eb56..2ab9f95 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h

[PATCH V2 17/22] chardev: socket accept subroutine

2021-01-05 Thread Steve Sistare
Factor out the post-accept actions into a subroutine that can be used in a subsequent patch. No functional change. Signed-off-by: Steve Sistare --- io/channel-socket.c | 43 --- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/io/channel

[PATCH V2 22/22] simplify savevm

2021-01-05 Thread Steve Sistare
Use qf_file_open to simplify a few functions in savevm.c. No functional change. Signed-off-by: Steve Sistare --- migration/savevm.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index a843d20..994ad1a 100644

[PATCH V2 21/22] cpr: maintainers

2021-01-05 Thread Steve Sistare
Add the maintainers for cpr related files. Signed-off-by: Steve Sistare --- MAINTAINERS | 11 +++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0886eb3..93044e7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2631,6 +2631,17 @@ F: net/colo* F: net/filter

[PATCH V2 03/22] oslib: qemu_clr_cloexec

2021-01-05 Thread Steve Sistare
Define qemu_clr_cloexec, analogous to qemu_set_cloexec. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Steve Sistare --- include/qemu/osdep.h | 1 + util/oslib-posix.c | 9 + util/oslib-win32.c | 4 3 files changed, 14 insertions(+) diff --git a/include/qemu/osdep.h b

[PATCH V2 04/22] util: env var helpers

2021-01-05 Thread Steve Sistare
Add functions for saving fd's and other values in the environment via setenv, and for reading them back via getenv. Signed-off-by: Steve Sistare Signed-off-by: Mark Kanda --- include/qemu/env.h | 27 util/Makefile.objs | 2 +- util/env.c | 119

[PATCH V2 11/22] vfio-pci: refactor for cpr

2021-01-05 Thread Steve Sistare
Export vfio_address_spaces and vfio_listener_skipped_section. Add optional eventfd arg to vfio_add_kvm_msi_virq. Refactor vector use into a helper vfio_vector_init. All for use by cpr in a subsequent patch. No functional change. Signed-off-by: Steve Sistare --- hw/vfio/common.c

[PATCH V2 16/22] chardev: cpr for pty

2021-01-05 Thread Steve Sistare
Save and restore pty descriptors across cprsave and cprload. Signed-off-by: Steve Sistare --- chardev/char-pty.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/chardev/char-pty.c b/chardev/char-pty.c index 1cc501a..0916f9e 100644 --- a/chardev/char-pty.c

[PATCH V2 13/22] vhost: reset vhost devices upon cprsave

2021-01-05 Thread Steve Sistare
prior to exec. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hw/virtio/vhost.c | 11 +++ include/hw/virtio/vhost.h | 1 + migration/cpr.c | 1 + 3 files changed, 13 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1a1384e..42aa44c

[PATCH V2 14/22] chardev: cpr framework

2021-01-05 Thread Steve Sistare
Add QEMU_CHAR_FEATURE_CPR for devices that support cpr. Add the chardev close_on_cpr option for devices that can be closed on cpr and reopened after exec. cpr is allowed only if either QEMU_CHAR_FEATURE_CPR or close_on_cpr is set for all chardevs in the configuration. Signed-off-by: Steve Sistare

[PATCH V2 07/22] cpr

2021-01-05 Thread Steve Sistare
. Signed-off-by: Steve Sistare --- exec.c | 6 +- include/migration/cpr.h | 17 + include/sysemu/sysemu.h | 1 + migration/Makefile.objs | 2 +- migration/cpr.c | 187 migration/savevm.h | 2 + softmmu/vl.c

[PATCH V2 15/22] chardev: cpr for simple devices

2021-01-05 Thread Steve Sistare
Set QEMU_CHAR_FEATURE_CPR for devices that trivially support cpr. char-stdio is slightly less trivial. Allow the gdb server by closing it on exec. Signed-off-by: Steve Sistare --- chardev/char-mux.c | 1 + chardev/char-null.c| 1 + chardev/char-serial.c | 1 + chardev/char-stdio.c

[PATCH V2 20/22] cpr: only-cpr-capable option

2021-01-05 Thread Steve Sistare
Add the only-cpr-capable option, which causes qemu to exit with an error if any devices that are not capable of cpr are added. This guarantees that a cprsave operation will not fail with an unsupported device error. Signed-off-by: Steve Sistare --- chardev/char-socket.c | 1 + exec.c

[PATCH V2 00/22] Live Update

2021-01-05 Thread Steve Sistare
refactor all patches into a shorter and easier to review series Steve Sistare (17): as_flat_walk qemu_ram_volatile oslib: qemu_clr_cloexec util: env var helpers vl: memfd-alloc option vl: add helper to request re-exec cpr pci: export functions for cpr vfio-pci: refactor for cpr vfi

[PATCH V2 09/22] cpr: HMP interfaces

2021-01-05 Thread Steve Sistare
e. Arguments: none Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hmp-commands.hx | 44 include/monitor/hmp.h | 3 +++ monitor/hmp-cmds.c| 48 3 files changed, 95 insertions(

[PATCH V2 12/22] vfio-pci: cpr

2021-01-05 Thread Steve Sistare
VFIO_DMA_MAP_FLAG_RESUME to inform the kernel of the new VA's. Lastly, it starts the VM and suppresses vfio device reset. Signed-off-by: Steve Sistare --- hw/pci/pci.c | 4 + hw/vfio/Makefile.objs | 2 +- hw/vfio/common.c | 59 +- hw/vfio/cpr.c

[PATCH V2 19/22] monitor: cpr support

2021-01-05 Thread Steve Sistare
-by: Mark Kanda Signed-off-by: Steve Sistare --- include/monitor/monitor.h | 2 ++ migration/cpr.c | 2 ++ monitor/monitor.c | 5 + monitor/qmp.c | 43 +++ 4 files changed, 52 insertions(+) diff --git a/include/monitor

[PATCH V2 18/22] chardev: cpr for sockets

2021-01-05 Thread Steve Sistare
Signed-off-by: Steve Sistare --- chardev/char-socket.c | 30 ++ include/io/channel-socket.h | 12 io/channel-socket.c | 9 + stubs/Makefile.objs | 1 + stubs/cpr.c | 3 +++ 5 files changed, 55 insertions

[PATCH V2 10/22] pci: export functions for cpr

2021-01-05 Thread Steve Sistare
Export msix_is_pending and msix_init_vector_notifiers for use by cpr. No functional change. Signed-off-by: Steve Sistare --- hw/pci/msix.c | 20 ++-- hw/pci/pci.c | 3 +-- include/hw/pci/msix.h | 5 + include/hw/pci/pci.h | 1 + 4 files changed, 21

[PATCH V2 05/22] vl: memfd-alloc option

2021-01-05 Thread Steve Sistare
Allocate anonymous memory using memfd_create if the memfd-alloc option is set. Signed-off-by: Steve Sistare --- exec.c | 38 ++ include/sysemu/sysemu.h | 1 + qemu-options.hx | 11 +++ softmmu/vl.c| 4 trace

[PATCH V2 08/22] cpr: QMP interfaces

2021-01-05 Thread Steve Sistare
. Syntax: { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } } { 'command': 'cprinfo', 'returns': 'CprInfo' } Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- monitor/qmp-cmds.c| 31 +++ qapi/Makefile.objs| 3 ++- qapi/cpr.json | 68

[PATCH V2 02/22] qemu_ram_volatile

2021-01-05 Thread Steve Sistare
Add a function that returns true if any ram_list block represents volatile memory. Signed-off-by: Steve Sistare --- exec.c| 30 ++ include/exec/memory.h | 8 slirp | 2 +- 3 files changed, 39 insertions(+), 1 deletion

[PATCH V2 01/22] as_flat_walk

2021-01-05 Thread Steve Sistare
Add an iterator over the sections of a flattened address space. Signed-off-by: Steve Sistare --- include/exec/memory.h | 3 +++ softmmu/memory.c | 17 + 2 files changed, 20 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 307e527..8dba065

[PATCH V3 00/22] Live Update

2021-05-07 Thread Steve Sistare
instead of defining new ones - close monitor socket during cpr - support memory-backend-memfd - fix a few unreported bugs Steve Sistare (18): as_flat_walk qemu_ram_volatile oslib: qemu_clr_cloexec util: env var helpers machine: memfd-alloc option vl: add helper to request re-exec

[PATCH V3 05/22] machine: memfd-alloc option

2021-05-07 Thread Steve Sistare
Allocate anonymous memory using memfd_create if the memfd-alloc machine option is set. Signed-off-by: Steve Sistare --- hw/core/machine.c | 19 +++ include/hw/boards.h | 1 + qemu-options.hx | 5 + softmmu/physmem.c | 41

[PATCH V3 04/22] util: env var helpers

2021-05-07 Thread Steve Sistare
Add functions for saving fd's and other values in the environment via setenv, and for reading them back via getenv. Signed-off-by: Steve Sistare --- include/qemu/env.h | 23 + util/env.c | 99 ++ util/meson.build | 1

[PATCH V3 06/22] vl: add helper to request re-exec

2021-05-07 Thread Steve Sistare
-by: Steve Sistare --- include/sysemu/runstate.h | 1 + include/sysemu/sysemu.h | 1 + softmmu/globals.c | 1 + softmmu/runstate.c| 28 softmmu/vl.c | 1 + 5 files changed, 32 insertions(+) diff --git a/include/sysemu/runstate.h b/include

[PATCH V3 20/22] cpr: only-cpr-capable option

2021-05-07 Thread Steve Sistare
Add the only-cpr-capable option, which causes qemu to exit with an error if any devices that are not capable of cpr are added. This guarantees that a cprsave operation will not fail with an unsupported device error. Signed-off-by: Steve Sistare --- chardev/char-socket.c | 4 hw/vfio

[PATCH V3 21/22] cpr: maintainers

2021-05-07 Thread Steve Sistare
Add the maintainers for cpr related files. Signed-off-by: Steve Sistare --- MAINTAINERS | 11 +++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 36055f1..b69bbf5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2843,6 +2843,17 @@ F: net/colo* F: net/filter

[PATCH V3 03/22] oslib: qemu_clr_cloexec

2021-05-07 Thread Steve Sistare
Define qemu_clr_cloexec, analogous to qemu_set_cloexec. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Steve Sistare --- include/qemu/osdep.h | 1 + util/oslib-posix.c | 9 + util/oslib-win32.c | 4 3 files changed, 14 insertions(+) diff --git a/include/qemu/osdep.h b

[PATCH V3 11/22] vfio-pci: refactor for cpr

2021-05-07 Thread Steve Sistare
Export vfio_address_spaces and vfio_listener_skipped_section. Add optional eventfd arg to vfio_add_kvm_msi_virq. Refactor vector use into a helper vfio_vector_init. All for use by cpr in a subsequent patch. No functional change. Signed-off-by: Steve Sistare --- hw/vfio/common.c

[PATCH V3 15/22] hostmem-memfd: cpr support

2021-05-07 Thread Steve Sistare
Preserve memory-backend-memfd memory objects during cpr. Signed-off-by: Steve Sistare --- backends/hostmem-memfd.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 69b0ae3..3503c89 100644

[PATCH V3 02/22] qemu_ram_volatile

2021-05-07 Thread Steve Sistare
Add a function that returns true if any ram_list block represents volatile memory. Signed-off-by: Steve Sistare --- include/exec/memory.h | 8 softmmu/memory.c | 30 ++ 2 files changed, 38 insertions(+) diff --git a/include/exec/memory.h b/include

[PATCH V3 16/22] chardev: cpr framework

2021-05-07 Thread Steve Sistare
Add QEMU_CHAR_FEATURE_CPR for devices that support cpr. Add the chardev close_on_cpr option for devices that can be closed on cpr and reopened after exec. cpr is allowed only if either QEMU_CHAR_FEATURE_CPR or close_on_cpr is set for all chardevs in the configuration. Signed-off-by: Steve Sistare

[PATCH V3 13/22] vfio-pci: cpr part 2

2021-05-07 Thread Steve Sistare
Finish cpr for vfio-pci by preserving eventfd's and vector state. Signed-off-by: Steve Sistare --- hw/vfio/pci.c | 110 -- 1 file changed, 108 insertions(+), 2 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index f7ac9f03

[PATCH V3 12/22] vfio-pci: cpr part 1

2021-05-07 Thread Steve Sistare
VFIO_DMA_MAP_FLAG_VADDR to inform the kernel of the new VA's. Lastly, it starts the VM and suppresses vfio device reset. This functionality is delivered by 2 patches for clarity. Part 2 adds eventfd and vector support. Signed-off-by: Steve Sistare --- hw/pci/msi.c | 4 ++ hw/pci/pci.c

[PATCH V3 07/22] cpr

2021-05-07 Thread Steve Sistare
patch. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 17 + include/sysemu/runstate.h | 1 + migration/cpr.c | 188 ++ migration/meson.build | 1 + migration/savevm.h| 2 + softmmu/physmem.c | 6

[PATCH V3 08/22] cpr: QMP interfaces

2021-05-07 Thread Steve Sistare
. Syntax: { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } } { 'command': 'cprinfo', 'returns': 'CprInfo' } Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- monitor/qmp-cmds.c| 31 + qapi/cpr.json | 76

[PATCH V3 01/22] as_flat_walk

2021-05-07 Thread Steve Sistare
Add an iterator over the sections of a flattened address space. Signed-off-by: Steve Sistare --- include/exec/memory.h | 17 + softmmu/memory.c | 18 ++ 2 files changed, 35 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index

[PATCH V3 22/22] simplify savevm

2021-05-07 Thread Steve Sistare
Use qf_file_open to simplify a few functions in savevm.c. No functional change. Signed-off-by: Steve Sistare --- migration/savevm.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 52e2d72..d02bce2 100644

[PATCH V3 09/22] cpr: HMP interfaces

2021-05-07 Thread Steve Sistare
e. Arguments: none Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hmp-commands.hx | 44 include/monitor/hmp.h | 3 +++ monitor/hmp-cmds.c| 48 3 files changed, 95 insertions(

[PATCH V3 19/22] chardev: cpr for sockets

2021-05-07 Thread Steve Sistare
Save accepted socket fds in the environment before cprsave, and look for fds in the environment after cprload. Reject cprsave if a socket enables the TLS or websocket option. Allow a monitor socket by closing it on exec. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- chardev/char

[PATCH V3 14/22] vhost: reset vhost devices upon cprsave

2021-05-07 Thread Steve Sistare
prior to exec. Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hw/virtio/vhost.c | 11 +++ include/hw/virtio/vhost.h | 1 + migration/cpr.c | 1 + 3 files changed, 13 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index e2163a0..8c0c9c3

[PATCH V3 10/22] pci: export functions for cpr

2021-05-07 Thread Steve Sistare
Export msix_is_pending and msix_init_vector_notifiers for use by cpr. No functional change. Signed-off-by: Steve Sistare --- hw/pci/msix.c | 20 ++-- hw/pci/pci.c | 3 +-- include/hw/pci/msix.h | 5 + include/hw/pci/pci.h | 1 + 4 files changed, 21

[PATCH V3 18/22] chardev: cpr for pty

2021-05-07 Thread Steve Sistare
Save and restore pty descriptors across cprsave and cprload. Signed-off-by: Steve Sistare --- chardev/char-pty.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/chardev/char-pty.c b/chardev/char-pty.c index a2d1e7c..c91151d 100644 --- a/chardev/char-pty.c

[PATCH V3 17/22] chardev: cpr for simple devices

2021-05-07 Thread Steve Sistare
Set QEMU_CHAR_FEATURE_CPR for devices that trivially support cpr. char-stdio is slightly less trivial. Allow the gdb server by closing it on exec. Signed-off-by: Steve Sistare --- chardev/char-mux.c | 1 + chardev/char-null.c| 1 + chardev/char-serial.c | 1 + chardev/char-stdio.c

[PATCH V5 22/25] chardev: cpr for pty

2021-07-07 Thread Steve Sistare
Save and restore pty descriptors across cprsave and cprload. Signed-off-by: Steve Sistare --- chardev/char-pty.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/chardev/char-pty.c b/chardev/char-pty.c index a2d1e7c..c91151d 100644 --- a/chardev/char-pty.c

[PATCH V5 16/25] vfio-pci: cpr part 1

2021-07-07 Thread Steve Sistare
VFIO_DMA_MAP_FLAG_VADDR to inform the kernel of the new VA's. Lastly, it starts the VM and suppresses vfio device reset. This functionality is delivered by 2 patches for clarity. Part 2 adds eventfd and vector support. Signed-off-by: Steve Sistare --- MAINTAINERS | 1 + hw

[PATCH V5 00/25] Live Update

2021-07-07 Thread Steve Sistare
: export functions for cpr vfio-pci: refactor for cpr vfio-pci: cpr part 1 vfio-pci: cpr part 2 hostmem-memfd: cpr support chardev: cpr framework chardev: cpr for simple devices chardev: cpr for pty cpr: only-cpr-capable option simplify savevm Mark Kanda, Steve Sistare (4): cpr: QMP

[PATCH V5 15/25] vfio-pci: refactor for cpr

2021-07-07 Thread Steve Sistare
Export vfio_address_spaces and vfio_listener_skipped_section. Add optional eventfd arg to vfio_add_kvm_msi_virq. Refactor vector use into a helper vfio_vector_init. All for use by cpr in a subsequent patch. No functional change. Signed-off-by: Steve Sistare --- hw/vfio/common.c

[PATCH V5 12/25] cpr: QMP interfaces for restart

2021-07-07 Thread Steve Sistare
cprexec calls cprexec(). Syntax: { 'command': 'cprexec', 'data': { 'argv': [ 'str' ] } } Add the restart mode: { 'enum': 'CprMode', 'data': [ 'reboot', 'restart' ] } Signed-off-by: Steve Sistare --- monitor/qmp-cmds.c | 5 + qapi/cpr.json | 16 +++- 2 files changed

[PATCH V5 11/25] cpr: restart mode

2021-07-07 Thread Steve Sistare
with new virtual addresses in the qemu process. The restart mode supports vfio devices in a subsequent patch. Signed-off-by: Steve Sistare --- migration/cpr.c | 21 + softmmu/physmem.c | 6 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/migration

[PATCH V5 24/25] cpr: only-cpr-capable option

2021-07-07 Thread Steve Sistare
Add the only-cpr-capable option, which causes qemu to exit with an error if any devices that are not capable of cpr are added. This guarantees that a cprexec operation will not fail with an unsupported device error. Signed-off-by: Steve Sistare --- MAINTAINERS | 1 + chardev/char

[PATCH V5 04/25] cpr: HMP interfaces for reboot

2021-07-07 Thread Steve Sistare
ents: none Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hmp-commands.hx | 44 include/monitor/hmp.h | 3 +++ monitor/hmp-cmds.c| 48 3 files changed, 95 insertions(+) diff -

[PATCH V5 17/25] vfio-pci: cpr part 2

2021-07-07 Thread Steve Sistare
Finish cpr for vfio-pci by preserving eventfd's and vector state. Signed-off-by: Steve Sistare --- hw/vfio/pci.c | 118 +- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0f5c542..07bd360

[PATCH V5 02/25] cpr: reboot mode

2021-07-07 Thread Steve Sistare
execution resumes. If the VM was suspended at cprsave time, then the caller must issue a system_wakeup command to resume. Signed-off-by: Steve Sistare --- MAINTAINERS | 7 +++ include/migration/cpr.h | 17 ++ include/sysemu/runstate.h | 1 + migration/cpr.c | 149

[PATCH V5 14/25] pci: export functions for cpr

2021-07-07 Thread Steve Sistare
Export msix_is_pending, msix_init_vector_notifiers, and pci_update_mappings for use by cpr. No functional change. Signed-off-by: Steve Sistare --- hw/pci/msix.c | 20 ++-- hw/pci/pci.c | 3 +-- include/hw/pci/msix.h | 5 + include/hw/pci/pci.h | 1 + 4

[PATCH V5 05/25] as_flat_walk

2021-07-07 Thread Steve Sistare
Add an iterator over the sections of a flattened address space. Signed-off-by: Steve Sistare --- include/exec/memory.h | 17 + softmmu/memory.c | 18 ++ 2 files changed, 35 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index

[PATCH V5 03/25] cpr: QMP interfaces for reboot

2021-07-07 Thread Steve Sistare
: { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } } { 'command': 'cprinfo', 'returns': 'CprInfo' } Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- MAINTAINERS | 1 + monitor/qmp-cmds.c| 31 + qapi/cpr.json | 74

[PATCH V5 13/25] cpr: HMP interfaces for restart

2021-07-07 Thread Steve Sistare
cprsave mode may be "restart" cprexec Call cprexec(). Arguments: command : command line to execute, with space-separated arguments Signed-off-by: Steve Sistare --- hmp-commands.hx | 20 +++- include/monitor/hmp.h | 1 + monitor/hmp-cmds

[PATCH V5 10/25] util: env var helpers

2021-07-07 Thread Steve Sistare
Add functions for saving fd's and other values in the environment via setenv, and for reading them back via getenv. Signed-off-by: Steve Sistare --- MAINTAINERS| 2 ++ include/qemu/env.h | 23 + util/env.c | 95

[PATCH V5 21/25] chardev: cpr for simple devices

2021-07-07 Thread Steve Sistare
Set QEMU_CHAR_FEATURE_CPR for devices that trivially support cpr. char-stdio is slightly less trivial. Allow the gdb server by closing it on exec. Signed-off-by: Steve Sistare --- chardev/char-mux.c | 1 + chardev/char-null.c| 1 + chardev/char-serial.c | 1 + chardev/char-stdio.c

  1   2   3   4   5   6   >