qemu-e2k/hw
David Hildenbrand 9bc9d3d1ae s390x/tod: Properly stop the KVM TOD while the guest is not running
Just like on other architectures, we should stop the clock while the guest
is not running. This is already properly done for TCG. Right now, doing an
offline migration (stop, migrate, cont) can easily trigger stalls in the
guest.

Even doing a
    (hmp) stop
    ... wait 2 minutes ...
    (hmp) cont
will already trigger stalls.

So whenever the guest stops, backup the KVM TOD. When continuing to run
the guest, restore the KVM TOD.

One special case is starting a simple VM: Reading the TOD from KVM to
stop it right away until the guest is actually started means that the
time of any simple VM will already differ to the host time. We can
simply leave the TOD running and the guest won't be able to recognize
it.

For migration, we actually want to keep the TOD stopped until really
starting the guest. To be able to catch most errors, we should however
try to set the TOD in addition to simply storing it. So we can still
catch basic migration problems.

If anything goes wrong while backing up/restoring the TOD, we have to
ignore it (but print a warning). This is then basically a fallback to
old behavior (TOD remains running).

I tested this very basically with an initrd:
    1. Start a simple VM. Observed that the TOD is kept running. Old
       behavior.
    2. Ordinary live migration. Observed that the TOD is temporarily
       stopped on the destination when setting the new value and
       correctly started when finally starting the guest.
    3. Offline live migration. (stop, migrate, cont). Observed that the
       TOD will be stopped on the source with the "stop" command. On the
       destination, the TOD is temporarily stopped when setting the new
       value and correctly started when finally starting the guest via
       "cont".
    4. Simple stop/cont correctly stops/starts the TOD. (multiple stops
       or conts in a row have no effect, so works as expected)

In the future, we might want to send the guest a special kind of time sync
interrupt under some conditions, so it can synchronize its tod to the
host tod. This is interesting for migration scenarios but also when we
get time sync interrupts ourselves. This however will most probably have
to be handled in KVM (e.g. when the tods differ too much) and is not
desired e.g. when debugging the guest (single stepping should not
result in permanent time syncs). I consider something like that an add-on
on top of this basic "don't break the guest" handling.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181130094957.4121-1-david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-12-12 10:39:28 +01:00
..
9pfs 9p: fix QEMU crash when renaming files 2018-11-23 13:28:03 +01:00
acpi
adc
alpha
arm virt: Eliminate separate instance_init functions 2018-12-11 15:45:22 -02:00
audio audio/hda: fix guest triggerable assert 2018-11-27 07:47:57 +01:00
block nvme: Fix spurious interrupts 2018-11-27 12:59:00 +01:00
bt
char hw/arm/stm32f205: Fix the UART and Timer region size 2018-11-19 15:29:08 +00:00
core qom: remove unimplemented class_finalize 2018-12-11 15:45:23 -02:00
cpu
cris
display vmstate: constify VMStateField 2018-11-27 15:35:15 +01:00
dma
gpio
hppa
hyperv hw/hyperv: fix NULL dereference with pure-kvm SynIC 2018-11-26 14:14:38 -02:00
i2c i2c: pm_smbus: check smb_index before block transfer write 2018-12-06 15:51:57 +00:00
i386 pc: Use default_machine_opts to set suppress_vmdesc 2018-12-11 15:45:22 -02:00
ide
input ps2kbd: default to scan enabled after reset 2018-11-27 07:47:50 +01:00
intc vmstate: constify VMStateField 2018-11-27 15:35:15 +01:00
ipack
ipmi
isa
lm32
m68k
mem memory-device: avoid overflows on very huge devices 2018-12-11 15:45:22 -02:00
microblaze
mips
misc qom: make user_creatable_complete() specific to UserCreatable 2018-12-11 15:45:22 -02:00
moxie
net net: cadence_gem: Remove incorrect assert() 2018-11-26 13:41:42 +00:00
nios2
nvram vmstate: constify VMStateField 2018-11-27 15:35:15 +01:00
openrisc
pci vmstate: constify VMStateField 2018-11-27 15:35:15 +01:00
pci-bridge
pci-host
pcmcia
ppc spapr: Delete instance_options functions 2018-12-11 15:45:22 -02:00
rdma
riscv hw/riscv/virt: Free the test device tree node name 2018-11-13 15:12:13 -08:00
s390x s390x/tod: Properly stop the KVM TOD while the guest is not running 2018-12-12 10:39:28 +01:00
scsi vmstate: constify VMStateField 2018-11-27 15:35:15 +01:00
sd
sh4
smbios
sparc
sparc64
ssi
timer hw/timer/sun4v-rtc: Fix tracing at sun4v_rtc_write() 2018-12-11 15:45:22 -02:00
tpm tpm: use loop iterator to set sts data field 2018-11-14 15:47:24 -05:00
tricore
unicore32
usb usb: mtp fixes. 2018-12-03 19:57:59 +00:00
vfio
virtio qom: make user_creatable_complete() specific to UserCreatable 2018-12-11 15:45:22 -02:00
watchdog
xen
xenpv
xtensa target/xtensa: xtfpga: provide default memory sizes 2018-11-21 10:53:21 -08:00
Makefile.objs