qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH RFC qom-cpu v2 0/8] QOM CPUState VMStateDescriptions


From: Andreas Färber
Subject: [Qemu-ppc] [PATCH RFC qom-cpu v2 0/8] QOM CPUState VMStateDescriptions
Date: Mon, 18 Feb 2013 20:42:25 +0100

Hello,

In response to patches from Juan [1], this series implements a declarative way
for CPUs to register their CPU-specific VMStateDescription.

v2 has style improvements by using stubs for *-user, suggested by Eduardo.

To clarify status:
* Patches 1-5 should hopefully be good to go now. Please ack.
* Patches 6-8 depend on how we want to procede with future targets (cf. below).

Available here:
git://github.com/afaerber/qemu-cpu.git qom-cpu-vmstate.v2
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-vmstate.v2

Preview of QOM CPUState part 9 v2 as follow-up to the x86 patch:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-9

Original discussion:
There are subtle differences between CPU and devices in how they register
their savevm handlers and VMStateDescription respectively:

* CPUs register one VMStateDescription "cpu_common" plus savevm handlers for
  the target-specifics (machine.c:cpu_{save,load}).
  Devices register one VMStateDescription with a subsection for common state
  where necessary.

* CPUs use their cpu_index field as instance_id.
  Devices pass -1 as instance_id, resulting in highest index on the bus plus 1.
  Note: The current cpu_index numbering is not hot-unplug-safe.

My code assumes that registering "cpu_common" for CPUArchState (until changed
in CPUState part 9 series) while registering "cpu" for CPUState is compatible,
since by not using DeviceState::vmsd infrastructure registration order remains
guaranteed the same.

Patches 6-8 demonstrate how two VMStateDescription-prepared but not yet
migratable targets would look like if we want to adopt a consistent pattern
for VMStateDescription registration and layout throughout targets.

Question is whether we want to take that legacy burden on us or whether to
simply expose exec.c:vmstate_cpu_common and embed it PCI-like into the
prepared VMStateDescriptions for alpha and openrisc and register them through
DeviceClass::vmsd instead.

An alternative might be registering "cpu_common" as before but with
instance_id -1 and registering "cpu" through DeviceClass::vmsd, since
exec.c:calculate_new_instance_id() takes the name string into account.
But that would be inconsistent with how devices behave VMState-wise.

Targets that have not yet been converted to VMState [1, 2] are left untouched.

What triggered this series was moving the halted and interrupt_request fields
from CPU_COMMON to CPUState:
https://lists.nongnu.org/archive/html/qemu-devel/2013-02/msg00203.html
Since both are in vmstate_cpu_common, they needed to be moved together, and
"cpu_common" will need to operate on CPUState then. At the same time x86
can no longer access the halted field from CPUX86State via VMSTATE_ macros,
so either we need to drop uses of such fields (i.e., version 5) or make it
possible to access CPUState fields in x86 VMState through parent_obj field.
Further, in explaining intended uses of S390CPU vs. CPUS390XState I was
reminded that VMState is currently a limiting factor for placing fields into
CPUState-derived types rather than into CPU*State.

Regards,
Andreas

[1] https://lists.nongnu.org/archive/html/qemu-devel/2012-05/msg00524.html
[2] https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03451.html

v1 -> v2:
* Add vmstate_register() and vmstate_dummy stubs to avoid #ifdefs (Eduardo).

Cc: Juan Quintela <address@hidden>
Cc: Michael Roth <address@hidden>

Cc: Anthony Liguori <address@hidden>
Cc: Blue Swirl <address@hidden>
Cc: Aurélien Jarno <address@hidden>

Cc: Eduardo Habkost <address@hidden>
Cc: Igor Mammedov <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Michael Walle <address@hidden>
Cc: Jia Liu <address@hidden>
Cc: Anthony Green <address@hidden>

Cc: David Gibson <address@hidden>
Cc: Alexander Graf <address@hidden>
Cc: address@hidden

Andreas Färber (8):
  stubs: Add vmstate_register() stub
  stubs: Add a vmstate_dummy struct for CONFIG_USER_ONLY
  cpu: Register VMStateDescription through CPUState
  target-i386: Update VMStateDescription to X86CPU
  target-lm32: Update VMStateDescription to LM32CPU
  target-alpha: Register VMStateDescription for AlphaCPU
  target-openrisc: Register VMStateDescription for OpenRISCCPU
  cpu: Guard cpu_{save,load}() definitions

 exec.c                      |   11 ++-
 include/migration/vmstate.h |    4 +
 include/qemu-common.h       |    2 +
 include/qom/cpu.h           |    3 +
 stubs/vmstate.c             |    9 ++
 target-alpha/cpu-qom.h      |    6 ++
 target-alpha/cpu.c          |    2 +
 target-alpha/machine.c      |   64 ++++++-------
 target-i386/cpu-qom.h       |    6 ++
 target-i386/cpu.c           |    2 +
 target-i386/cpu.h           |    2 -
 target-i386/machine.c       |  215 +++++++++++++++++++++----------------------
 target-lm32/cpu-qom.h       |    6 ++
 target-lm32/cpu.c           |    2 +
 target-lm32/cpu.h           |    2 -
 target-lm32/machine.c       |   36 +++-----
 target-openrisc/cpu.c       |    2 +
 target-openrisc/cpu.h       |    6 +-
 target-openrisc/machine.c   |   33 +++----
 19 Dateien geändert, 220 Zeilen hinzugefügt(+), 193 Zeilen entfernt(-)

-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]