From nobody Wed Nov 5 07:14:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533647135475664.3964988821875; Tue, 7 Aug 2018 06:05:35 -0700 (PDT) Received: from localhost ([::1]:39001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn1fv-00028S-7y for importer@patchew.org; Tue, 07 Aug 2018 09:05:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn1ek-0000wq-Qn for qemu-devel@nongnu.org; Tue, 07 Aug 2018 09:04:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn1eg-0006CV-RW for qemu-devel@nongnu.org; Tue, 07 Aug 2018 09:04:10 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:44168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fn1eg-00069l-HO for qemu-devel@nongnu.org; Tue, 07 Aug 2018 09:04:06 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fn1eY-0001oe-3J; Tue, 07 Aug 2018 14:03:58 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 14:03:55 +0100 Message-Id: <20180807130355.29780-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] migration: Correctly handle subsections with no 'needed' function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr. David Alan Gilbert" , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Dr. David Alan Gilbert --- 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 VMStateDesc= ription *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) =3D=3D 0) { return *sub; } @@ -486,8 +486,8 @@ static int vmstate_subsection_save(QEMUFile *f, const V= MStateDescription *vmsd, int ret =3D 0; =20 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 =3D *sub; uint8_t len; =20 --=20 2.17.1