From nobody Sat Nov 15 00:06:07 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=1759206522; cv=none; d=zohomail.com; s=zohoarc; b=QN5aBoyVs/Zl8uPOM20wRcyvN5Prk+DegBGiltmp8DVRtuaTpExBTo1VWNK/xxMVjzDv1C7n261nJ/JSEC7W5JgxJBM6WRWLLuHPNr15UdE3f7ceOvBAlsZwVWQsvA1loCfooComIIJd3w+z1yRfPBE6Vt29dqtwxenNwEIybHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759206522; 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=8sWMcebPJELAlAAoxkMwEbCrmASRccS7MWf2yvwqa0o=; b=DBZNr+j/nPpVZI4azb8hLAfFYg4Sa83SsN8Fj+Bh4FJReUY7FQxcGBITKXiTv1x39QZLtE2clQrBvTBBjABAripYgqToDCrFNoibB3IEHBWaFlzZTizPzJdeWql8rXlUVb7pF8/BfBPPgUNuMUx/qW+ob+BsJa0j5YvpqF7++A8= 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 1759206522867119.76108647471574; Mon, 29 Sep 2025 21:28:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v3RrW-00051z-Rf; Tue, 30 Sep 2025 00:21:15 -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 1v3RrP-0004zZ-UD for qemu-devel@nongnu.org; Tue, 30 Sep 2025 00:21:08 -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 1v3RrI-0002wh-Q3 for qemu-devel@nongnu.org; Tue, 30 Sep 2025 00:21:07 -0400 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-Ayf7yAJlPOS2JonUKNkA5Q-1; Tue, 30 Sep 2025 00:20:52 -0400 Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-b55397041dbso7279166a12.2 for ; Mon, 29 Sep 2025 21:20:52 -0700 (PDT) Received: from armenon-kvm.bengluru.csb ([49.36.108.92]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b57c55a339dsm12534158a12.40.2025.09.29.21.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Sep 2025 21:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759206054; 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=8sWMcebPJELAlAAoxkMwEbCrmASRccS7MWf2yvwqa0o=; b=GhGF+Y6v2Tl5YS/kOgiuTuo/zvVNUzpR6tukc2OcT/cI85r3TYHaiOL5LfCW8uTNb5FkM+ RxpRLnMch1IB03/AT88orhKjaCGfvNQjYctApbRXKV0cgHxuaIZzjN51vnYgvxgxSgeubo ILDbJziGyRviTmnQs3l1I1XzFH0YUhM= X-MC-Unique: Ayf7yAJlPOS2JonUKNkA5Q-1 X-Mimecast-MFC-AGG-ID: Ayf7yAJlPOS2JonUKNkA5Q_1759206051 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759206051; x=1759810851; 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=8sWMcebPJELAlAAoxkMwEbCrmASRccS7MWf2yvwqa0o=; b=R9dYE9b2D7foJTXmklqLcI83PArjsMw8aVK4J5Uirsh6zwxkyL/nlPakD4aHPzlShG NaqWJ96akm3yJLtyjG0ES70w/8dBU3aH73tAxMtQIHfY/5es98C8fRUnYm6JrKrVNFmZ EFV+45tYRQ8QATeDLoRQkLGyUP9YE2s3lHSf/Dc8dGHEXHcZYcHhMTfeZuQs135K5lQD kM0ugzEPwll/Viq//5HZRzTjO2MOkV2IvPeEplEoJ8XmyW6lhjvIgPy/MWVF5sg3zOvG y5wn0S03gFXZJ7/z8Lw/MvXqCCHjZyGcrSDAJzBvPeU3FF+uHurl34gjkZMCYFJ5KB6t SJnA== X-Gm-Message-State: AOJu0Yzpa0Gpnx4V89GEr/YCzYK9LxDGuvdpFlww8X8Kdpxg75o9T/7T M6S6jQNxp/tZtKaZ6XY6psh+MnvlOmX6V9lLkg4tSEH5lQQerBgNAAseKo1rWjaZ8EKfa/P6gyn rd6nbQPGSKjl762MMR8anM6BGuyyeq+Ef4amDmcy66txGy+dDVYqdby7m X-Gm-Gg: ASbGncv+cnr0DDK5Iq25mGB2L+Sj1FzPZcNTU0l4lHDzr75yYppdKXHPq2oupjt5t9b nUWQd99u7wmrHYgCIe0PbQ7R9eH1VmpLmurJuY5Yw951ReSjBKkECBq/U29ZPSsayoJliJqsHrX ZpRau01Wv/s3MBo18qDOXfE4+wtXoe2vJ2/b4qJlZRZCQA022ChcBDbyGdZw0Zq3dBZ6wbJr23Q cP7/VxpkDVmjGF8INh/7HYXLTUwSXLSIw5avaf2JI3ptZey63971p0Bgk6yb7hCLNMyWxfgk/Sm 7+amOO5Zljv0MxtUHhq3U39Vyyl4+tta6cRowYZZKLi0gSFvBhDZNXTk7Q== X-Received: by 2002:a05:6a20:a11c:b0:2f9:dc8d:d2a2 with SMTP id adf61e73a8af0-2f9dc8dd60emr17132453637.2.1759206051199; Mon, 29 Sep 2025 21:20:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG99ort9d0mYRhWnvmY06q9sN2iau68DXEhhR0gFxsGwB/RPVRnjR5M7zh+0Io8poted7kArw== X-Received: by 2002:a05:6a20:a11c:b0:2f9:dc8d:d2a2 with SMTP id adf61e73a8af0-2f9dc8dd60emr17132421637.2.1759206050771; Mon, 29 Sep 2025 21:20:50 -0700 (PDT) From: Arun Menon Date: Tue, 30 Sep 2025 09:48:23 +0530 Subject: [PATCH v15 14/26] migration: push Error **errp into ram_postcopy_incoming_init() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250930-propagate_tpm_error-v15-14-84afd3af1e47@redhat.com> References: <20250930-propagate_tpm_error-v15-0-84afd3af1e47@redhat.com> In-Reply-To: <20250930-propagate_tpm_error-v15-0-84afd3af1e47@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=4909; i=armenon@redhat.com; h=from:subject:message-id; bh=+86rb+2n+UvHqo2/Gvfyw5xqR64fl6H2vw4i4a2ZU7g=; b=owGbwMvMwCWWVaVqcZPfqI/xtFoSQ8btKMH5PytOX5mv2Jic9qpevfD3o/dfGf9NSrF+8+h5m RD/6pnCHaUsDGJcDLJiiiwNXwNkmwIKIyJtX16HmcPKBDKEgYtTACbiL8/IsM+yZLnoShHXpfuv yenfP+OUEvZEl93n2t8k3wTz0+e4Khj+it79aJwXfuQb420O7bc+Wz0ZVfbP+JQQOklGpnuOY6M tMwA= 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.133.124; envelope-from=armenon@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.513, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 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: 1759206523936116600 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 ram_postcopy_incoming_init() must report an error in errp, in case of failure. Reviewed-by: Fabiano Rosas Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: Fabiano Rosas Reviewed-by: Akihiko Odaki Signed-off-by: Arun Menon --- migration/postcopy-ram.c | 9 ++++++--- migration/postcopy-ram.h | 2 +- migration/ram.c | 4 ++-- migration/ram.h | 2 +- migration/savevm.c | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 01721723434d5605fe7a5e400a4c7a709e6e8b2b..5471efb4f01355b7e400aec70d9= acccda879e0ec 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -681,6 +681,7 @@ out: */ static int init_range(RAMBlock *rb, void *opaque) { + Error **errp =3D opaque; const char *block_name =3D qemu_ram_get_idstr(rb); void *host_addr =3D qemu_ram_get_host_addr(rb); ram_addr_t offset =3D qemu_ram_get_offset(rb); @@ -701,6 +702,8 @@ static int init_range(RAMBlock *rb, void *opaque) * (Precopy will just overwrite this data, so doesn't need the discard) */ if (ram_discard_range(block_name, 0, length)) { + error_setg(errp, "failed to discard RAM block %s len=3D%zu", + block_name, length); return -1; } =20 @@ -749,9 +752,9 @@ static int cleanup_range(RAMBlock *rb, void *opaque) * postcopy later; must be called prior to any precopy. * called from arch_init's similarly named ram_postcopy_incoming_init */ -int postcopy_ram_incoming_init(MigrationIncomingState *mis) +int postcopy_ram_incoming_init(MigrationIncomingState *mis, Error **errp) { - if (foreach_not_ignored_block(init_range, NULL)) { + if (foreach_not_ignored_block(init_range, errp)) { return -1; } =20 @@ -1703,7 +1706,7 @@ bool postcopy_ram_supported_by_host(MigrationIncoming= State *mis, Error **errp) return false; } =20 -int postcopy_ram_incoming_init(MigrationIncomingState *mis) +int postcopy_ram_incoming_init(MigrationIncomingState *mis, Error **errp) { error_report("postcopy_ram_incoming_init: No OS support"); return -1; diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 3852141d7e37ab18bada4b46c137fef0969d0070..ca19433b246893fa5105bcebffb= 442c58a9a4f48 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -30,7 +30,7 @@ int postcopy_ram_incoming_setup(MigrationIncomingState *m= is); * postcopy later; must be called prior to any precopy. * called from ram.c's similarly named ram_postcopy_incoming_init */ -int postcopy_ram_incoming_init(MigrationIncomingState *mis); +int postcopy_ram_incoming_init(MigrationIncomingState *mis, Error **errp); =20 /* * At the end of a migration where postcopy_ram_incoming_init was called. diff --git a/migration/ram.c b/migration/ram.c index 7208bc114fb5c366740db380ee6956a91b3871a0..6a0dcc04f436524a37672c41c38= f201f06773374 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3716,9 +3716,9 @@ static int ram_load_cleanup(void *opaque) * postcopy-ram. postcopy-ram's similarly names * postcopy_ram_incoming_init does the work. */ -int ram_postcopy_incoming_init(MigrationIncomingState *mis) +int ram_postcopy_incoming_init(MigrationIncomingState *mis, Error **errp) { - return postcopy_ram_incoming_init(mis); + return postcopy_ram_incoming_init(mis, errp); } =20 /** diff --git a/migration/ram.h b/migration/ram.h index 921c39a2c5c45bc2344be80854c46e4c10c09aeb..275709a99187f9429ccb4111e05= 281ec268ba0db 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -86,7 +86,7 @@ void ram_postcopy_migrated_memory_release(MigrationState = *ms); void ram_postcopy_send_discard_bitmap(MigrationState *ms); /* For incoming postcopy discard */ int ram_discard_range(const char *block_name, uint64_t start, size_t lengt= h); -int ram_postcopy_incoming_init(MigrationIncomingState *mis); +int ram_postcopy_incoming_init(MigrationIncomingState *mis, Error **errp); int ram_load_postcopy(QEMUFile *f, int channel); =20 void ram_handle_zero(void *host, uint64_t size); diff --git a/migration/savevm.c b/migration/savevm.c index d145e7b1e55942fbcca57cc309327958526a6514..338d1a9756a991ace0a54f80b10= 03df33f141264 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1989,7 +1989,7 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis, return -1; } =20 - if (ram_postcopy_incoming_init(mis)) { + if (ram_postcopy_incoming_init(mis, NULL) < 0) { return -1; } =20 --=20 2.51.0