From patchwork Wed Aug 22 12:00:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 144825 Delivered-To: patch@linaro.org Received: by 2002:a2e:164a:0:0:0:0:0 with SMTP id 10-v6csp563602ljw; Wed, 22 Aug 2018 05:04:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZNWLI6hDJ87L5OAZV0jCkKcT0e5ESwHQM89Yl+Dx+ecDjYXenDJABet6++uZJPBI5vgONK X-Received: by 2002:a37:3554:: with SMTP id c81-v6mr7309303qka.30.1534939450210; Wed, 22 Aug 2018 05:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534939450; cv=none; d=google.com; s=arc-20160816; b=ratwdIMs3OglRKCr0nw+P8jfmaJZ9iYeKrhl/gh5I/NhualmogsCWCNErXzVnZcF3f 26dX2ve8rQBXsqCJfAK+NPfElU3U/+1qbpQxM0sV7DaE8Fs9M8pE6KZS7qzbRDV6FX8W NhUs29J+AcucfE1n0KI0z8Rg3eQEHl6b4jvmol0Rc3Wmo7W1bb1/IcKqrguT3veBihxW 8Z9VKJ3kFbna287WuzReOBzY+CPr5WKtcQfamjJSxqae6DxlLw7Ck6XcGpPsqKZgzLs2 s6PH6Uzbya22QHZSCANBLTFgnEU57OdwPvyJP/qqz76BfjbQO2RD64+ZBYX0KLbqEoDh jNfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=TSnip9w2ifScHGn3bjA/L7uBUUniI+E8B2K8IPMTn1U=; b=aoucm+zV/ER7O3DHeZK2E0VuMU5TvLpz7+vLgr8xYTwg49iiDuhpXNv/YuXjV8+L6l B65tsZUNzGiy5EfhzOJuXdXpByQtZuIwu2jMHi3qh7c/2XBalv7e1eWUOnqY4xlrmFer 6DM9hy2t32XVPsrjNzGH76dpiRSnoRSNMRiPawfJkC5m6kOzvEJ5PtecExEQ2tZTZflk n4AL7jMngNWhvWdcUAgJp8WGkdI2in4EdX2/b0rgtlZIcQQGT1UjVv6+U+YIg38B2l1g YnSClO1U34G9kKicq3Lx5Nf2LEKdAPxoVPaV6Oc0l+Mu9HVzRwcS178z0kBU1ddWDMsk ZEpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 14-v6si1477791qvj.188.2018.08.22.05.04.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 22 Aug 2018 05:04:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:58648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsRrt-0007iz-FX for patch@linaro.org; Wed, 22 Aug 2018 08:04:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsRp3-0006e9-BX for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsRot-0008CW-7j for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57296 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsRos-0008BQ-Tf for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AFF940216EC; Wed, 22 Aug 2018 12:01:02 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AD19A9E62; Wed, 22 Aug 2018 12:01:01 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 22 Aug 2018 14:00:32 +0200 Message-Id: <20180822120050.12694-3-quintela@redhat.com> In-Reply-To: <20180822120050.12694-1-quintela@redhat.com> References: <20180822120050.12694-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 22 Aug 2018 12:01:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 22 Aug 2018 12:01:02 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/20] 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: lvivier@redhat.com, Peter Maydell , dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/vmstate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/migration/vmstate.c b/migration/vmstate.c index 6b9079bb51..0bc240a317 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;