qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH for-7.1 2/4] hw/ppc: use qdev to register physical DRC vmstat


From: Daniel Henrique Barboza
Subject: Re: [PATCH for-7.1 2/4] hw/ppc: use qdev to register physical DRC vmstates
Date: Wed, 23 Mar 2022 18:44:21 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0



On 3/22/22 22:48, David Gibson wrote:
On Tue, Mar 22, 2022 at 03:38:52PM -0300, Daniel Henrique Barboza wrote:
Similar to logical DRCs, let's convert physical DRCs to register their
vmstates using dc->vmsd.

The same constraints with instance_id being set to spapr_drc_index()
also applies in this case. However, since realize_physical() calls
drc_realize(), qdev_set_legacy_instance_id() is already being set.

Ok, and you've verified that you don't need to set the legacy ID on
both "layers"?  That is, have you tested that you can migrate from
before this change to after?

It works for the wrong reasons. The way I tested this patch wasn't triggering
the migration of the DRCs.

Doing a hotplug and migrating afterwards was enough to migrate the DRC back in 
2017,
but after all the work we did in DRC code over these years what happens now is 
that,
during machine reset, the drc is set to ready_state:

    if (drc->dev) {
        /* A device present at reset is ready to go, same as coldplugged */
        drc->state = drck->ready_state;

And spapr_drc_needed() is returning false:

    /*
     * We need to reset the DRC at CAS or to migrate the DRC state if it's
     * not equal to the expected long-term state, which is the same as the
     * coldplugged initial state, or if an unplug request is pending.
     */
    return drc->state != drck->ready_state || spapr_drc_unplug_requested(drc);


So the CPU DRCs aren't being migrated. I noticed that when turning on traces
of the migration code to debug a problem with patch 03.



Daniel



Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
  hw/ppc/spapr_drc.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index a5ef64d2a2..5a60885876 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -640,9 +640,6 @@ static void realize_physical(DeviceState *d, Error **errp)
          return;
      }
- vmstate_register(VMSTATE_IF(drcp),
-                     spapr_drc_index(SPAPR_DR_CONNECTOR(drcp)),
-                     &vmstate_spapr_drc_physical, drcp);
      qemu_register_reset(drc_physical_reset, drcp);
  }
@@ -651,7 +648,6 @@ static void unrealize_physical(DeviceState *d)
      SpaprDrcPhysical *drcp = SPAPR_DRC_PHYSICAL(d);
drc_unrealize(d);
-    vmstate_unregister(VMSTATE_IF(drcp), &vmstate_spapr_drc_physical, drcp);
      qemu_unregister_reset(drc_physical_reset, drcp);
  }
@@ -662,6 +658,8 @@ static void spapr_drc_physical_class_init(ObjectClass *k, void *data) dk->realize = realize_physical;
      dk->unrealize = unrealize_physical;
+    dk->vmsd = &vmstate_spapr_drc_physical;
+
      drck->dr_entity_sense = physical_entity_sense;
      drck->isolate = drc_isolate_physical;
      drck->unisolate = drc_unisolate_physical;




reply via email to

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