From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au,
mdroth@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH v9 4/6] hw/ppc/spapr.c: migrate pending_dimm_unplugs of spapr state
Date: Fri, 5 May 2017 17:47:44 -0300 [thread overview]
Message-ID: <20170505204746.14116-5-danielhb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170505204746.14116-1-danielhb@linux.vnet.ibm.com>
To allow for a DIMM unplug event to resume its work if a migration
occurs in the middle of it, this patch migrates the non-empty
pending_dimm_unplugs QTAILQ that stores the DIMM information
that the spapr_lmb_release() callback uses.
It was considered an apprach where the DIMM states would be restored
on the post-_load after a migration. The problem is that there is
no way of knowing, from the sPAPRMachineState, if a given DIMM is going
through an unplug process and the callback needs the updated DIMM State.
We could migrate a flag indicating that there is an unplug event going
on for a certain DIMM, fetching this information from the start of the
spapr_del_lmbs call. But this would also require a scan on post_load to
figure out how many nr_lmbs are left. At this point we can just
migrate the nr_lmbs information as well, given that it is being calculated
at spapr_del_lmbs already, and spare a scanning/discovery in the
post-load. All that we need is inside the sPAPRDIMMState structure
that is added to the pending_dimm_unplugs queue at the start of the
spapr_del_lmbs, so it's convenient to just migrated this queue it if it's
not empty.
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
---
hw/ppc/spapr.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e190eb9..30f0b7b 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1437,6 +1437,36 @@ static bool version_before_3(void *opaque, int version_id)
return version_id < 3;
}
+static bool spapr_pending_dimm_unplugs_needed(void *opaque)
+{
+ sPAPRMachineState *spapr = (sPAPRMachineState *)opaque;
+ return !QTAILQ_EMPTY(&spapr->pending_dimm_unplugs);
+}
+
+static const VMStateDescription vmstate_spapr_dimmstate = {
+ .name = "spapr_dimm_state",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT64(addr, sPAPRDIMMState),
+ VMSTATE_UINT32(nr_lmbs, sPAPRDIMMState),
+ VMSTATE_END_OF_LIST()
+ },
+};
+
+static const VMStateDescription vmstate_spapr_pending_dimm_unplugs = {
+ .name = "spapr_pending_dimm_unplugs",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = spapr_pending_dimm_unplugs_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_QTAILQ_V(pending_dimm_unplugs, sPAPRMachineState, 1,
+ vmstate_spapr_dimmstate, sPAPRDIMMState,
+ next),
+ VMSTATE_END_OF_LIST()
+ },
+};
+
static bool spapr_ov5_cas_needed(void *opaque)
{
sPAPRMachineState *spapr = opaque;
@@ -1535,6 +1565,7 @@ static const VMStateDescription vmstate_spapr = {
.subsections = (const VMStateDescription*[]) {
&vmstate_spapr_ov5_cas,
&vmstate_spapr_patb_entry,
+ &vmstate_spapr_pending_dimm_unplugs,
NULL
}
};
--
2.9.3
next prev parent reply other threads:[~2017-05-05 20:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 20:47 [Qemu-devel] [PATCH v9 0/6] migration/ppc: migrating DRC, ccs_list and pending_events Daniel Henrique Barboza
2017-05-05 20:47 ` [Qemu-devel] [PATCH v9 1/6] hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState Daniel Henrique Barboza
2017-05-12 6:04 ` David Gibson
2017-05-16 13:27 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2017-05-05 20:47 ` [Qemu-devel] [PATCH v9 2/6] hw/ppc: removing drc->detach_cb and drc->detach_cb_opaque Daniel Henrique Barboza
2017-05-12 6:07 ` David Gibson
2017-05-05 20:47 ` [Qemu-devel] [PATCH v9 3/6] hw/ppc: migrating the DRC state of hotplugged devices Daniel Henrique Barboza
2017-05-12 6:11 ` David Gibson
2017-05-16 13:46 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2017-05-17 1:42 ` David Gibson
2017-05-05 20:47 ` Daniel Henrique Barboza [this message]
2017-05-12 6:12 ` [Qemu-devel] [PATCH v9 4/6] hw/ppc/spapr.c: migrate pending_dimm_unplugs of spapr state David Gibson
2017-05-12 19:54 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2017-05-16 3:02 ` Michael Roth
2017-05-17 1:41 ` David Gibson
2017-05-05 20:47 ` [Qemu-devel] [PATCH v9 5/6] migration: spapr: migrate ccs_list in " Daniel Henrique Barboza
2017-05-05 20:47 ` [Qemu-devel] [PATCH v9 6/6] migration: spapr: migrate pending_events of " Daniel Henrique Barboza
2017-05-12 6:28 ` David Gibson
2017-05-12 20:02 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2017-05-13 7:53 ` David Gibson
2017-05-11 18:38 ` [Qemu-devel] [PATCH v9 0/6] migration/ppc: migrating DRC, ccs_list and pending_events Laurent Vivier
2017-05-11 19:48 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170505204746.14116-5-danielhb@linux.vnet.ibm.com \
--to=danielhb@linux.vnet.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).