From nobody Tue Nov 26 08:55:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709732276798630.1803892871021; Wed, 6 Mar 2024 05:37:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhrRD-0000sO-0D; Wed, 06 Mar 2024 08:36:03 -0500 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 1rhrRA-0000mC-Pj for qemu-devel@nongnu.org; Wed, 06 Mar 2024 08:36:01 -0500 Received: from gandalf.ozlabs.org ([150.107.74.76]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhrR8-0006BD-HN for qemu-devel@nongnu.org; Wed, 06 Mar 2024 08:36:00 -0500 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4TqYNX3VJYz4wyy; Thu, 7 Mar 2024 00:35:56 +1100 (AEDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4TqYNT1qtsz4wcF; Thu, 7 Mar 2024 00:35:52 +1100 (AEDT) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Alex Williamson , Avihai Horon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Prasad Pandit , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v4 15/25] migration: Modify ram_init_bitmaps() to report dirty tracking errors Date: Wed, 6 Mar 2024 14:34:30 +0100 Message-ID: <20240306133441.2351700-16-clg@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240306133441.2351700-1-clg@redhat.com> References: <20240306133441.2351700-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=150.107.74.76; envelope-from=SRS0=yBjJ=KM=redhat.com=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-ZM-MESSAGEID: 1709732277674100003 The .save_setup() handler has now an Error** argument that we can use to propagate errors reported by the .log_global_start() handler. Do that for the RAM. The caller qemu_savevm_state_setup() will store the error under the migration stream for later detection in the migration sequence. Signed-off-by: C=C3=A9dric Le Goater --- migration/ram.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 397b4c0f218a66d194e44f9c5f9fe8e9885c48b6..1e48eee769d314321e31ea71855= f4b49a78b6a13 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2834,9 +2834,8 @@ static void migration_bitmap_clear_discarded_pages(RA= MState *rs) } } =20 -static void ram_init_bitmaps(RAMState *rs) +static bool ram_init_bitmaps(RAMState *rs, Error **errp) { - Error *local_err =3D NULL; bool ret =3D true; =20 qemu_mutex_lock_ramlist(); @@ -2845,10 +2844,8 @@ static void ram_init_bitmaps(RAMState *rs) ram_list_init_bitmaps(); /* We don't use dirty log with background snapshots */ if (!migrate_background_snapshot()) { - ret =3D memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION, - &local_err); + ret =3D memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION, = errp); if (!ret) { - error_report_err(local_err); goto out_unlock; } migration_bitmap_sync_precopy(rs, false); @@ -2858,7 +2855,7 @@ out_unlock: qemu_mutex_unlock_ramlist(); =20 if (!ret) { - return; + return false; } =20 /* @@ -2866,9 +2863,10 @@ out_unlock: * containing all 1s to exclude any discarded pages from migration. */ migration_bitmap_clear_discarded_pages(rs); + return true; } =20 -static int ram_init_all(RAMState **rsp) +static int ram_init_all(RAMState **rsp, Error **errp) { if (ram_state_init(rsp)) { return -1; @@ -2879,7 +2877,9 @@ static int ram_init_all(RAMState **rsp) return -1; } =20 - ram_init_bitmaps(*rsp); + if (!ram_init_bitmaps(*rsp, errp)) { + return -1; + } =20 return 0; } @@ -3077,8 +3077,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque, = Error **errp) =20 /* migration has already setup the bitmap, reuse it. */ if (!migration_in_colo_state()) { - if (ram_init_all(rsp) !=3D 0) { - error_setg(errp, "%s: failed to setup RAM for migration", __fu= nc__); + if (ram_init_all(rsp, errp) !=3D 0) { compress_threads_save_cleanup(); return -1; } --=20 2.44.0