mbox series

[for-7.1,0/4] use dc->vmsd with spapr devices vmstate

Message ID 20220322183854.196063-1-danielhb413@gmail.com (mailing list archive)
Headers show
Series use dc->vmsd with spapr devices vmstate | expand

Message

Daniel Henrique Barboza March 22, 2022, 6:38 p.m. UTC
Hi,

This short series converts some spapr devices to use the dc->vmsd
interface to register the vmstate. For most of them it was needed
to use qdev_set_legacy_instance_id() to keep compatibility with the
instance_id being used for awhile.

Although no functional changes were made the resulting code is a bit
shorter and maintainable. After these patches there are only 3 places
where vmstate_register() APIs are being used.

No behavior changes were detected when testing migration scenarios with
hotplug/unplug of devices.

Daniel Henrique Barboza (4):
  hw/ppc: use qdev to register logical DRC vmstates
  hw/ppc: use qdev to register physical DRC vmstates
  hw/ppc: use qdev to register spapr_iommu tcet vmstate
  hw/ppc: use qdev to register spapr_nvdimm vmsd

 hw/ppc/spapr_drc.c    | 13 ++++++-------
 hw/ppc/spapr_iommu.c  |  7 +++----
 hw/ppc/spapr_nvdimm.c | 11 ++---------
 3 files changed, 11 insertions(+), 20 deletions(-)

Comments

David Gibson March 23, 2022, 1:49 a.m. UTC | #1
On Tue, Mar 22, 2022 at 03:38:50PM -0300, Daniel Henrique Barboza wrote:
> Hi,
> 
> This short series converts some spapr devices to use the dc->vmsd
> interface to register the vmstate. For most of them it was needed
> to use qdev_set_legacy_instance_id() to keep compatibility with the
> instance_id being used for awhile.
> 
> Although no functional changes were made the resulting code is a bit
> shorter and maintainable. After these patches there are only 3 places
> where vmstate_register() APIs are being used.
> 
> No behavior changes were detected when testing migration scenarios with
> hotplug/unplug of devices.

Looks good tome.
Daniel Henrique Barboza March 23, 2022, 9:47 p.m. UTC | #2
On 3/22/22 22:49, David Gibson wrote:
> On Tue, Mar 22, 2022 at 03:38:50PM -0300, Daniel Henrique Barboza wrote:
>> Hi,
>>
>> This short series converts some spapr devices to use the dc->vmsd
>> interface to register the vmstate. For most of them it was needed
>> to use qdev_set_legacy_instance_id() to keep compatibility with the
>> instance_id being used for awhile.
>>
>> Although no functional changes were made the resulting code is a bit
>> shorter and maintainable. After these patches there are only 3 places
>> where vmstate_register() APIs are being used.
>>
>> No behavior changes were detected when testing migration scenarios with
>> hotplug/unplug of devices.
> 
> Looks good tome.

It looked good to me until, after further testing, I noticed that patch 03
breaks backward migration:

qemu_loadvm_state_section_startfull 560 (spapr_iommu) 0 2
qemu-system-ppc64: Unknown savevm section or instance 'spapr_iommu' 0. Make sure
that your current VM setup matches your saved VM setup, including any hotplugged devices

qemu-system-ppc64: load of migration failed: Invalid argument

I made a follow-up in the instance_id discussion [1] about it. For now patches 1-3 are
compromised. Only patch 04 is worth considering because the spapr_nvdimm device isn't
setting a custom instance_id.


[1] https://lists.gnu.org/archive/html/qemu-devel/2022-03/msg05942.html



Thanks,


Daniel

>