From patchwork Tue Oct 24 08:40:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OOXrqhqm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5Bn68J7z23jl for ; Tue, 24 Oct 2023 19:41:36 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCy9-0003b9-VI; Tue, 24 Oct 2023 04:40:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCy8-0003PY-0o for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:40:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCy6-0003Fs-DJ for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:40:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HFJfX2UbdUONwAiwbnWDg/Z2Ma5pzUtKmwKBZ6J1/3g=; b=OOXrqhqm/gXTWr0jC4G2+3baLXdRNDGMFfQeebRdT4ZWiKS9P9AUZij4JvHWhnS5iAKqDV hcEyLFZh1VWGA+jbiiM9dMcwY4nPZlEF0n+jDUk6NkT5s8Xdf7Z0XblJNfr6ZSDPPCUvIx 7MCAh9DokDr9pkf7TRL6zRTadsMD1zY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-9pUllD1KPXCPUZhde0NC8Q-1; Tue, 24 Oct 2023 04:40:52 -0400 X-MC-Unique: 9pUllD1KPXCPUZhde0NC8Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A8314857A85; Tue, 24 Oct 2023 08:40:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id B74F58C0B; Tue, 24 Oct 2023 08:40:50 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 1/9] block/fdc: 'phase' is not needed on load Date: Tue, 24 Oct 2023 12:40:35 +0400 Message-ID: <20231024084043.2926316-2-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau It is reconstructed during fdc_post_load() Signed-off-by: Marc-André Lureau --- hw/block/fdc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index d7cc4d3ec1..fc71660ba0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -1005,6 +1005,11 @@ static bool fdc_phase_needed(void *opaque) { FDCtrl *fdctrl = opaque; + /* not needed on load */ + if (fdctrl->phase == FD_PHASE_RECONSTRUCT) { + return false; + } + return reconstruct_phase(fdctrl) != fdctrl->phase; } From patchwork Tue Oct 24 08:40:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=e4FTV+oR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5C86T7dz23jl for ; Tue, 24 Oct 2023 19:41:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCyF-0003oZ-MX; Tue, 24 Oct 2023 04:41:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyE-0003n8-3i for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyC-0003Je-LF for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b0sIoyOFAtdBEQyNjp7wD5mrhmgIJhKoQXB/TDbxuWQ=; b=e4FTV+oRWoBQgs6DpFCOKa7viI7hxksaLM0nVaEZW+L39i9MoeE+8yv20Sv5Yyfu4zUiQb 2g5mvD6Tx7pw50RIE9gEQPxVi9FA1F+vYYxEayOjLmukfYePe8p51HHWve1Bl0EeabPY7i eOalvH8dQYRpFsZTHf4gR0KpRWUB3OA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-CyuS3CWENJewInKyUoSbaQ-1; Tue, 24 Oct 2023 04:40:56 -0400 X-MC-Unique: CyuS3CWENJewInKyUoSbaQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB0D2185A7BC; Tue, 24 Oct 2023 08:40:55 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 213831121318; Tue, 24 Oct 2023 08:40:54 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 2/9] virtio: make endian_needed() work during loading Date: Tue, 24 Oct 2023 12:40:36 +0400 Message-ID: <20231024084043.2926316-3-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau There is no simple way to distinguish when the callback is used for load or save, AFAICT. Signed-off-by: Marc-André Lureau --- hw/virtio/virtio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 6facd64fbc..8baf9f7ca8 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2502,7 +2502,11 @@ static bool virtio_device_endian_needed(void *opaque) { VirtIODevice *vdev = opaque; - assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); + /* On load, endian is UNKNOWN. The section might be loaded as required. */ + if (vdev->device_endian == VIRTIO_DEVICE_ENDIAN_UNKNOWN) { + return false; + } + if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { return vdev->device_endian != virtio_default_endian(); } From patchwork Tue Oct 24 08:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YV+Q8DEd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5Cl68gNz23k5 for ; Tue, 24 Oct 2023 19:42:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCyU-00041D-Ej; Tue, 24 Oct 2023 04:41:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyR-0003yk-Cq for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyP-0003LO-QA for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BS4K4hPt4nte3fTZb5lBi+CHvfoDZl40p9U7Y5fbyOg=; b=YV+Q8DEdhHhlD7ShwS5EvxwMzQWFo6j211o4JbRIkIKkH60z9aTixX8CL10XwbrORy2DJR MpS+yForWSVEBMMn/0Kq3Z40DVy2En2ZGQlyrSSJjlHaMREcNuKFUB6bgN/6BhRE+0l6yf d337dgDSuvS1Xh1+0VloZbhsgjWYXrE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-75-VvVOjqkeNrq82tOb4k6P1g-1; Tue, 24 Oct 2023 04:41:01 -0400 X-MC-Unique: VvVOjqkeNrq82tOb4k6P1g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA96B1019C99; Tue, 24 Oct 2023 08:41:00 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF25CC15BB8; Tue, 24 Oct 2023 08:40:59 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 3/9] net/slirp: use different IDs for each instance Date: Tue, 24 Oct 2023 12:40:37 +0400 Message-ID: <20231024084043.2926316-4-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau Using always 0, QEMU will end up loading the same instance, even if multiple have been saved. Signed-off-by: Marc-André Lureau --- net/slirp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index c33b3e02e7..af1451b60f 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -47,6 +47,7 @@ #include "util.h" #include "migration/register.h" #include "migration/qemu-file-types.h" +#include "migration/vmstate.h" static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { @@ -659,7 +660,7 @@ static int net_slirp_init(NetClientState *peer, const char *model, * specific version? */ g_assert(slirp_state_version() == 4); - register_savevm_live("slirp", 0, slirp_state_version(), + register_savevm_live("slirp", VMSTATE_INSTANCE_ID_ANY, slirp_state_version(), &savevm_slirp_state, s->slirp); s->poll_notifier.notify = net_slirp_poll_notify; From patchwork Tue Oct 24 08:40:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Rcxt6PZn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5DF3MBRz23jl for ; Tue, 24 Oct 2023 19:42:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCyO-0003tH-Vw; Tue, 24 Oct 2023 04:41:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyM-0003qd-Q1 for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyL-0003Ku-AX for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0T1ckZ/Ff7y9NC51JPbCpyeyBtZPrNqFVintRXVUvls=; b=Rcxt6PZnHoAGCtCSRpJLYsGy0e150AbI+RNNXyZ3QGm7KWNAt0PSyaYAmEEeVzbmiyIWxp tQL73Jt3n8ztmNkvL2CpW1ceo6rd1umf7hyXrtI66UTiLC+knXJ6O+7TSgSwMj6XunwTfN TfexqozI6vzw6wub97cU4mckQQWGROo= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-Y8-wSi-tMEytXCJy3K4Y2w-1; Tue, 24 Oct 2023 04:41:05 -0400 X-MC-Unique: Y8-wSi-tMEytXCJy3K4Y2w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC73D3811F33; Tue, 24 Oct 2023 08:41:04 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5DEB1C060AE; Tue, 24 Oct 2023 08:41:03 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 4/9] migration: rename vmstate_save_needed->vmstate_section_needed Date: Tue, 24 Oct 2023 12:40:38 +0400 Message-ID: <20231024084043.2926316-5-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau The function is used on save at this point. The following commits will use it on load. Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- include/migration/vmstate.h | 2 +- migration/savevm.c | 2 +- migration/vmstate.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 1a31fb7293..1af181877c 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1202,7 +1202,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, JSONWriter *vmdesc, int version_id, Error **errp); -bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque); +bool vmstate_section_needed(const VMStateDescription *vmsd, void *opaque); #define VMSTATE_INSTANCE_ID_ANY -1 diff --git a/migration/savevm.c b/migration/savevm.c index 8622f229e5..ca5c7cebe0 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -985,7 +985,7 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) if ((!se->ops || !se->ops->save_state) && !se->vmsd) { return 0; } - if (se->vmsd && !vmstate_save_needed(se->vmsd, se->opaque)) { + if (se->vmsd && !vmstate_section_needed(se->vmsd, se->opaque)) { trace_savevm_section_skip(se->idstr, se->section_id); return 0; } diff --git a/migration/vmstate.c b/migration/vmstate.c index 1cf9e45b85..16e33a5d34 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -324,7 +324,7 @@ static void vmsd_desc_field_end(const VMStateDescription *vmsd, } -bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque) +bool vmstate_section_needed(const VMStateDescription *vmsd, void *opaque) { if (vmsd->needed && !vmsd->needed(opaque)) { /* optional section not needed */ @@ -522,7 +522,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, trace_vmstate_subsection_save_top(vmsd->name); while (sub && *sub) { - if (vmstate_save_needed(*sub, opaque)) { + if (vmstate_section_needed(*sub, opaque)) { const VMStateDescription *vmsdsub = *sub; uint8_t len; From patchwork Tue Oct 24 08:40:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PWTockgS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5Cl34Zzz23jl for ; Tue, 24 Oct 2023 19:42:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCyq-0004Cc-SZ; Tue, 24 Oct 2023 04:41:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyS-0003yl-Fr for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyP-0003LT-QN for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LnsG5NWQMp6ppcb6O/Y0IH9dMdUd6gQTyemwrekuS08=; b=PWTockgSkXoVd5oKEn/OxwHbfOCtGtO9ZupfksWL3uR9X2znYWB0+9Ndyb31EzpC1yhHD8 s4vgjt0defySlf0IO5ZsZ6hpixwv7DoaQzxVWY59rFpnvcoAuJoAExRoAWBkrEergXrraN 8Mrsyf7vlPQz5tKxYFox2d9LzyS5dM0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-541-1RGbMSjsMmCVGt_lZbA9OQ-1; Tue, 24 Oct 2023 04:41:09 -0400 X-MC-Unique: 1RGbMSjsMmCVGt_lZbA9OQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A25C1C051A1; Tue, 24 Oct 2023 08:41:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CE44492BD9; Tue, 24 Oct 2023 08:41:07 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 5/9] migration: check required subsections are loaded, once Date: Tue, 24 Oct 2023 12:40:39 +0400 Message-ID: <20231024084043.2926316-6-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau Check that required subsections have been loaded. Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- migration/vmstate.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index 16e33a5d34..d6fe38a5e1 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -451,22 +451,51 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, } static const VMStateDescription * -vmstate_get_subsection(const VMStateDescription **sub, char *idstr) +vmstate_get_subsection(const VMStateDescription **sub, char *idstr, bool *visited) { + size_t i = 0; + while (sub && *sub) { if (strcmp(idstr, (*sub)->name) == 0) { + if (visited[i]) { + return NULL; + } + visited[i] = true; return *sub; } + i++; sub++; } return NULL; } +static size_t +vmstate_get_n_subsections(const VMStateDescription **sub) +{ + size_t n = 0; + + if (!sub) { + return 0; + } + + while (sub[n]) { + n++; + } + + return n; +} + static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, void *opaque) { + size_t i, n; + g_autofree bool *visited = NULL; + trace_vmstate_subsection_load(vmsd->name); + n = vmstate_get_n_subsections(vmsd->subsections); + visited = g_new0(bool, n); + while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) { char idstr[256], *idstr_ret; int ret; @@ -492,7 +521,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, /* it doesn't have a valid subsection name */ return 0; } - sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr); + sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr, visited); if (sub_vmsd == NULL) { trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(lookup)"); return -ENOENT; @@ -509,6 +538,13 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, } } + for (i = 0; i < n; i++) { + if (!visited[i] && vmstate_section_needed(vmsd->subsections[i], opaque)) { + trace_vmstate_subsection_load_bad(vmsd->name, vmsd->subsections[i]->name, "(not visited)"); + return -ENOENT; + } + } + trace_vmstate_subsection_load_good(vmsd->name); return 0; } From patchwork Tue Oct 24 08:40:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=X2NW7S6x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5D83h9Cz23jl for ; Tue, 24 Oct 2023 19:42:48 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCyW-00045z-3O; Tue, 24 Oct 2023 04:41:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyU-00041U-Jx for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyS-0003M1-Pr for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JcTpCgZ35LfhC+wFH9xrmV5omvGtiL8P6lxVbihLf/E=; b=X2NW7S6xXdS/NPvr0xyfgKK/PCK881BxkmF1VGBl932Xwopq5VNb+gOxivkINrIiwHf/Ga qDKVy+SnNODwW28OfAEAKbM5bt70omvu3M/FHKfU4Lg7grKQGFOJeCq5DSey/TZk+yArUc +foFT6xqfaJ7blTeAVVR4RBxe5Wv85k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-JJYg65rzNbaQWhiovTqt7g-1; Tue, 24 Oct 2023 04:41:14 -0400 X-MC-Unique: JJYg65rzNbaQWhiovTqt7g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB87A811E97; Tue, 24 Oct 2023 08:41:13 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B5C825C0; Tue, 24 Oct 2023 08:41:12 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 6/9] migration: check required entries are loaded, once Date: Tue, 24 Oct 2023 12:40:40 +0400 Message-ID: <20231024084043.2926316-7-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- migration/savevm.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index ca5c7cebe0..66c9c3095b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -217,6 +217,7 @@ typedef struct SaveStateEntry { void *opaque; CompatEntry *compat; int is_ram; + bool visited; } SaveStateEntry; typedef struct SaveState { @@ -1739,6 +1740,36 @@ int qemu_save_device_state(QEMUFile *f) return qemu_file_get_error(f); } +static void savevm_reset_visited(void) +{ + SaveStateEntry *se; + + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + se->visited = false; + } +} + +static bool loadvm_check_visited(Error **errp) +{ + SaveStateEntry *se; + + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + if (se->ops && se->ops->is_active && !se->ops->is_active(se->opaque)) { + continue; + } + if (se->vmsd && !vmstate_section_needed(se->vmsd, se->opaque)) { + continue; + } + if (!se->visited) { + error_setg(errp, "Missing entry '%s' while loading VM", se->idstr); + return false; + } + } + + return true; +} + + static SaveStateEntry *find_se(const char *idstr, uint32_t instance_id) { SaveStateEntry *se; @@ -2541,6 +2572,11 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis) idstr, instance_id); return -EINVAL; } + if (se->visited) { + error_report("error while loading state for instance 0x%"PRIx32" of" + " device '%s'", instance_id, idstr); + return -EINVAL; + } /* Validate version */ if (version_id > se->version_id) { @@ -2567,6 +2603,8 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis) return -EINVAL; } + se->visited = true; + return 0; } @@ -2874,7 +2912,12 @@ int qemu_loadvm_state(QEMUFile *f) cpu_synchronize_all_pre_loadvm(); + savevm_reset_visited(); ret = qemu_loadvm_state_main(f, mis); + if (!loadvm_check_visited(&local_err)) { + error_report_err(local_err); + return -EINVAL; + } qemu_event_set(&mis->main_thread_load_event); trace_qemu_loadvm_state_post_main(ret); From patchwork Tue Oct 24 08:40:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ToT6vPiV; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5CW6Br8z23jl for ; Tue, 24 Oct 2023 19:42:15 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCys-0004Fw-NF; Tue, 24 Oct 2023 04:41:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCya-00048e-8z for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyY-0003OX-Oq for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QMfsu1D3Em5HyaSgl6VAZL8RSeHOmIYpXte1yU4sBcs=; b=ToT6vPiVFFR9MJbsUtgYuMeKTp7LpAHPSsbLxmrCAEbNMSu3oMhe+rwQ5N3+eaoJBoFJAd gWMIErjMp22bC9Mf606VqJxxQfjhZvmLsDBY47auIAHUd/ND1us6NjYwyE/R9nECAah1A7 5XJ4lkPLuSjvl57m8R0dUAI4zmmcpso= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-JNJFnvLTNSmafGL3_WoVPw-1; Tue, 24 Oct 2023 04:41:18 -0400 X-MC-Unique: JNJFnvLTNSmafGL3_WoVPw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C45F1C05AD7; Tue, 24 Oct 2023 08:41:18 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70BCE492BD9; Tue, 24 Oct 2023 08:41:17 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 7/9] migration: set file error on subsection loading Date: Tue, 24 Oct 2023 12:40:41 +0400 Message-ID: <20231024084043.2926316-8-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau commit 13cde50889237 ("vmstate: Return error in case of error") sets QemuFile error to stop reading from it and report to the caller (checked by unit tests). We should do the same on subsection loading error. Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- migration/vmstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/vmstate.c b/migration/vmstate.c index d6fe38a5e1..be2193158f 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -179,6 +179,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, assert(field->flags == VMS_END); ret = vmstate_subsection_load(f, vmsd, opaque); if (ret != 0) { + qemu_file_set_error(f, ret); return ret; } if (vmsd->post_load) { From patchwork Tue Oct 24 08:40:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=g132gfw0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5Cm1K1sz23kh for ; Tue, 24 Oct 2023 19:42:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCyu-0004HT-LD; Tue, 24 Oct 2023 04:41:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyn-0004Cz-HR for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyl-0003QU-Sz for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wR2TWmu2nXFe+Yt2dn6KOypBMftWecdiJd9iSWtUhzo=; b=g132gfw0srvt9BLFoI2NkpMFNLf5M5M7jQYp05pPLxXAyYmD3F+ddygqeV5W2c/1SiFs96 nZ6POTbrMdVPEpUKNetkdBeBifhfW4+fSpJdXjRuzzcngDUzGzaETuFI7mdXfo6ZSJmxZe 6hee3b//UINfnzB1UGqEiXlLbNxRrsE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-328-dXfmySJwOzSOH4-oIxml0Q-1; Tue, 24 Oct 2023 04:41:23 -0400 X-MC-Unique: dXfmySJwOzSOH4-oIxml0Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC3D1185AD13; Tue, 24 Oct 2023 08:41:22 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 194438C0B; Tue, 24 Oct 2023 08:41:20 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 8/9] test-vmstate: add some subsection tests Date: Tue, 24 Oct 2023 12:40:42 +0400 Message-ID: <20231024084043.2926316-9-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau Check subsection support, and optional handling. Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- tests/unit/test-vmstate.c | 116 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c index 0b7d5ecd68..7f4a02b4c0 100644 --- a/tests/unit/test-vmstate.c +++ b/tests/unit/test-vmstate.c @@ -1479,6 +1479,118 @@ static void test_tmp_struct(void) g_assert_cmpint(obj.f, ==, 8); /* From the child->parent */ } +static bool sub_optional_needed = true; + +static bool sub_optional_needed_cb(void *opaque) +{ + return sub_optional_needed; +} + +static const VMStateDescription vmstate_sub_optional_a = { + .name = "sub/optional/a", + .version_id = 1, + .minimum_version_id = 1, + .needed = sub_optional_needed_cb, + .fields = (VMStateField[]) { + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_sub_optional = { + .name = "sub/optional", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_END_OF_LIST() + }, + .subsections = (const VMStateDescription * []) { + &vmstate_sub_optional_a, + } +}; + +static uint8_t wire_sub_optional[] = { + QEMU_VM_SUBSECTION, + 14, + 's', 'u', 'b', '/', 'o', 'p', 't', 'i', 'o', 'n', 'a', 'l', '/', 'a', + 0x0, 0x0, 0x0, 1, + QEMU_VM_EOF, +}; + +static uint8_t wire_sub_optional_missing[] = { + QEMU_VM_EOF, +}; + +static void test_sub_optional_needed(void) +{ + sub_optional_needed = true; + save_vmstate(&vmstate_sub_optional, NULL); + + compare_vmstate(wire_sub_optional, sizeof(wire_sub_optional)); + + SUCCESS(load_vmstate_one(&vmstate_sub_optional, NULL, + 1, wire_sub_optional, + sizeof(wire_sub_optional))); + + FAILURE(load_vmstate_one(&vmstate_sub_optional, NULL, + 1, wire_sub_optional_missing, + sizeof(wire_sub_optional_missing))); + +} + +static void test_sub_optional_missing(void) +{ + sub_optional_needed = false; + save_vmstate(&vmstate_sub_optional, NULL); + + compare_vmstate(wire_sub_optional_missing, sizeof(wire_sub_optional_missing)); + + SUCCESS(load_vmstate_one(&vmstate_sub_optional, NULL, + 1, wire_sub_optional, + sizeof(wire_sub_optional))); + + SUCCESS(load_vmstate_one(&vmstate_sub_optional, NULL, + 1, wire_sub_optional_missing, + sizeof(wire_sub_optional_missing))); +} + +static uint8_t wire_sub_dup[] = { + QEMU_VM_SUBSECTION, + 14, + 's', 'u', 'b', '/', 'o', 'p', 't', 'i', 'o', 'n', 'a', 'l', '/', 'a', + 0x0, 0x0, 0x0, 1, + QEMU_VM_SUBSECTION, + 14, + 's', 'u', 'b', '/', 'o', 'p', 't', 'i', 'o', 'n', 'a', 'l', '/', 'a', + 0x0, 0x0, 0x0, 1, + QEMU_VM_EOF, +}; + +static void test_sub_optional_dup(void) +{ + sub_optional_needed = false; + + FAILURE(load_vmstate_one(&vmstate_sub_optional, NULL, + 1, wire_sub_dup, + sizeof(wire_sub_dup))); +} + +static uint8_t wire_sub_unknown[] = { + QEMU_VM_SUBSECTION, + 14, + 's', 'u', 'b', '/', 'o', 'p', 't', 'i', 'o', 'n', 'a', 'l', '/', 'b', + 0x0, 0x0, 0x0, 1, + QEMU_VM_EOF, +}; + +static void test_sub_optional_unknown(void) +{ + sub_optional_needed = false; + + FAILURE(load_vmstate_one(&vmstate_sub_optional, NULL, + 1, wire_sub_unknown, + sizeof(wire_sub_unknown))); +} + int main(int argc, char **argv) { g_autofree char *temp_file = g_strdup_printf("%s/vmst.test.XXXXXX", @@ -1519,6 +1631,10 @@ int main(int argc, char **argv) g_test_add_func("/vmstate/qlist/save/saveqlist", test_save_qlist); g_test_add_func("/vmstate/qlist/load/loadqlist", test_load_qlist); g_test_add_func("/vmstate/tmp_struct", test_tmp_struct); + g_test_add_func("/vmstate/subsection/needed", test_sub_optional_needed); + g_test_add_func("/vmstate/subsection/missing", test_sub_optional_missing); + g_test_add_func("/vmstate/subsection/dup", test_sub_optional_dup); + g_test_add_func("/vmstate/subsection/unknown", test_sub_optional_unknown); g_test_run(); close(temp_fd); From patchwork Tue Oct 24 08:40:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1854215 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jQ2ztbBM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF5Cw59Krz23k5 for ; Tue, 24 Oct 2023 19:42:36 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCz2-0004RA-IN; Tue, 24 Oct 2023 04:41:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyz-0004KW-KG for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCyx-0003Sy-UU for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:41:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698136907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LCp3AYBhBG3mDrqT6tO9NXD2VXeACBOwSKm4rlSu9xk=; b=jQ2ztbBMoxRDaij/j7HehfdzZEPExYFrhOxkGj7dGXfDe+hu4jYNTIEf91XMxr80etg3jy 83OFTTimWtDORiKMxwISVgXHvIApH7/tucn+C2S0gPfUS33BGo7hQvVjeu1JScaM0DetYF 4tk1wY0x1nXWms/MnOJbYRHa3xiQVMI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-346-Y-ZUxls1MVmdDlquaqdkUQ-1; Tue, 24 Oct 2023 04:41:27 -0400 X-MC-Unique: Y-ZUxls1MVmdDlquaqdkUQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D272185AD06; Tue, 24 Oct 2023 08:41:27 +0000 (UTC) Received: from localhost (unknown [10.39.208.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A2892166B26; Tue, 24 Oct 2023 08:41:26 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Kevin Wolf , "Michael S. Tsirkin" , Fabiano Rosas , John Snow , Hanna Reitz , Leonardo Bras , Samuel Thibault , qemu-block@nongnu.org, Peter Xu , Jason Wang , Juan Quintela , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 9/9] docs/migration: reflect the changes about needed subsections Date: Tue, 24 Oct 2023 12:40:43 +0400 Message-ID: <20231024084043.2926316-10-marcandre.lureau@redhat.com> In-Reply-To: <20231024084043.2926316-1-marcandre.lureau@redhat.com> References: <20231024084043.2926316-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- docs/devel/migration.rst | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index c3e1400c0c..50f313f178 100644 --- a/docs/devel/migration.rst +++ b/docs/devel/migration.rst @@ -240,17 +240,16 @@ a newer form of device, or adding that state that you previously forgot to migrate. This is best solved using a subsection. A subsection is "like" a device vmstate, but with a particularity, it -has a Boolean function that tells if that values are needed to be sent -or not. If this functions returns false, the subsection is not sent. -Subsections have a unique name, that is looked for on the receiving -side. +has a Boolean function that tells if that values are needed or not. If +this functions returns false, the subsection is not sent. Subsections +have a unique name, that is looked for on the receiving side. On the receiving side, if we found a subsection for a device that we -don't understand, we just fail the migration. If we understand all -the subsections, then we load the state with success. There's no check -that a subsection is loaded, so a newer QEMU that knows about a subsection -can (with care) load a stream from an older QEMU that didn't send -the subsection. +don't understand, we just fail the migration. If we understand all the +subsections, then we load the state with success. There's no check +that an optional subsection is loaded, so a newer QEMU that knows +about a subsection can (with care) load a stream from an older QEMU +that didn't send the subsection. If the new data is only needed in a rare case, then the subsection can be made conditional on that case and the migration will still