Skip to content

Commit

Permalink
spapr: init CPUState->cpu_index with index relative to core-id
Browse files Browse the repository at this point in the history
It will enshure that cpu_index for a given cpu stays the same
regardless of the order cpus has been created/deleted and so
it would be possible to migrate QEMU instance with out of order
created CPU.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
Igor Mammedov authored and dgibson committed Jul 29, 2016
1 parent 21a21b8 commit b63578b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hw/ppc/spapr_cpu_core.c
Expand Up @@ -307,9 +307,13 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
sc->threads = g_malloc0(size * cc->nr_threads);
for (i = 0; i < cc->nr_threads; i++) {
char id[32];
CPUState *cs;

obj = sc->threads + i * size;

object_initialize(obj, size, typename);
cs = CPU(obj);
cs->cpu_index = cc->core_id + i;
snprintf(id, sizeof(id), "thread[%d]", i);
object_property_add_child(OBJECT(sc), id, obj, &local_err);
if (local_err) {
Expand Down

0 comments on commit b63578b

Please sign in to comment.