From nobody Sat May 18 09:48:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695744207; cv=none; d=zohomail.com; s=zohoarc; b=BqgdIAXiWcwni0Kpr9G4NxlZMT5Y2qAq2Q7o/4pR7KMqZa4Irr6B6JODJfU1CKGW1GFy4WP60kdZTNVwdnOCGN3P4ymjUOmf1mdJoCQj4Ow2+t+whqLU86B/ffsl6djpj+rIQQRnMNuj1gLSyB9gVVt4BbdGUx+/4CivcTDD+yU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695744207; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HFJfX2UbdUONwAiwbnWDg/Z2Ma5pzUtKmwKBZ6J1/3g=; b=DO7E4j2bHEWJTWKXPWSDRrWMo3hPmT+C6jwVviZmM103+GRLw/8uKrcpLPQNPi9f+iFKIaafxFSTYFbbrHXvGwZicyhoAy3c7rfmDrDaD8KvOlM0MkQ7GWepgkzG3htjP34gZwcsccm5AuRqEURTQrcImsIfREr1cQ4vNvC90fY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695744207747198.30850031886746; Tue, 26 Sep 2023 09:03:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlATN-0000Kg-PW; Tue, 26 Sep 2023 11:59: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 1qlATM-0000K9-35 for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:40 -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 1qlATK-0007xd-M1 for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:39 -0400 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-557-2Kg--Pc9M5ubWj_FSorSdQ-1; Tue, 26 Sep 2023 11:59:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 17113801FA9; Tue, 26 Sep 2023 15:59:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C7CC40C6EA8; Tue, 26 Sep 2023 15:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695743978; 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=OFEMX1HPIY5h+HfI80wr4PIbU/pveu+y7+9Sbw31xPnAFgTpyL9N2aIafAO+27LH9SSCvB l6SLc4U4bo6u1Oqvzvtn0mMa5dLzZ+AmTJzlFlTr+FGbZvndqkLZOeNe7lwyQFKiwR+6oT dKJdZugUkMFm73Rk5jW7nSQpIKZa1Xo= X-MC-Unique: 2Kg--Pc9M5ubWj_FSorSdQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Samuel Thibault , qemu-block@nongnu.org, Jason Wang , Juan Quintela , Leonardo Bras , Kevin Wolf , John Snow , Peter Xu , Hanna Reitz , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 1/5] block/fdc: 'phase' is not needed on load Date: Tue, 26 Sep 2023 19:59:21 +0400 Message-ID: <20230926155925.1396309-2-marcandre.lureau@redhat.com> In-Reply-To: <20230926155925.1396309-1-marcandre.lureau@redhat.com> References: <20230926155925.1396309-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695744209519100002 From: Marc-Andr=C3=A9 Lureau It is reconstructed during fdc_post_load() Signed-off-by: Marc-Andr=C3=A9 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 =3D opaque; =20 + /* not needed on load */ + if (fdctrl->phase =3D=3D FD_PHASE_RECONSTRUCT) { + return false; + } + return reconstruct_phase(fdctrl) !=3D fdctrl->phase; } =20 --=20 2.41.0 From nobody Sat May 18 09:48:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695744143; cv=none; d=zohomail.com; s=zohoarc; b=O6/UFUveDgGY2UWyASaqeNN+EObt9K/0kz7LM+kfCxIoMw3kGMDHkE4tjKBSmSKG5nmTTuCRg/hA3liuGTUCQ2OLuAV2mL/Rvq00wngzGbFQez9XGgLCiYfFGOeokneTZaTTWpCeRdT0rLgZK5LqQ1yKaZp2qCDFnlZMfmAVoEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695744143; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LDYtvTpJk+kmmrR0pPynL0TYDylRwkFz4JQBVHyfBos=; b=Jz1RC7AC6MpAIpMuXKurPXeFot/3kZ9yZxOyiXFGcsiJIbiamxPn+P2uWzFutGyWhcWjZTf5JFTrl5Kpd5uLVyloLGM4XDvAAPm/hFn0TU3kdnD9KpvO9otDKUQG5nsS8nc3t0LnUbvZhTrDlF4P2lCFnSiSK/YOCj7XegTF7mo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695744143233747.512482602822; Tue, 26 Sep 2023 09:02:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlATT-0000Mu-VJ; Tue, 26 Sep 2023 11:59:47 -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 1qlATS-0000Lx-2f for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:46 -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 1qlATP-0007yI-RJ for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:44 -0400 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-43-Kpa8e1JPNv-HH_MGe7xiuA-1; Tue, 26 Sep 2023 11:59:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 64EA9811E88; Tue, 26 Sep 2023 15:59:38 +0000 (UTC) Received: from localhost (unknown [10.39.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A853340C6E77; Tue, 26 Sep 2023 15:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695743983; 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=LDYtvTpJk+kmmrR0pPynL0TYDylRwkFz4JQBVHyfBos=; b=gfZG4EwAzYL+c/DsU794K/loSCZo2ht1wAwKt33jC6q3AU1nuqiClHrftQ1Fnyo9iN51uY kFlg1D21ZQVA2DUZQ9EU94tv/GB/Z9CjVtXHCrXm1C3/IUSSIz3w0IglPKOzxv6wsBi5A8 nCcWOsIFcKqFgiJbvT9Isq6HP3IjXgg= X-MC-Unique: Kpa8e1JPNv-HH_MGe7xiuA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Samuel Thibault , qemu-block@nongnu.org, Jason Wang , Juan Quintela , Leonardo Bras , Kevin Wolf , John Snow , Peter Xu , Hanna Reitz , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 2/5] virtio: make endian_needed() work during loading Date: Tue, 26 Sep 2023 19:59:22 +0400 Message-ID: <20230926155925.1396309-3-marcandre.lureau@redhat.com> In-Reply-To: <20230926155925.1396309-1-marcandre.lureau@redhat.com> References: <20230926155925.1396309-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695744144567100007 From: Marc-Andr=C3=A9 Lureau There is no simple way to distinguish when the callback is used for load or save, AFAICT. Signed-off-by: Marc-Andr=C3=A9 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 4577f3f5b3..7e77e66e99 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2487,7 +2487,11 @@ static bool virtio_device_endian_needed(void *opaque) { VirtIODevice *vdev =3D opaque; =20 - assert(vdev->device_endian !=3D VIRTIO_DEVICE_ENDIAN_UNKNOWN); + /* On load, endian is UNKNOWN */ + if (vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_UNKNOWN) { + return false; + } + if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { return vdev->device_endian !=3D virtio_default_endian(); } --=20 2.41.0 From nobody Sat May 18 09:48:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695744112; cv=none; d=zohomail.com; s=zohoarc; b=ltCsR/92WvJGVo3amiKrZhUEBSQMIFmUimzJGbK28SQ1fmRywdoxurW64izHBGbdt8rqyMaglUWNaOrHYxddLNCHil+BkdwnFJOR9bm8e4QrpRTXmpAIXvdssfGzXEkO2L8dn+kRTLric2wXUuICj3qPH5duZY1fgEbz5IGKVxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695744112; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BS4K4hPt4nte3fTZb5lBi+CHvfoDZl40p9U7Y5fbyOg=; b=gzCzsKBDz54iHM0M8KRzL65h5tX1vZepTDATfbps8qH+vyNEzYI2WeBonsgcq8ooVxX3VIYurFGDDZCa37Lv5Hh6aAF7yzMUOYkR/LFpUdGGjuPWDPJ6ARxytBxfMrqAJdUQ2JUZDyov69ppAfcfiGTtMifuUWXfVy8hici8K6s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695744112767397.16204267854584; Tue, 26 Sep 2023 09:01:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlATW-0000PA-Ft; Tue, 26 Sep 2023 11:59:50 -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 1qlATV-0000NC-9d for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:49 -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 1qlATT-0007yu-U4 for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:49 -0400 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-696-RClVKGm0MaWie-BK3RONYw-1; Tue, 26 Sep 2023 11:59:43 -0400 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 7E118811E7B; Tue, 26 Sep 2023 15:59:42 +0000 (UTC) Received: from localhost (unknown [10.39.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74AFA51E3; Tue, 26 Sep 2023 15:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695743986; 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=cAz19g47z1dn6ImLeB2SQG873vb8KikrtMxlPXLDPoLUYz5xzayrqrYusiQdEP36qfaKsi xUfBqiv7j8vzKebXhE9Hmxu92s7YhP+y2SxXNWLhdzJOTY5YvvQl6M+QPsxP+u/mBT9NvK rPiaXa8f/AhMY2wHKReQ6cRh/ns+FOo= X-MC-Unique: RClVKGm0MaWie-BK3RONYw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Samuel Thibault , qemu-block@nongnu.org, Jason Wang , Juan Quintela , Leonardo Bras , Kevin Wolf , John Snow , Peter Xu , Hanna Reitz , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 3/5] net/slirp: use different IDs for each instance Date: Tue, 26 Sep 2023 19:59:23 +0400 Message-ID: <20230926155925.1396309-4-marcandre.lureau@redhat.com> In-Reply-To: <20230926155925.1396309-1-marcandre.lureau@redhat.com> References: <20230926155925.1396309-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695744114756100003 From: Marc-Andr=C3=A9 Lureau Using always 0, QEMU will end up loading the same instance, even if multiple have been saved. Signed-off-by: Marc-Andr=C3=A9 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" =20 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 c= har *model, * specific version? */ g_assert(slirp_state_version() =3D=3D 4); - register_savevm_live("slirp", 0, slirp_state_version(), + register_savevm_live("slirp", VMSTATE_INSTANCE_ID_ANY, slirp_state_ver= sion(), &savevm_slirp_state, s->slirp); =20 s->poll_notifier.notify =3D net_slirp_poll_notify; --=20 2.41.0 From nobody Sat May 18 09:48:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695744026; cv=none; d=zohomail.com; s=zohoarc; b=ihKrFPTJvc4umt2aoSOiaOMX5yLRrVUN2VPwgnUEAmvN7UJ11J/Qoc+KRAdxLxvASZxkth7RfLHWCFRXwdo+40NSjd+wkAikB7Nj9gYMjtlmJ3UdeVFF5eyKL7nC+MGVbxqedzPzFqQT2STfG/5Ta1AT9ssYOUKz/lTmnCW4X4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695744026; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=420sJXRf3fQ/UcPXLnCN0vEy2RSMbyqEMfQ2NFn4vT4=; b=KKH4l+BlNMFb+vOQfb40qjIEF/XAo9N/G2BQGsq9itNHmbv996wVpAtEo0PMFFJ0GluDjvVGcyyF9BiIVRKV+nxJFrzRIzBZlli0ry9ffLhBprmiuZ2rwDBeOB4RY//IIPTAlcX28s0MVxAud8fFKIybqbyTxFSk3OVJZ5fK4A8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695744026661471.89401644816905; Tue, 26 Sep 2023 09:00:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlATZ-0000kl-Fg; Tue, 26 Sep 2023 11:59:53 -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 1qlATY-0000fd-F2 for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:52 -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 1qlATX-000802-2O for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:52 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-308-9Bl_ghs8Ny6c-qIwfOtOYg-1; Tue, 26 Sep 2023 11:59:46 -0400 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 7ED383C23FD0; Tue, 26 Sep 2023 15:59:46 +0000 (UTC) Received: from localhost (unknown [10.39.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDC452156702; Tue, 26 Sep 2023 15:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695743990; 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=420sJXRf3fQ/UcPXLnCN0vEy2RSMbyqEMfQ2NFn4vT4=; b=avPIylrATErwteJZ6uH1dMezusSVBF06m5KgtOIY5ZgUK2i3RJAeGnr+KubQYQLHeWdbf7 zN7QXQAQI8Mjv+utlRx7z/HZQyiN9XNLWco99E5a8KN9i8F0/acWnwrdlumC6UeQVvQARj ooXEfmBvMx4n8yIzBUTnH3zPK3knw5w= X-MC-Unique: 9Bl_ghs8Ny6c-qIwfOtOYg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Samuel Thibault , qemu-block@nongnu.org, Jason Wang , Juan Quintela , Leonardo Bras , Kevin Wolf , John Snow , Peter Xu , Hanna Reitz , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 4/5] RFC: migration: check required subsections are loaded, once Date: Tue, 26 Sep 2023 19:59:24 +0400 Message-ID: <20230926155925.1396309-5-marcandre.lureau@redhat.com> In-Reply-To: <20230926155925.1396309-1-marcandre.lureau@redhat.com> References: <20230926155925.1396309-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695744027861100001 From: Marc-Andr=C3=A9 Lureau Check that required subsections have been loaded. Signed-off-by: Marc-Andr=C3=A9 Lureau --- migration/vmstate.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index 31842c3afb..5147a8191d 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -426,22 +426,51 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDe= scription *vmsd, } =20 static const VMStateDescription * -vmstate_get_subsection(const VMStateDescription **sub, char *idstr) +vmstate_get_subsection(const VMStateDescription **sub, char *idstr, bool *= visited) { + size_t i =3D 0; + while (sub && *sub) { if (strcmp(idstr, (*sub)->name) =3D=3D 0) { + if (visited[i]) { + return NULL; + } + visited[i] =3D true; return *sub; } + i++; sub++; } return NULL; } =20 +static size_t +vmstate_get_n_subsections(const VMStateDescription **sub) +{ + size_t n =3D 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 =3D NULL; + trace_vmstate_subsection_load(vmsd->name); =20 + n =3D vmstate_get_n_subsections(vmsd->subsections); + visited =3D g_new0(bool, n); + while (qemu_peek_byte(f, 0) =3D=3D QEMU_VM_SUBSECTION) { char idstr[256], *idstr_ret; int ret; @@ -467,7 +496,7 @@ static int vmstate_subsection_load(QEMUFile *f, const V= MStateDescription *vmsd, /* it doesn't have a valid subsection name */ return 0; } - sub_vmsd =3D vmstate_get_subsection(vmsd->subsections, idstr); + sub_vmsd =3D vmstate_get_subsection(vmsd->subsections, idstr, visi= ted); if (sub_vmsd =3D=3D NULL) { trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(lookup)= "); return -ENOENT; @@ -484,6 +513,13 @@ static int vmstate_subsection_load(QEMUFile *f, const = VMStateDescription *vmsd, } } =20 + for (i =3D 0; i < n; i++) { + if (!visited[i] && vmstate_save_needed(vmsd->subsections[i], opaqu= e)) { + trace_vmstate_subsection_load_bad(vmsd->name, vmsd->subsection= s[i]->name, "(not visited)"); + return -ENOENT; + } + } + trace_vmstate_subsection_load_good(vmsd->name); return 0; } --=20 2.41.0 From nobody Sat May 18 09:48:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695744143; cv=none; d=zohomail.com; s=zohoarc; b=JQiPr5b1YT8VcjEY9ahJ9IYzTSrEej7hdT+kw95lsZN9/1KN5Sluo1iMFLFv+TK0VL1OJ+2wiuBMCvhqiavBbnXD4HML3f5YynSR2g/fFt+nG6K9cPf1AQIl8xXYvONfDdgKmdmnLYWf1/lws+3gWemK5gz5GfA+ECNKgGMehPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695744143; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VZkf53Aba5z/edFlTgY8x01NMPUo1KjmUdwQvCtIJ4I=; b=OuTHHknu2lbHyC37ZP54bpCbg2fssqOIKs8HBw2+DRSzO/t8PWLiuygGDNkYnvps1wpTLEgp0Eks+IA9UbCCevLPfsjyypT0PUruzjMvDdv+YRAo1nlWiAJHIaBbLLLNp9XhId675exVLwW/3LjLXhCQN1HJ8xgefq79W7Y/ZtY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169574414323195.98551374696126; Tue, 26 Sep 2023 09:02:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlATc-0000nc-1J; Tue, 26 Sep 2023 11:59:56 -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 1qlATa-0000lB-EQ for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:54 -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 1qlATY-00080Q-TW for qemu-devel@nongnu.org; Tue, 26 Sep 2023 11:59:54 -0400 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-390-7CP5MYWoOYWJ6fO3btcMxw-1; Tue, 26 Sep 2023 11:59:50 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 29F1E101A58B; Tue, 26 Sep 2023 15:59:50 +0000 (UTC) Received: from localhost (unknown [10.39.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CC65492C37; Tue, 26 Sep 2023 15:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695743992; 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=VZkf53Aba5z/edFlTgY8x01NMPUo1KjmUdwQvCtIJ4I=; b=RJp/lhQ+ogs+YsSQyuKN7mIML5L9xTDLwuNT9Dk4NOwb+oD0ItPsyYJPFfxHqL2XMA25SE LirT9vgXjgMfwj02H70MJ8k76KDtcEaFnJal189wU5WUtCzLdZxMVjz0zkAw3nmJcTWwTE IKCZag/DafRUN90za1g6sLOmq+fLFoQ= X-MC-Unique: 7CP5MYWoOYWJ6fO3btcMxw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Samuel Thibault , qemu-block@nongnu.org, Jason Wang , Juan Quintela , Leonardo Bras , Kevin Wolf , John Snow , Peter Xu , Hanna Reitz , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 5/5] RFC: migration: check required entries are loaded, once Date: Tue, 26 Sep 2023 19:59:25 +0400 Message-ID: <20230926155925.1396309-6-marcandre.lureau@redhat.com> In-Reply-To: <20230926155925.1396309-1-marcandre.lureau@redhat.com> References: <20230926155925.1396309-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695744143761100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- migration/savevm.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index bb3e99194c..6a17bb0f73 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; =20 typedef struct SaveState { @@ -1718,6 +1719,36 @@ int qemu_save_device_state(QEMUFile *f) return qemu_file_get_error(f); } =20 +static void savevm_reset_visited(void) +{ + SaveStateEntry *se; + + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + se->visited =3D 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->opaqu= e)) { + continue; + } + if (se->vmsd && !vmstate_save_needed(se->vmsd, se->opaque)) { + continue; + } + if (!se->visited) { + error_setg(errp, "Missing entry '%s' while loading VM", se->id= str); + return false; + } + } + + return true; +} + + static SaveStateEntry *find_se(const char *idstr, uint32_t instance_id) { SaveStateEntry *se; @@ -2520,6 +2551,11 @@ qemu_loadvm_section_start_full(QEMUFile *f, Migratio= nIncomingState *mis) idstr, instance_id); return -EINVAL; } + if (se->visited) { + error_report("error while loading state for instance 0x%"PRIx32" o= f" + " device '%s'", instance_id, idstr); + return -EINVAL; + } =20 /* Validate version */ if (version_id > se->version_id) { @@ -2546,6 +2582,8 @@ qemu_loadvm_section_start_full(QEMUFile *f, Migration= IncomingState *mis) return -EINVAL; } =20 + se->visited =3D true; + return 0; } =20 @@ -2852,7 +2890,12 @@ int qemu_loadvm_state(QEMUFile *f) =20 cpu_synchronize_all_pre_loadvm(); =20 + savevm_reset_visited(); ret =3D 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); =20 trace_qemu_loadvm_state_post_main(ret); --=20 2.41.0