qemu-patch-raspberry4/hw
David Gibson 8904e5a750 spapr: Adjust default VSMT value for better migration compatibility
fa98fbfc "PC: KVM: Support machine option to set VSMT mode" introduced the
"vsmt" parameter for the pseries machine type, which controls the spacing
of the vcpu ids of thread 0 for each virtual core.  This was done to bring
some consistency and stability to how that was done, while still allowing
backwards compatibility for migration and otherwise.

The default value we used for vsmt was set to the max of the host's
advertised default number of threads and the number of vthreads per vcore
in the guest.  This was done to continue running without extra parameters
on older KVM versions which don't allow the VSMT value to be changed.

Unfortunately, even that smaller than before leakage of host configuration
into guest visible configuration still breaks things.  Specifically a guest
with 4 (or less) vthread/vcore will get a different vsmt value when
running on a POWER8 (vsmt==8) and POWER9 (vsmt==4) host.  That means the
vcpu ids don't line up so you can't migrate between them, though you should
be able to.

Long term we really want to make vsmt == smp_threads for sufficiently
new machine types.  However, that means that qemu will then require a
sufficiently recent KVM (one which supports changing VSMT) - that's still
not widely enough deployed to be really comfortable to do.

In the meantime we need some default that will work as often as
possible.  This patch changes that default to 8 in all circumstances.
This does change guest visible behaviour (including for existing
machine versions) for many cases - just not the most common/important
case.

Following is case by case justification for why this is still the least
worst option.  Note that any of the old behaviours can still be duplicated
after this patch, it's just that it requires manual intervention by
setting the vsmt property on the command line.

KVM HV on POWER8 host:
   This is the overwhelmingly common case in production setups, and is
   unchanged by design.  POWER8 hosts will advertise a default VSMT mode
   of 8, and > 8 vthreads/vcore isn't permitted

KVM HV on POWER7 host:
   Will break, but POWER7s allowing KVM were never released to the public.

KVM HV on POWER9 host:
   Not yet released to the public, breaking this now will reduce other
   breakage later.

KVM HV on PowerPC 970:
   Will theoretically break it, but it was barely supported to begin with
   and already required various user visible hacks to work.  Also so old
   that I just don't care.

TCG:
   This is the nastiest one; it means migration of TCG guests (without
   manual vsmt setting) will break.  Since TCG is rarely used in production
   I think this is worth it for the other benefits.  It does also remove
   one more barrier to TCG<->KVM migration which could be interesting for
   debugging applications.

KVM PR:
   As with TCG, this will break migration of existing configurations,
   without adding extra manual vsmt options.  As with TCG, it is rare in
   production so I think the benefits outweigh breakages.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
2018-01-17 09:35:24 +11:00
..
9pfs 9pfs: deprecate handle backend 2018-01-08 11:18:23 +01:00
acpi Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
adc maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
alpha Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
arm hw/arm/virt: Add virt-2.12 machine type 2018-01-16 13:28:10 +00:00
audio misc: remove old i386 dependency 2017-12-18 17:07:02 +03:00
block maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
bt bt: stop the sdp memory allocation craziness 2017-08-01 17:27:33 +02:00
char maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
core Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
cpu hw: use "qemu/osdep.h" as first #include in source files 2017-12-18 17:07:02 +03:00
cris cris: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
display * QemuMutex tracing improvements (Alex) 2018-01-16 15:45:15 +00:00
dma maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
gpio hw/gpio/omap_gpio.c: Don't use old_mmio 2017-09-21 16:34:27 +01:00
i2c * QemuMutex tracing improvements (Alex) 2018-01-16 15:45:15 +00:00
i386 * QemuMutex tracing improvements (Alex) 2018-01-16 15:45:15 +00:00
ide hw/ide: Emulate SiI3112 SATA controller 2018-01-10 12:53:00 +11:00
input Split adb.c into adb.c, adb-mouse.c and adb-kbd.c 2017-12-21 20:11:28 +01:00
intc hw/intc/armv7m: Support byte and halfword accesses to CFSR 2018-01-16 13:28:09 +00:00
ipack pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
ipmi hw/ipmi: remove old i386 dependency 2017-12-18 17:07:02 +03:00
isa Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
lm32 lm32: lm32_boards: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
m68k m68k: mcf5208: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
mem spapr: replace numa_get_node() with lookup in pc-dimm list 2017-12-15 09:49:24 +11:00
microblaze hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
mips Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
misc maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
moxie hw/moxie/moxiesim: Add support for loading a BIOS on moxiesim 2017-12-21 09:30:31 +01:00
net * QemuMutex tracing improvements (Alex) 2018-01-16 15:45:15 +00:00
nios2 nios2: remove duplicated includes (in code commented out) 2017-12-18 17:07:02 +03:00
nvram mips: fix potential fopen(NULL,...) 2018-01-16 14:54:50 +01:00
openrisc openrisc: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
pci pci: Eliminate pci_find_primary_bus() 2017-12-05 19:13:45 +02:00
pci-bridge Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
pci-host Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
pcmcia hw: Clean up includes 2016-01-29 15:07:25 +00:00
ppc spapr: Adjust default VSMT value for better migration compatibility 2018-01-17 09:35:24 +11:00
s390x Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
scsi * QemuMutex tracing improvements (Alex) 2018-01-16 15:45:15 +00:00
sd sdhci: add a 'dma' property to the sysbus devices 2018-01-16 13:28:21 +00:00
sh4 pci: Rename root bus initialization functions for clarity 2017-12-05 19:13:45 +02:00
smbios Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
sparc sun4m: remove include/hw/sparc/sun4m.h and all references to it 2018-01-09 21:48:20 +00:00
sparc64 sun4u_iommu: add trace event for IOMMU translations 2018-01-09 21:48:20 +00:00
ssi maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
timer maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
tpm maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
tricore tricore: use generic cpu_model parsing 2017-10-27 16:04:27 +02:00
unicore32 hw/unicore32: restrict hw addr defines to source file 2017-12-18 17:07:02 +03:00
usb Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
vfio Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
virtio Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
watchdog misc: drop old i386 dependency 2017-12-18 17:07:03 +03:00
xen Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
xenpv xenfb: remove xen_init_display "temporary" hack 2017-07-07 11:10:03 -07:00
xtensa xtensa: lx60/lx200/ml605/kc705: use generic cpu_model parsing 2017-10-27 16:04:27 +02:00
Makefile.objs 9pfs: fix dependencies 2017-08-30 18:23:25 +02:00