qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: Correctly handle subsections with no 'needed' function
@ 2018-08-07 13:03 Peter Maydell
  2018-08-07 13:17 ` Juan Quintela
  2018-08-07 13:41 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 15+ messages in thread
From: Peter Maydell @ 2018-08-07 13:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Juan Quintela, Dr. David Alan Gilbert

Currently the vmstate subsection handling code treats a subsection
with no 'needed' function pointer as if it were the subsection
list terminator, so the subsection is never transferred and nor
is any subsection following it in the list.

Handle NULL 'needed' function pointers in subsections in the same
way that we do for top level VMStateDescription structures:
treat the subsection as always being needed.

This doesn't change behaviour for the current set of devices
in the tree, because all subsections declare a 'needed' function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
NB: last para in the commit message is only true once the
"Arm migration fixes for 3.0" patchset has been committed.
We could optionally drop some of the "use a dummy needed fn"
changes once this is in...

I thought I'd sent this out a few days back, but apparently not,
since it's not on-list...

 migration/vmstate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/migration/vmstate.c b/migration/vmstate.c
index 6b9079bb51e..0bc240a3175 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -418,7 +418,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
 static const VMStateDescription *
 vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
 {
-    while (sub && *sub && (*sub)->needed) {
+    while (sub && *sub) {
         if (strcmp(idstr, (*sub)->name) == 0) {
             return *sub;
         }
@@ -486,8 +486,8 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
     int ret = 0;
 
     trace_vmstate_subsection_save_top(vmsd->name);
-    while (sub && *sub && (*sub)->needed) {
-        if ((*sub)->needed(opaque)) {
+    while (sub && *sub) {
+        if (vmstate_save_needed(*sub, opaque)) {
             const VMStateDescription *vmsdsub = *sub;
             uint8_t len;
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-08-08 13:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-07 13:03 [Qemu-devel] [PATCH] migration: Correctly handle subsections with no 'needed' function Peter Maydell
2018-08-07 13:17 ` Juan Quintela
2018-08-07 13:21   ` Peter Maydell
2018-08-07 13:25     ` Peter Maydell
2018-08-07 14:32     ` Juan Quintela
2018-08-07 14:39       ` Peter Maydell
2018-08-07 14:49         ` Juan Quintela
2018-08-07 15:00           ` Peter Maydell
2018-08-07 15:05             ` Juan Quintela
2018-08-07 15:09               ` Peter Maydell
2018-08-07 15:12                 ` Dr. David Alan Gilbert
2018-08-08  7:27                 ` Juan Quintela
2018-08-08 13:47                   ` Peter Maydell
2018-08-07 13:43   ` Dr. David Alan Gilbert
2018-08-07 13:41 ` Dr. David Alan Gilbert

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).