From nobody Sun Sep 28 17:04:13 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756570482; cv=none; d=zohomail.com; s=zohoarc; b=l2nJWPUOR1IM1HLZBuE6/6hK6mwe3qoDy/YXwXAIHSiJi6JVUd3zrwe4xmb1uUWvror1LupOGRBsw/tEW5voJyFoUUvNlVb8pbLw6fTZz3NXPuXkV/e4iQdPuSbGwdi475prGPBwOMgHXZWh0irtOF5K3I/uGxLd3h2aDzT850Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756570482; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sFESQmOnhzZW2+hXaXl8rxhwnVtiVIyzJTwYSrM4JVM=; b=i2E+dZoG6RRZYeACV/JfgnyRiSWHOQjvoN57N86o7EYrtiySugfsQmwFHkGB+ssNk8CLktOSO3W07JpCW+aS4X1CA4tyoLdyTdhl/op0wwt52vvzjy0xYa7Q5HlZFSQr08+DmXxoePmkzLNGwgtroDpOxzTD67zFDvmNnbd+xEU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756570482452233.1331699936958; Sat, 30 Aug 2025 09:14:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usNbu-0006FL-5w; Sat, 30 Aug 2025 11:35:23 -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 1us5Ju-000508-40 for qemu-devel@nongnu.org; Fri, 29 Aug 2025 16:03:34 -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 1us5Jr-0004bv-VQ for qemu-devel@nongnu.org; Fri, 29 Aug 2025 16:03:33 -0400 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-477-ODsUMfikP9G8-Q0jL-VRdg-1; Fri, 29 Aug 2025 16:03:23 -0400 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-3235e45b815so2915478a91.0 for ; Fri, 29 Aug 2025 13:03:23 -0700 (PDT) Received: from armenon-kvm.bengluru.csb ([49.47.195.108]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-327d8f66f16sm3570543a91.0.2025.08.29.13.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Aug 2025 13:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756497811; 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=sFESQmOnhzZW2+hXaXl8rxhwnVtiVIyzJTwYSrM4JVM=; b=bxT+r/Q9d3I+4bWSV7dCe18omnGNUejgiz9Ef+gKLy7wKPHEaVYXHDb1PwZpzQombTJESW CaPP0L5UuxJrlBkS/jZv6GpqBKJNkU63Q5ktpBxz97i1bi9vQX+bawP5E9R+YXIFL36p/x 27QKV3DnURMopoyBrRq+ZpKgyC1pPeY= X-MC-Unique: ODsUMfikP9G8-Q0jL-VRdg-1 X-Mimecast-MFC-AGG-ID: ODsUMfikP9G8-Q0jL-VRdg_1756497802 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756497802; x=1757102602; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sFESQmOnhzZW2+hXaXl8rxhwnVtiVIyzJTwYSrM4JVM=; b=H0rLC8HYcFlOJP7XwHyCS/KFFVywd5mBylKEd89sYQf1NmcCeGVEYGXucGKkpw06S8 CVN22XSfyfvvCF5JhkIm2K6K8yyKG5nWj9N2geo9AuNpOoI/ug03BL4/u9nbxMp2RL0u keFtkOBcmoXxh0m/7VYPSP1ZgRaC3vBxsjNVmac8lLjvkhEj/hWht+TRci65/9M4u3dD LH2HHdstKAkopTGILeQbZ0faK3oD270bVk7qquBTlQB+lfN+QkNzQComzoMnH4vR/pob +yfqObPGmyAY4ivBwpg3DZyeq9f/fU6kBdz+p39BLMc3cOtY3ss6eqzyNH2zkOWKDQZL oxuA== X-Gm-Message-State: AOJu0YyAInaKtToC3Qx0KGMN2wleBSNIEkGi+l62XETUAuNrG7JXIVSv 7SnzWkugK4NMJVWZUVRJnrh0vPQwTqgxDHBPNvRQayKO2bDXbNZv2tN7K8t4nZHOKRc038kZNIT ++WIoTNiUZpRc7qYA9ihXEq2uDEqd9puHnYk24MyY+y0saBI/r2Y7E4Oo X-Gm-Gg: ASbGncuLOD16T6z+5FfGP70bcLNNwAxFzNkEI2ensCUeoVdMvAqbYHEHx2VkFTcd0Bs gRwBIWqrUD+PPxsHCdQqfk590XmE1vzwneuPQijpeoIg0AKdEXvxVyjDlUzjSHDSZtb/eAdFQvg l/6nwmjjjKDQY/msEcXlhqa7h4KDxJUVkh9uPHvWDprzo+DBIf2KRU3fM+TzKrqtYrcUi3Xmy4H vC2fyJbyXMtUGTBAYlSuIW+ZwDIvDCdJjmzD5vTiVwsWYTKSFaLJ4fu9lZAJaiR+QIvg9yZz7ge zXd+bGiQrxNz0aKBroe5VPfdDPclg3qRLdTl7boQOM4BMyEMrQ6svQ== X-Received: by 2002:a17:90b:5623:b0:327:531b:b85c with SMTP id 98e67ed59e1d1-327531bbae0mr20325789a91.35.1756497802090; Fri, 29 Aug 2025 13:03:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8A8uS0uqOelXhs9DBp6fb5ZkfvkmxeLH2gvetngK75nnlCPkyySJrntUu8N1qe1W2sPzaNQ== X-Received: by 2002:a17:90b:5623:b0:327:531b:b85c with SMTP id 98e67ed59e1d1-327531bbae0mr20325744a91.35.1756497801696; Fri, 29 Aug 2025 13:03:21 -0700 (PDT) From: Arun Menon Date: Sat, 30 Aug 2025 01:31:44 +0530 Subject: [PATCH v13 04/27] migration: push Error **errp into vmstate_load() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250830-propagate_tpm_error-v13-4-a4e777b7eb2c@redhat.com> References: <20250830-propagate_tpm_error-v13-0-a4e777b7eb2c@redhat.com> In-Reply-To: <20250830-propagate_tpm_error-v13-0-a4e777b7eb2c@redhat.com> To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , =?utf-8?q?Alex_Benn=C3=A9e?= , Akihiko Odaki , Dmitry Osipenko , "Michael S. Tsirkin" , Marcel Apfelbaum , Cornelia Huck , Halil Pasic , Eric Farman , Thomas Huth , Christian Borntraeger , Matthew Rosato , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Nicholas Piggin , Harsh Prateek Bora , Paolo Bonzini , Fam Zheng , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Steve Sistare , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Hailiang Zhang , Stefan Berger , Peter Maydell , qemu-arm@nongnu.org, Arun Menon X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3264; i=armenon@redhat.com; h=from:subject:message-id; bh=XNWOL0PRpe00C/2zRFfhJytxVRezN65+i4XThQwPhbg=; b=owGbwMvMwCWWVaVqcZPfqI/xtFoSQ8Ymdp8J1vnT36vJ8F/ZU2R5qqSq2uNau8f1GUvTFdVSr ntwFBR0lLIwiHExyIopsjR8DZBtCiiMiLR9eR1mDisTyBAGLk4BmMh9M4b/sVea6pJ+LmpLftjj pBQ5KdatfYePs4y4Xyz/Ol+fS9a+DP8LWoufT+STe/mxrUucc0pQXdW2ou6v/8WTRb6WhUfYS7I CAA== X-Developer-Key: i=armenon@redhat.com; a=openpgp; fpr=80F5501D82507158593DE9D76A7A2538D90F328E 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=armenon@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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756570483698116600 This is an incremental step in converting vmstate loading code to report error via Error objects instead of directly printing it to console/monitor. It is ensured that vmstate_load() must report an error in errp, in case of failure. The errors are temporarily reported using error_report_err(). This is removed in the subsequent patches in this series when we are actually able to propagate the error to the calling function. Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Fabiano Rosas Signed-off-by: Arun Menon --- migration/savevm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 0c445a957fc99f826e6753ed3795bcdd51f1e3f5..40dae406db22dc9ddbff2f5ada9= 2a32626b58e3b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -963,14 +963,20 @@ void vmstate_unregister(VMStateIf *obj, const VMState= Description *vmsd, } } =20 -static int vmstate_load(QEMUFile *f, SaveStateEntry *se) +static int vmstate_load(QEMUFile *f, SaveStateEntry *se, Error **errp) { + int ret; trace_vmstate_load(se->idstr, se->vmsd ? se->vmsd->name : "(old)"); if (!se->vmsd) { /* Old style */ - return se->ops->load_state(f, se->opaque, se->load_version_id); + ret =3D se->ops->load_state(f, se->opaque, se->load_version_id); + if (ret < 0) { + error_setg(errp, "Failed to load vmstate version_id: %d, ret: = %d", + se->load_version_id, ret); + } + return ret; } return vmstate_load_state(f, se->vmsd, se->opaque, se->load_version_id, - &error_fatal); + errp); } =20 static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, @@ -2692,6 +2698,7 @@ qemu_loadvm_section_start_full(QEMUFile *f, uint8_t t= ype) SaveStateEntry *se; char idstr[256]; int ret; + Error *local_err =3D NULL; =20 /* Read section start */ section_id =3D qemu_get_be32(f); @@ -2741,10 +2748,11 @@ qemu_loadvm_section_start_full(QEMUFile *f, uint8_t= type) start_ts =3D qemu_clock_get_us(QEMU_CLOCK_REALTIME); } =20 - ret =3D vmstate_load(f, se); + ret =3D vmstate_load(f, se, &local_err); if (ret < 0) { error_report("error while loading state for instance 0x%"PRIx32" o= f" " device '%s'", instance_id, idstr); + error_report_err(local_err); return ret; } =20 @@ -2769,6 +2777,7 @@ qemu_loadvm_section_part_end(QEMUFile *f, uint8_t typ= e) uint32_t section_id; SaveStateEntry *se; int ret; + Error *local_err =3D NULL; =20 section_id =3D qemu_get_be32(f); =20 @@ -2794,10 +2803,9 @@ qemu_loadvm_section_part_end(QEMUFile *f, uint8_t ty= pe) start_ts =3D qemu_clock_get_us(QEMU_CLOCK_REALTIME); } =20 - ret =3D vmstate_load(f, se); + ret =3D vmstate_load(f, se, &local_err); if (ret < 0) { - error_report("error while loading state section id %d(%s)", - section_id, se->idstr); + error_report_err(local_err); return ret; } =20 --=20 2.51.0