[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 015/113] spapr: register dummy ICPs later
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 015/113] spapr: register dummy ICPs later |
Date: |
Mon, 18 Jun 2018 20:41:41 -0500 |
From: Greg Kurz <address@hidden>
Some older machine types create more ICPs than needed. We hence
need to register up to xics_max_server_number() dummy ICPs to
accomodate the migration of these machine types.
Recent VSMT rework changed xics_max_server_number() to return
DIV_ROUND_UP(max_cpus * spapr->vsmt, smp_threads)
instead of
DIV_ROUND_UP(max_cpus * kvmppc_smt_threads(), smp_threads);
The change is okay but it requires spapr->vsmt to be set, which
isn't the case with the current code. This causes the formula to
return zero and we don't create dummy ICPs. This breaks migration
of older guests as reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1549087
The dummy ICP workaround doesn't really have a dependency on XICS
itself. But it does depend on proper VCPU id numbering and it must
be applied before creating vCPUs (ie, creating real ICPs). So this
patch moves the workaround to spapr_init_cpus(), which already
assumes VSMT to be set.
Fixes: 72194664c8a1 ("spapr: use spapr->vsmt to compute VCPU ids")
Reported-by: Lukas Doktor <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
(cherry picked from commit 72fdd4de8e5fdc1a6078e000835fb54592a3fe97)
Signed-off-by: Greg Kurz <address@hidden>
---
hw/ppc/spapr.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d53123c127..1a2dd1f597 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -184,7 +184,6 @@ static int xics_max_server_number(sPAPRMachineState *spapr)
static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
- sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
if (kvm_enabled()) {
if (machine_kernel_irqchip_allowed(machine) &&
@@ -206,17 +205,6 @@ static void xics_system_init(MachineState *machine, int
nr_irqs, Error **errp)
return;
}
}
-
- if (smc->pre_2_10_has_unused_icps) {
- int i;
-
- for (i = 0; i < xics_max_server_number(spapr); i++) {
- /* Dummy entries get deregistered when real ICPState objects
- * are registered during CPU core hotplug.
- */
- pre_2_10_vmstate_register_dummy_icp(i);
- }
- }
}
static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,
@@ -2210,6 +2198,7 @@ static void spapr_init_cpus(sPAPRMachineState *spapr)
{
MachineState *machine = MACHINE(spapr);
MachineClass *mc = MACHINE_GET_CLASS(machine);
+ sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
const char *type = spapr_get_cpu_core_type(machine->cpu_type);
const CPUArchIdList *possible_cpus;
int boot_cores_nr = smp_cpus / smp_threads;
@@ -2240,6 +2229,17 @@ static void spapr_init_cpus(sPAPRMachineState *spapr)
boot_cores_nr = possible_cpus->len;
}
+ if (smc->pre_2_10_has_unused_icps) {
+ int i;
+
+ for (i = 0; i < xics_max_server_number(spapr); i++) {
+ /* Dummy entries get deregistered when real ICPState objects
+ * are registered during CPU core hotplug.
+ */
+ pre_2_10_vmstate_register_dummy_icp(i);
+ }
+ }
+
for (i = 0; i < possible_cpus->len; i++) {
int core_id = i * smp_threads;
--
2.11.0
- [Qemu-devel] [PATCH 109/113] tap: set vhostfd passed from qemu cli to non-blocking, (continued)
- [Qemu-devel] [PATCH 109/113] tap: set vhostfd passed from qemu cli to non-blocking, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 110/113] vhost-user: delete net client if necessary, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 010/113] spapr: move VCPU calculation to core machine code, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 111/113] qemu-img: Fix assert when mapping unaligned raw file, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 112/113] iotests: Add test 221 to catch qemu-img map regression, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 113/113] arm_gicv3_kvm: kvm_dist_get/put_priority: skip the registers banked by GICR_IPRIORITYR, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 011/113] target/ppc: Clarify compat mode max_threads value, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 012/113] spapr: rename spapr_vcpu_id() to spapr_get_vcpu_id(), Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 013/113] spapr: consolidate the VCPU id numbering logic in a single place, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 014/113] spapr: fix missing CPU core nodes in DT when running with TCG, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 015/113] spapr: register dummy ICPs later,
Michael Roth <=
- [Qemu-devel] [PATCH 016/113] spapr: make pseries-2.11 the default machine type, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 017/113] nbd: Honor server's advertised minimum block size, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 018/113] specs/qcow2: Fix documentation of the compressed cluster descriptor, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 020/113] tpm: Set the flags of the CMD_INIT command to 0, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 019/113] rbd: Fix use after free in qemu_rbd_set_keypairs() error path, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 001/113] block/ssh: fix possible segmentation fault when .desc is not null-terminated, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 021/113] loader: don't perform overlapping address check for memory region ROM images, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 022/113] target/xtensa: dump correct physical registers, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 023/113] linux-user: fix mmap/munmap/mprotect/mremap/shmat, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 024/113] linux-user: fix assertion in shmdt, Michael Roth, 2018/06/18