From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198083; cv=none; d=zohomail.com; s=zohoarc; b=gfo35+DLaW615IFU4dhuNjvvonrhlfUK3iVzUuEbna2qTpBk0g9kw/5mg+O+J5URVKDVKbTE2Ug7t16PVpEUCmHZyQaKsxUmZIu+SM9sU+0UWBS3lO0asHxcBCQ35DWwDL0kvS3NaVJF2ZMvxoLm1BmJS4uaBQWcBNSRS+Oy9sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198083; h=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=743Ck5PACkasCTR4nYgvx9N+Sar7G8Zr/XdruLrTb7E=; b=adlHYCl2/G2mbzijwAhPss9FnbYwQWhrpgJ+8Dd5hPE1kqCWfiDWZTr450eKzMp2IUnQfLT12+0l2UjMPHbstDsBYUec4hR7UexnwVjmb8rJ30T0otTdYmak3nEJ6Le9ghYj3b4AQyelBgKKkTIJyCooBWLovpASTePRyIxOxNg= 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 1769198083102573.7948592212941; Fri, 23 Jan 2026 11:54:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEN-0001vB-JJ; Fri, 23 Jan 2026 14:54:07 -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 1vjNEL-0001uS-Sy for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:05 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEJ-0003SG-RG for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:05 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id EC40733863; Fri, 23 Jan 2026 19:53:57 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 92EBD1395E; Fri, 23 Jan 2026 19:53:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0NydFNTRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:53:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198038; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=743Ck5PACkasCTR4nYgvx9N+Sar7G8Zr/XdruLrTb7E=; b=XvpMOmdBVxJS34yWMIQ78XUbsTr8qmwGokzSNO1pnoDIbeAx7DxQJNzOtGNWNC+11Iav/a Vvuyr2iBhxweNows1mBzYQ4ihM8DL0WJrFZ//3fbRsY3UhHMMn8GRGA258NhQpF+wL9YjS nR9YPMbuqcg1bwKLPZu9uFUViHnOYIE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198038; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=743Ck5PACkasCTR4nYgvx9N+Sar7G8Zr/XdruLrTb7E=; b=yPzoRP/2Nx722fdFYO+PsRZwVyNSzLuTN4/HNa88SVVQttTTZq/MZhWqd0pofsIlhaZY8T UM+2xblA+LIMvXDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=CM29LtSr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=yB5p83Yf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198037; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=743Ck5PACkasCTR4nYgvx9N+Sar7G8Zr/XdruLrTb7E=; b=CM29LtSr3EdblwEuHJzapZ8GHFK5La22zR58NmQ/LKeJAkacDxKaLj+Pvndfog7cIVDTtr lwXqlW/KSPyxd+MEZ5+4VbZdHH7RdatT4LDnKp3erd9Z005Tw68IH9esSYFycYF+O0qU6l 1ISycdaK+RwndTN2ywZT6Q3l7+4j1co= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198037; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=743Ck5PACkasCTR4nYgvx9N+Sar7G8Zr/XdruLrTb7E=; b=yB5p83Yf0rpusMsCNyTOHMfWhT39J4Luzs2ejBL6M4i3agVwRxbeIBInxCTNdZYzCvlJjV nmHK3+NhwRR9EeBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster Subject: [PULL 01/36] migration: Drop deprecated QMP command query-migrationthreads Date: Fri, 23 Jan 2026 16:53:16 -0300 Message-ID: <20260123195352.12850-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: EC40733863 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769198084242158500 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster Deprecated in commit 228529d1fec3 (migration: Deprecate query-migrationthreads command), v9.2.0. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260108125512.2234147-2-armbru@re= dhat.com [fixed title underline length] Signed-off-by: Fabiano Rosas --- docs/about/deprecated.rst | 8 ----- docs/about/removed-features.rst | 9 +++++ migration/meson.build | 1 - migration/migration.c | 6 ---- migration/multifd.c | 5 --- migration/threadinfo.c | 64 --------------------------------- migration/threadinfo.h | 25 ------------- qapi/migration.json | 30 ---------------- 8 files changed, 9 insertions(+), 139 deletions(-) delete mode 100644 migration/threadinfo.c delete mode 100644 migration/threadinfo.h diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 88efa3aa80..f57422d378 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -111,14 +111,6 @@ options are removed in favor of using explicit ``block= dev-create`` and ``blockdev-add`` calls. See :doc:`/interop/live-block-operations` for details. =20 -``query-migrationthreads`` (since 9.2) -'''''''''''''''''''''''''''''''''''''' - -To be removed with no replacement, as it reports only a limited set of -threads (for example, it only reports source side of multifd threads, -without reporting any destination threads, or non-multifd source threads). -For debugging purpose, please use ``-name $VM,debug-threads=3Don`` instead. - ``block-job-pause`` (since 10.1) '''''''''''''''''''''''''''''''' =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index b0d7fa8813..4e0775dbc0 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -757,6 +757,15 @@ or list arguments were silently ignored. Other argumen= t types were not checked, but an implicit conversion happened, so that e.g. string values could be assigned to integer device properties or vice versa. =20 +``query-migrationthreads`` (removed in 11.0) +'''''''''''''''''''''''''''''''''''''''''''' + +Removed with no replacement, as it reported only a limited set of +threads (for example, it only reported source side of multifd threads, +without reporting any destination threads, or non-multifd source +threads). For debugging purpose, please use ``-name +$VM,debug-threads=3Don`` instead. + QEMU Machine Protocol (QMP) events ---------------------------------- =20 diff --git a/migration/meson.build b/migration/meson.build index 16909d54c5..c7f39bdb55 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -36,7 +36,6 @@ system_ss.add(files( 'savevm.c', 'socket.c', 'tls.c', - 'threadinfo.c', ), gnutls, zlib) =20 if get_option('replication').allowed() diff --git a/migration/migration.c b/migration/migration.c index 1bcde301f7..9c6aa6f98a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -59,7 +59,6 @@ #include "net/announce.h" #include "qemu/queue.h" #include "multifd.h" -#include "threadinfo.h" #include "qemu/yank.h" #include "system/cpus.h" #include "yank_functions.h" @@ -3744,16 +3743,12 @@ static void qemu_savevm_wait_unplug(MigrationState = *s, int old_state, static void *migration_thread(void *opaque) { MigrationState *s =3D opaque; - MigrationThread *thread =3D NULL; int64_t setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); MigThrError thr_error; bool urgent =3D false; Error *local_err =3D NULL; int ret; =20 - thread =3D migration_threads_add(MIGRATION_THREAD_SRC_MAIN, - qemu_get_thread_id()); - rcu_register_thread(); =20 update_iteration_initial_status(s); @@ -3854,7 +3849,6 @@ out: migration_iteration_finish(s); object_unref(OBJECT(s)); rcu_unregister_thread(); - migration_threads_remove(thread); return NULL; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index c9d4a67a46..24785db93b 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -29,7 +29,6 @@ #include "qemu-file.h" #include "trace.h" #include "multifd.h" -#include "threadinfo.h" #include "options.h" #include "qemu/yank.h" #include "io/channel-file.h" @@ -658,13 +657,10 @@ int multifd_send_sync_main(MultiFDSyncReq req) static void *multifd_send_thread(void *opaque) { MultiFDSendParams *p =3D opaque; - MigrationThread *thread =3D NULL; Error *local_err =3D NULL; int ret =3D 0; bool use_packets =3D multifd_use_packets(); =20 - thread =3D migration_threads_add(p->name, qemu_get_thread_id()); - trace_multifd_send_thread_start(p->id); rcu_register_thread(); =20 @@ -779,7 +775,6 @@ out: } =20 rcu_unregister_thread(); - migration_threads_remove(thread); trace_multifd_send_thread_end(p->id, p->packets_sent); =20 return NULL; diff --git a/migration/threadinfo.c b/migration/threadinfo.c deleted file mode 100644 index 262990dd75..0000000000 --- a/migration/threadinfo.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Migration Threads info - * - * Copyright (c) 2022 HUAWEI TECHNOLOGIES CO., LTD. - * - * Authors: - * Jiang Jiacheng - * - * This work is licensed under the terms of the GNU GPL, version 2 or lat= er. - * See the COPYING file in the top-level directory. - */ - -#include "qemu/osdep.h" -#include "qemu/queue.h" -#include "qemu/lockable.h" -#include "threadinfo.h" - -QemuMutex migration_threads_lock; -static QLIST_HEAD(, MigrationThread) migration_threads; - -static void __attribute__((constructor)) migration_threads_init(void) -{ - qemu_mutex_init(&migration_threads_lock); -} - -MigrationThread *migration_threads_add(const char *name, int thread_id) -{ - MigrationThread *thread =3D g_new0(MigrationThread, 1); - thread->name =3D name; - thread->thread_id =3D thread_id; - - WITH_QEMU_LOCK_GUARD(&migration_threads_lock) { - QLIST_INSERT_HEAD(&migration_threads, thread, node); - } - - return thread; -} - -void migration_threads_remove(MigrationThread *thread) -{ - QEMU_LOCK_GUARD(&migration_threads_lock); - if (thread) { - QLIST_REMOVE(thread, node); - g_free(thread); - } -} - -MigrationThreadInfoList *qmp_query_migrationthreads(Error **errp) -{ - MigrationThreadInfoList *head =3D NULL; - MigrationThreadInfoList **tail =3D &head; - MigrationThread *thread =3D NULL; - - QEMU_LOCK_GUARD(&migration_threads_lock); - QLIST_FOREACH(thread, &migration_threads, node) { - MigrationThreadInfo *info =3D g_new0(MigrationThreadInfo, 1); - info->name =3D g_strdup(thread->name); - info->thread_id =3D thread->thread_id; - - QAPI_LIST_APPEND(tail, info); - } - - return head; -} diff --git a/migration/threadinfo.h b/migration/threadinfo.h deleted file mode 100644 index 2f356ff312..0000000000 --- a/migration/threadinfo.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Migration Threads info - * - * Copyright (c) 2022 HUAWEI TECHNOLOGIES CO., LTD. - * - * Authors: - * Jiang Jiacheng - * - * This work is licensed under the terms of the GNU GPL, version 2 or lat= er. - * See the COPYING file in the top-level directory. - */ - -#include "qapi/error.h" -#include "qapi/qapi-commands-migration.h" - -typedef struct MigrationThread MigrationThread; - -struct MigrationThread { - const char *name; /* the name of migration thread */ - int thread_id; /* ID of the underlying host thread */ - QLIST_ENTRY(MigrationThread) node; -}; - -MigrationThread *migration_threads_add(const char *name, int thread_id); -void migration_threads_remove(MigrationThread *info); diff --git a/qapi/migration.json b/qapi/migration.json index 201dedd982..7bd24e66e9 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -2054,36 +2054,6 @@ { 'command': 'query-vcpu-dirty-limit', 'returns': [ 'DirtyLimitInfo' ] } =20 -## -# @MigrationThreadInfo: -# -# Information about migrationthreads -# -# @name: the name of migration thread -# -# @thread-id: ID of the underlying host thread -# -# Since: 7.2 -## -{ 'struct': 'MigrationThreadInfo', - 'data': {'name': 'str', - 'thread-id': 'int'} } - -## -# @query-migrationthreads: -# -# Return information of migration threads -# -# Features: -# -# @deprecated: This command is deprecated with no replacement yet. -# -# Since: 7.2 -## -{ 'command': 'query-migrationthreads', - 'returns': ['MigrationThreadInfo'], - 'features': ['deprecated'] } - ## # @snapshot-save: # --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198249; cv=none; d=zohomail.com; s=zohoarc; b=YV8kW4x3NLOYf9dGRRt+bVImjQpGxLPW4JaKJ85VFAuxWSSpxefJcvgTK4uJrrpPMi4IwMValQbwvIivPOa2+dlmvCifQi1NUJhROTQJXz0nLI/z86kBdmj3TImkxspfJsN9HM6Nn0RyRHdECq6cCiaMQZIs58ce1XnNbCX01ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198249; h=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=I14XogeA5iS6CKeQVezAAXOBDrCfcPJnQiPBr+MMK9Q=; b=irVPMBSKrr+/w9GAOY1F+eQeRYKv9WXhwsc4LlL2NE0A4Wj/+h12wE1HJNXRyMWx5ifXwEJaMo24ehOee6muImdtfdiEdXQ3F/0koEj7nYnSkCpYM2vuUf+PfW9LUiewREURFHIBteTQakCz8GCjNFaU4TitWVmoxYWCG8Zioos= 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 1769198249375682.2382698383082; Fri, 23 Jan 2026 11:57:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNET-0001wF-Pi; Fri, 23 Jan 2026 14:54:13 -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 1vjNER-0001w2-Th for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:11 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEQ-0003Sy-3V for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:11 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id BF29F33865; Fri, 23 Jan 2026 19:53:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6C2D81395E; Fri, 23 Jan 2026 19:53:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2P5qCdbRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:53:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198039; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I14XogeA5iS6CKeQVezAAXOBDrCfcPJnQiPBr+MMK9Q=; b=aeYjNQFXQWT/C65ZN0Q6fXWji/eCOwrklgbLj3jAklH1BkPDfU+Qk5zrOWrzmE9SOUG3n4 v57iAIEJWwkT4xhdJaYebE1V0qejCZM+uvex4QJZ6UAK9louxaxkQFktiJWNa9kROHD1uF uxD83vpcW1J+ISjf0G8kXbgrOCrfgro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198039; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I14XogeA5iS6CKeQVezAAXOBDrCfcPJnQiPBr+MMK9Q=; b=9rd2QAsuz9TV1bj6zyVEPThdkwu6QNaugcCOvoBy2CgqWpMENIlJwB67F96Lq5jGH4tYsA MGg+y7aRDWTc4PDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198039; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I14XogeA5iS6CKeQVezAAXOBDrCfcPJnQiPBr+MMK9Q=; b=aeYjNQFXQWT/C65ZN0Q6fXWji/eCOwrklgbLj3jAklH1BkPDfU+Qk5zrOWrzmE9SOUG3n4 v57iAIEJWwkT4xhdJaYebE1V0qejCZM+uvex4QJZ6UAK9louxaxkQFktiJWNa9kROHD1uF uxD83vpcW1J+ISjf0G8kXbgrOCrfgro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198039; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I14XogeA5iS6CKeQVezAAXOBDrCfcPJnQiPBr+MMK9Q=; b=9rd2QAsuz9TV1bj6zyVEPThdkwu6QNaugcCOvoBy2CgqWpMENIlJwB67F96Lq5jGH4tYsA MGg+y7aRDWTc4PDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster Subject: [PULL 02/36] migration: Drop deprecated QMP migrate argument @detach Date: Fri, 23 Jan 2026 16:53:17 -0300 Message-ID: <20260123195352.12850-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198251536154100 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster Deprecated in commit c2fb6eaeb9d4 (qapi/migration: Deprecate migrate argument @detach), v10.1.0. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260108125512.2234147-3-armbru@re= dhat.com Signed-off-by: Fabiano Rosas --- docs/about/deprecated.rst | 5 ----- docs/about/removed-features.rst | 5 +++++ migration/migration-hmp-cmds.c | 2 +- migration/migration.c | 2 +- qapi/migration.json | 8 -------- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index f57422d378..4595cc2db5 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -142,11 +142,6 @@ Use ``job-dismiss`` instead. =20 Use ``job-finalize`` instead. =20 -``migrate`` argument ``detach`` (since 10.1) -'''''''''''''''''''''''''''''''''''''''''''' - -This argument has always been ignored. - Human Machine Protocol (HMP) commands ------------------------------------- =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index 4e0775dbc0..ebdfb696ed 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -766,6 +766,11 @@ without reporting any destination threads, or non-mult= ifd source threads). For debugging purpose, please use ``-name $VM,debug-threads=3Don`` instead. =20 +``migrate`` argument ``detach`` (since 11.0) +'''''''''''''''''''''''''''''''''''''''''''' + +This argument has always been ignored. + QEMU Machine Protocol (QMP) events ---------------------------------- =20 diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index a2863e6a2f..0a193b8f54 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -829,7 +829,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 - qmp_migrate(NULL, true, caps, false, false, true, resume, &err); + qmp_migrate(NULL, true, caps, true, resume, &err); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index 9c6aa6f98a..4062c12d33 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2201,7 +2201,7 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, } =20 void qmp_migrate(const char *uri, bool has_channels, - MigrationChannelList *channels, bool has_detach, bool det= ach, + MigrationChannelList *channels, bool has_resume, bool resume, Error **errp) { bool resume_requested; diff --git a/qapi/migration.json b/qapi/migration.json index 7bd24e66e9..c99ae433e0 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1397,19 +1397,12 @@ # @channels: list of migration stream channels with each stream in the # list connected to a destination interface endpoint. # -# @detach: this argument exists only for compatibility reasons and is -# ignored by QEMU -# # @resume: when set, use the new uri/channels specified to resume # paused postcopy migration. This flag should only be used if # the previous postcopy migration was interrupted. The command # will fail unless migration is in "postcopy-paused" state. # (default: false, since 3.0) # -# Features: -# -# @deprecated: Argument @detach is deprecated. -# # Since: 0.14 # # .. admonition:: Notes @@ -1469,7 +1462,6 @@ { 'command': 'migrate', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], - '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] }, '*resume': 'bool' } } =20 ## --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198111; cv=none; d=zohomail.com; s=zohoarc; b=goXvcC1VhGX76rVLqJVsHaqLeSaHFTMgWEh9XlZ3MSM3qD7Q01mbqZFcKWGnSnor/EuPGHq1jC/tY208guW3iQW5q6xUqtGit/UfmVVoWNU1HZQLo+w5QSzz0QKD3VFUsHe0oPrNGr716/GGZGCOHSvdm1gIvzKku1zGb1EZiSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198111; h=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=83nviFH4YNOWNJqbgEjodftmqLoMi6VChFdSyuzvm9A=; b=HVYr5vdA5bmrJyYkjpnMNxyJx/a+8UIh1exfADrWQM3JlayYpSR3Yz4Qd4QaJiAs4cvFiPO+vM9SxxtNa2p7U3AfEnXV4equ+tf7SKuLBEPMFs+ka6fNBVyhsV8aOLaucOlrjsIB5y9nsD4amnFh7maYagi3sS4vjmrZdqYcnyI= 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 1769198111171203.7920479649713; Fri, 23 Jan 2026 11:55:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEY-0001xH-8s; Fri, 23 Jan 2026 14:54:18 -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 1vjNEW-0001ww-JC for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:16 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEV-0003TT-6Q for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:16 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 8ABE43385F; Fri, 23 Jan 2026 19:54:01 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 376C11395E; Fri, 23 Jan 2026 19:53:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aGYVOtfRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:53:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=83nviFH4YNOWNJqbgEjodftmqLoMi6VChFdSyuzvm9A=; b=lqyPlAOola87FWQ9ffQtSxkq6mARCyTLVM5vlFs4p5OqoDIARw0iOzzA6duFMV/ggBhAhm fsxHzFfZBu+tdKpW4zuFoLPiSgIV61KEJu026GmIBCSq4CCef0/1jgOf5J+sNlxp9raYcq 6b/OqT7U2N2+pJ1Zxx9qbkO3rTiLi5c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=83nviFH4YNOWNJqbgEjodftmqLoMi6VChFdSyuzvm9A=; b=StXQHSW0rtTe8zXZoOUDLR+ZoarJGzOXpEqMWKRug4h+NROAQvi3aBTWD7kPSdyYBP8zOx 9dfAyBwe+qtMzKCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=83nviFH4YNOWNJqbgEjodftmqLoMi6VChFdSyuzvm9A=; b=lqyPlAOola87FWQ9ffQtSxkq6mARCyTLVM5vlFs4p5OqoDIARw0iOzzA6duFMV/ggBhAhm fsxHzFfZBu+tdKpW4zuFoLPiSgIV61KEJu026GmIBCSq4CCef0/1jgOf5J+sNlxp9raYcq 6b/OqT7U2N2+pJ1Zxx9qbkO3rTiLi5c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=83nviFH4YNOWNJqbgEjodftmqLoMi6VChFdSyuzvm9A=; b=StXQHSW0rtTe8zXZoOUDLR+ZoarJGzOXpEqMWKRug4h+NROAQvi3aBTWD7kPSdyYBP8zOx 9dfAyBwe+qtMzKCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Vladimir Sementsov-Ogievskiy Subject: [PULL 03/36] vmstate-types: get_fd(): handle qemu_file_get_fd() failure Date: Fri, 23 Jan 2026 16:53:18 -0300 Message-ID: <20260123195352.12850-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198112499158500 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy qemu_file_get_fd() may fail, and return -1 in this case. We don't support passing "invalid" file descriptors (like -1), so we should not interpret error here like invalid descriptor. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260114064710.176268-2-vsementsov= @yandex-team.ru Signed-off-by: Fabiano Rosas --- migration/vmstate-types.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index 4b01dc19c2..e34bf4486e 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -321,12 +321,21 @@ const VMStateInfo vmstate_info_uint64 =3D { static int get_fd(QEMUFile *f, void *pv, size_t size, const VMStateField *field) { + int fd; int32_t *v =3D pv; + if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC) { qemu_get_sbe32s(f, v); return 0; } - *v =3D qemu_file_get_fd(f); + + fd =3D qemu_file_get_fd(f); + if (fd < 0) { + return -1; + } + + *v =3D fd; + return 0; } =20 --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198110; cv=none; d=zohomail.com; s=zohoarc; b=NPBoSZgizM7m3yYDfVs0FFjWziOUlLAL0kzfUcCgKg9O+IZdiiL+bVLAbKq211Wy0JvHPGf5StWWb0ZYoHG9oqM6Cq+nJsUmTIJW6Z8dubIhBbVhOP4/0ygF5oKA6l7FPX0zkoGY9RYWwweJv8VamXiU98vKzulqXG19eQrL8Xw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198110; h=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=auN+ZE4GDXMoV8V22ayEIYUsSI2yfHwprEwhyHMJqc0=; b=ZmaegZ6UGcfcvLV9xtlZuhJY7pkiTCvx5dBM2gr6KkWYimB28BWD9gtnebAQq6e4tb0WUF4giM+HS+9JYyAQ3fvMeo80NI6yJRUjHIeuLHxs1xC7O8gyu6hLx4/gjndAAJ7d2fR/Wms3W1e/mqd9GwKomwHGljlVZfPvhHV68h4= 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 1769198110914882.7297532204367; Fri, 23 Jan 2026 11:55:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEO-0001vJ-QL; Fri, 23 Jan 2026 14:54:08 -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 1vjNEN-0001uv-8W for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:07 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEK-0003SN-Qs for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:06 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 56A835BCC7; Fri, 23 Jan 2026 19:54:03 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0319C1395E; Fri, 23 Jan 2026 19:54:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UI9ILdnRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198043; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auN+ZE4GDXMoV8V22ayEIYUsSI2yfHwprEwhyHMJqc0=; b=kR6cQnnIYfVsY+qqvh7bUQ0l/5TVW2/HTy6AM8NQka0k9hPKSFndaYBfdBc1JoaOn5nLcs 1tMBQ4ikm7oMFN/iNansTrCyOWamOHXq4jGgwVnj6Z3cLmZJ84XdHn6LQtmBS6i026Y1td kx0kBLW7RTOGvpOKQ1L/0TpN1om+ZH8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198043; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auN+ZE4GDXMoV8V22ayEIYUsSI2yfHwprEwhyHMJqc0=; b=04hdAS87RwHJsCa7vmOdVLjhel5WXIA8TDijwvyQP/7rRCQEuKK83FirqNqNF4U4l7B0s4 4o6X0/1oaCf3PhBQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198043; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auN+ZE4GDXMoV8V22ayEIYUsSI2yfHwprEwhyHMJqc0=; b=kR6cQnnIYfVsY+qqvh7bUQ0l/5TVW2/HTy6AM8NQka0k9hPKSFndaYBfdBc1JoaOn5nLcs 1tMBQ4ikm7oMFN/iNansTrCyOWamOHXq4jGgwVnj6Z3cLmZJ84XdHn6LQtmBS6i026Y1td kx0kBLW7RTOGvpOKQ1L/0TpN1om+ZH8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198043; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auN+ZE4GDXMoV8V22ayEIYUsSI2yfHwprEwhyHMJqc0=; b=04hdAS87RwHJsCa7vmOdVLjhel5WXIA8TDijwvyQP/7rRCQEuKK83FirqNqNF4U4l7B0s4 4o6X0/1oaCf3PhBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Vladimir Sementsov-Ogievskiy Subject: [PULL 04/36] qemu-file: qemu_file_get_fd(): fail if no expected fd come Date: Fri, 23 Jan 2026 16:53:19 -0300 Message-ID: <20260123195352.12850-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.18 X-Spamd-Result: default: False [0.18 / 50.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.02)[53.50%]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198112501158500 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy In _put() we don't actually allow send a service byte without fd. So on _get() it's unexpected. Let's be strict. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260114064710.176268-3-vsementsov= @yandex-team.ru Signed-off-by: Fabiano Rosas --- migration/qemu-file.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 8d82d94416..1f3b4cf4c5 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -389,28 +389,34 @@ int qemu_file_get_fd(QEMUFile *f) { int fd =3D -1; FdEntry *fde; + Error *err =3D NULL; =20 if (!f->can_pass_fd) { - Error *err =3D NULL; error_setg(&err, "%s does not support fd passing", f->ioc->name); - error_report_err(error_copy(err)); - qemu_file_set_error_obj(f, -EIO, err); - goto out; + goto fail; } =20 /* Force the dummy byte and its fd passenger to appear. */ qemu_peek_byte(f, 0); =20 fde =3D QTAILQ_FIRST(&f->fds); - if (fde) { - qemu_get_byte(f); /* Drop the dummy byte */ - fd =3D fde->fd; - QTAILQ_REMOVE(&f->fds, fde, entry); - g_free(fde); + if (!fde) { + error_setg(&err, "%s no FD come with service byte", f->ioc->name); + goto fail; } -out: + + qemu_get_byte(f); /* Drop the dummy byte */ + fd =3D fde->fd; + QTAILQ_REMOVE(&f->fds, fde, entry); + g_free(fde); + trace_qemu_file_get_fd(f->ioc->name, fd); return fd; + +fail: + error_report_err(error_copy(err)); + qemu_file_set_error_obj(f, -EIO, err); + return -1; } =20 /** Closes the file --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198083; cv=none; d=zohomail.com; s=zohoarc; b=Som/cYKZhWoCmJR+JYQZtFsNVPDUbgiJde/zr1cDcUne/F5PnxW5eL7sslZ9tRX0I5rDcLDHh56RkDuKHdlTfskPmP2B/g1Qt2mITl+0bnwUh+yl21EuGeuzRdjNGVpQyR/7OyMHMz5kx+WJyAM90Ax7WyF3PYB/BcevSN5hPLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198083; h=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=gTneauV35CNAQWmDtrSSD4L/uPoTsFNcvgLZM70k7HM=; b=Y+Hltr4SaZbVB2sCrqod6kZUjZOM58mQwnLojS1YAunyT5V1Z5/KBhyTJ09jmQQQ9eI10t04L48MrQQlR31A9PvF01n4XuX3n9PnmzOlWP5DfR+e+Jvrri7vw5ghpAgeHrI4FnjDVSojdJj94jZIg1F3GNNGTtnYona9U23L204= 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 1769198082935678.8953422409846; Fri, 23 Jan 2026 11:54:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEd-0001yo-RH; Fri, 23 Jan 2026 14:54:23 -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 1vjNEb-0001y9-QX for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:21 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEa-0003UC-DG for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:21 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 2299C33866; Fri, 23 Jan 2026 19:54:05 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C3B611395E; Fri, 23 Jan 2026 19:54:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uFmqINvRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTneauV35CNAQWmDtrSSD4L/uPoTsFNcvgLZM70k7HM=; b=0I2JIcdght67bikhYCAcW+Vy1Xb8fPsqeSqij6rGuH2Ebt2XjEAoEVUQB88ZJzvBfEgIh0 BEbVDKCKsU007q4+h8EC3tFd/GNSJgoOkH1jSw9O92EOTfygPB2JyxUcdjRUiGB/MlAswd I+HnNzqxpA7UGKy2w3K3vRFzHC3cVIA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTneauV35CNAQWmDtrSSD4L/uPoTsFNcvgLZM70k7HM=; b=A3JbZEnVv5YjrDBdOY5DoGRXlQcV5KdfQ730Xytg11rLQOa5dRFHX3p2vPfdf6zHfunxwl zd2XPwb1XczWI3Bw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTneauV35CNAQWmDtrSSD4L/uPoTsFNcvgLZM70k7HM=; b=0I2JIcdght67bikhYCAcW+Vy1Xb8fPsqeSqij6rGuH2Ebt2XjEAoEVUQB88ZJzvBfEgIh0 BEbVDKCKsU007q4+h8EC3tFd/GNSJgoOkH1jSw9O92EOTfygPB2JyxUcdjRUiGB/MlAswd I+HnNzqxpA7UGKy2w3K3vRFzHC3cVIA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTneauV35CNAQWmDtrSSD4L/uPoTsFNcvgLZM70k7HM=; b=A3JbZEnVv5YjrDBdOY5DoGRXlQcV5KdfQ730Xytg11rLQOa5dRFHX3p2vPfdf6zHfunxwl zd2XPwb1XczWI3Bw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Vladimir Sementsov-Ogievskiy Subject: [PULL 05/36] qemu-file: qemu_file_get_fd(): get byte in one shot Date: Fri, 23 Jan 2026 16:53:20 -0300 Message-ID: <20260123195352.12850-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.55 / 50.00]; BAYES_HAM(-2.75)[98.92%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.55 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198084424158500 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy No reason to split into peek + get. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260114064710.176268-4-vsementsov= @yandex-team.ru Signed-off-by: Fabiano Rosas --- migration/qemu-file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 1f3b4cf4c5..847694e2cf 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -396,8 +396,7 @@ int qemu_file_get_fd(QEMUFile *f) goto fail; } =20 - /* Force the dummy byte and its fd passenger to appear. */ - qemu_peek_byte(f, 0); + qemu_get_byte(f); =20 fde =3D QTAILQ_FIRST(&f->fds); if (!fde) { @@ -405,7 +404,6 @@ int qemu_file_get_fd(QEMUFile *f) goto fail; } =20 - qemu_get_byte(f); /* Drop the dummy byte */ fd =3D fde->fd; QTAILQ_REMOVE(&f->fds, fde, entry); g_free(fde); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198149; cv=none; d=zohomail.com; s=zohoarc; b=e7NODNTuCLwf3/ikkbvCImdHPDksTzWKRVHFCj5khRaxfCcZhpPt/nx3V0EWMN2ogbOu2NIeDV+JnGF3mDiEs/rjjO+1FRU5DzlrjMNkyRo5qVIVPreM+UzkwZV1wTD7Z0Zzy39Ma9oWb6AB+R2rI7JWK3aU+7Mao1I8jya0sJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198149; h=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=mg05fAJm3+UU6nlxzOt6lsvc93K7OVfV8QxdqW6GyEo=; b=LEyuVrqzQcOQCrVcWK3tZMPASAmFZ7EmdAIHDFNlI3aYBYE6t4L5VlXqXrkkL2AyyMXSsxnsYgxUYO49dWqojMhl4VG9M6s4AQDYN0cRr/746De4ZzYGtPQozfL8V+3R1Lo1frFoSxqSQEEgllNVx/F69u/SGshlyhq9zviqLOc= 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 1769198149825771.7894660134491; Fri, 23 Jan 2026 11:55:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEX-0001xB-1T; Fri, 23 Jan 2026 14:54:17 -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 1vjNEU-0001wW-UB for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:14 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNET-0003T9-C5 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:14 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id E51B95BCCC; Fri, 23 Jan 2026 19:54:06 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 914E01395E; Fri, 23 Jan 2026 19:54:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0BtVFN3Rc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mg05fAJm3+UU6nlxzOt6lsvc93K7OVfV8QxdqW6GyEo=; b=YEWhYgmuSdvWD+KUPmJu2zJEsUufGUaQUQEZR7DARFRktY4aQxADG/H4ctG4ArbtBCJZXy YxVmQtdn9w1ad58SGGv5573oDALXi117BfKbAkfbp76edU71R8nkhP1aaQqSOQos3VUaW+ uMvNwEHD6VJlGyeStd0FkjhOl99bapo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mg05fAJm3+UU6nlxzOt6lsvc93K7OVfV8QxdqW6GyEo=; b=xmgyuHg73ltoBjVtw00JBFDnHFbF64+2SPumVCn8zKX7sjWpVD9rcWphN1JyeT7+SVZ81e Lc6soYq8LTz8oUDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RhptAFj+; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=D+hV2lGH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mg05fAJm3+UU6nlxzOt6lsvc93K7OVfV8QxdqW6GyEo=; b=RhptAFj+6SZaeWHj3H64bwMDRO3mPACYcONoEgAvd8INgqIHTQ8E5LNasEZfWcs9ULvrSP Tc5TxEHusfILo/CoyptLRisAoWbDe6YZej3LpEU5MT5XPbP2OY14nkDBjSE2UrJmLkwrSW KFtVfQsZSfKsqlong2wNHkzmTkbHXAE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mg05fAJm3+UU6nlxzOt6lsvc93K7OVfV8QxdqW6GyEo=; b=D+hV2lGHYlVDL/qyr4muwtpmP5/JAznJrWymqANBlRLQMikX7Ni2Ydh3mDs0b8O+6cx5hR ESG/dWgPW6X5/uAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Vladimir Sementsov-Ogievskiy Subject: [PULL 06/36] qemu-file: qemu_file_get_fd(): check service byte itself Date: Fri, 23 Jan 2026 16:53:21 -0300 Message-ID: <20260123195352.12850-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: E51B95BCCC X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769198152059154100 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We can check it, so, why not. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260114064710.176268-5-vsementsov= @yandex-team.ru Signed-off-by: Fabiano Rosas --- migration/qemu-file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 847694e2cf..8fdb6c87ea 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -390,13 +390,19 @@ int qemu_file_get_fd(QEMUFile *f) int fd =3D -1; FdEntry *fde; Error *err =3D NULL; + int service_byte; =20 if (!f->can_pass_fd) { error_setg(&err, "%s does not support fd passing", f->ioc->name); goto fail; } =20 - qemu_get_byte(f); + service_byte =3D qemu_get_byte(f); + if (service_byte !=3D ' ') { + error_setg(&err, "%s unexpected service byte: %d(%c)", f->ioc->nam= e, + service_byte, service_byte); + goto fail; + } =20 fde =3D QTAILQ_FIRST(&f->fds); if (!fde) { --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198269; cv=none; d=zohomail.com; s=zohoarc; b=Q98HpEEJfu1/S3WnQWnZK6v35ptzB0IVn2dtcqWo4q86djdvoEGSHa5FQtq/zbNvb8YTjzXZLCs43VMj1PmtLEDtvIW9p6T+zbR4315deqzg/hwfBG3WLN0gZ/whXAxd8WCYLi2htPCFES9fDrsXFvqXNfhk7xDAQv73En+wY5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198269; h=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=zxddm5U6APu7XOwfsBVhki7+UpshfKnR0yF/8exGvAk=; b=ChE4qFXCkQ/8A5jcJ1b5gXKAtgXiYEcwCmjqHLDLtNljSydUf/HaHt2iTTfdfUHOXSPBjvLB7fHLIQYrqdIeua3GTVGC/lZBUYSd5sWrAFh68/TbRkRnSdqtOrJJlKKQqsVrTYzhzM4+3AsG8ZRsfwToQJPAk/q7QIcV7+anmXM= 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 1769198269629578.6767908525349; Fri, 23 Jan 2026 11:57:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEi-00023W-P0; Fri, 23 Jan 2026 14:54:28 -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 1vjNEh-00022X-6i for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:27 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEf-0003Uu-FT for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:26 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id B9F1633863; Fri, 23 Jan 2026 19:54:08 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5EA891395E; Fri, 23 Jan 2026 19:54:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qNb7B9/Rc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zxddm5U6APu7XOwfsBVhki7+UpshfKnR0yF/8exGvAk=; b=fuMF/NMQkntSUOEBvQR2WUsH2Xk6Sh4Qgy5vbz5OgTwki1swuVy3U+qH05PDXrP73Ub54t ytffRDsF+BPz7R5c987yB4MLMOG8ISdANfJ1xsTKcnw3z4ntNTq6MGoMROFQUTfxW7jNZN S3cJvtLZ5jZOgslbCOzX4GyAfcsRAoU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zxddm5U6APu7XOwfsBVhki7+UpshfKnR0yF/8exGvAk=; b=G6Sl7wULl1cmgDCxHO1/OdInEDVNpzEZQ5nwalWuPhsBldymIJYe9Xixpf6dlsKDPpgljq w+uG8lf+OPWffgAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zxddm5U6APu7XOwfsBVhki7+UpshfKnR0yF/8exGvAk=; b=fuMF/NMQkntSUOEBvQR2WUsH2Xk6Sh4Qgy5vbz5OgTwki1swuVy3U+qH05PDXrP73Ub54t ytffRDsF+BPz7R5c987yB4MLMOG8ISdANfJ1xsTKcnw3z4ntNTq6MGoMROFQUTfxW7jNZN S3cJvtLZ5jZOgslbCOzX4GyAfcsRAoU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zxddm5U6APu7XOwfsBVhki7+UpshfKnR0yF/8exGvAk=; b=G6Sl7wULl1cmgDCxHO1/OdInEDVNpzEZQ5nwalWuPhsBldymIJYe9Xixpf6dlsKDPpgljq w+uG8lf+OPWffgAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Vladimir Sementsov-Ogievskiy Subject: [PULL 07/36] qemu-file: qemu_file_get_fd(): improve interface Date: Fri, 23 Jan 2026 16:53:22 -0300 Message-ID: <20260123195352.12850-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198271314158500 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Make it symmetrical with qemu_file_put_fd() and simplify callers. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/qemu-devel/20260114064710.176268-6-vsementsov= @yandex-team.ru Signed-off-by: Fabiano Rosas --- migration/qemu-file.c | 9 ++++----- migration/qemu-file.h | 2 +- migration/vmstate-types.c | 10 +--------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 8fdb6c87ea..9cf7dc3bd5 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -385,9 +385,8 @@ int qemu_file_put_fd(QEMUFile *f, int fd) return ret; } =20 -int qemu_file_get_fd(QEMUFile *f) +int qemu_file_get_fd(QEMUFile *f, int *fd) { - int fd =3D -1; FdEntry *fde; Error *err =3D NULL; int service_byte; @@ -410,12 +409,12 @@ int qemu_file_get_fd(QEMUFile *f) goto fail; } =20 - fd =3D fde->fd; + *fd =3D fde->fd; QTAILQ_REMOVE(&f->fds, fde, entry); g_free(fde); =20 - trace_qemu_file_get_fd(f->ioc->name, fd); - return fd; + trace_qemu_file_get_fd(f->ioc->name, *fd); + return 0; =20 fail: error_report_err(error_copy(err)); diff --git a/migration/qemu-file.h b/migration/qemu-file.h index c13c967167..a8e9bb2ccb 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -82,6 +82,6 @@ size_t qemu_get_buffer_at(QEMUFile *f, const uint8_t *buf= , size_t buflen, =20 QIOChannel *qemu_file_get_ioc(QEMUFile *file); int qemu_file_put_fd(QEMUFile *f, int fd); -int qemu_file_get_fd(QEMUFile *f); +int qemu_file_get_fd(QEMUFile *f, int *fd); =20 #endif diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index e34bf4486e..89cb211472 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -321,7 +321,6 @@ const VMStateInfo vmstate_info_uint64 =3D { static int get_fd(QEMUFile *f, void *pv, size_t size, const VMStateField *field) { - int fd; int32_t *v =3D pv; =20 if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC) { @@ -329,14 +328,7 @@ static int get_fd(QEMUFile *f, void *pv, size_t size, return 0; } =20 - fd =3D qemu_file_get_fd(f); - if (fd < 0) { - return -1; - } - - *v =3D fd; - - return 0; + return qemu_file_get_fd(f, v); } =20 static int put_fd(QEMUFile *f, void *pv, size_t size, --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198210; cv=none; d=zohomail.com; s=zohoarc; b=SqJFGkb34MsG+95wow+R5wtQNeqJtpk6rcFbdTMfq2vs7lmsZziMnhdB18DnF0Objjus1+NraxsMS6S5J4lwEUXR10K7WEXFyCvtI+luCBmbDo4vvdwz0cvKG78ZsQ/s5S0TL0jaspYcdmb7pAb/7RR2qJp8yfQ3yI/gzNYOI2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198210; h=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=6XLBSEmh608quyWJeIecal4f8dXOkZyXRe+KQK96iSc=; b=erBTOQBszw1mO3VRP1NZEsY9dd4kON0ckybOAjBMUYEIgBrRFhcgcbWyoUgJpi6qBbsJxacCZpy+aeddb/OPoE0dsDd5nj9o+B5TVubpCvUVoFq/X1Y2i7q4eCFngzrID/T18gWh55iqis7JR/FjWjbc00noySmdn489iCQZL8Q= 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 1769198210082759.6558718185183; Fri, 23 Jan 2026 11:56:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEq-00027f-60; Fri, 23 Jan 2026 14:54:36 -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 1vjNEn-00026R-Sw for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:33 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEm-0003WE-3l for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:33 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 853E133868; Fri, 23 Jan 2026 19:54:10 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2FC1F1395E; Fri, 23 Jan 2026 19:54:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kGH+N+DRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198050; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XLBSEmh608quyWJeIecal4f8dXOkZyXRe+KQK96iSc=; b=K0AqCnjBNh0XmuWG/YIid9F08efSXyfzPUC9zcK6tuqvGRc/fUpsmbhJ0KCuX/bx2rgBbo oUR2jBFse0Pe8Kk5fDkxVOhmAO9+l0Hjmts7YLh9Rb4tXl42JN+5gm5BY5SEyXalJeOoIH I3gvRRogTc29T85+JHxtrN+V74zKfQw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198050; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XLBSEmh608quyWJeIecal4f8dXOkZyXRe+KQK96iSc=; b=7iyo9oMfduiVREmcKZ//zI5nSDbrwk+Pbfkhimna6qkEThOUGf31QQyAAKzp7cAjNhNLra YDa0SysTVnqodCDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=K0AqCnjB; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7iyo9oMf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198050; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XLBSEmh608quyWJeIecal4f8dXOkZyXRe+KQK96iSc=; b=K0AqCnjBNh0XmuWG/YIid9F08efSXyfzPUC9zcK6tuqvGRc/fUpsmbhJ0KCuX/bx2rgBbo oUR2jBFse0Pe8Kk5fDkxVOhmAO9+l0Hjmts7YLh9Rb4tXl42JN+5gm5BY5SEyXalJeOoIH I3gvRRogTc29T85+JHxtrN+V74zKfQw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198050; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XLBSEmh608quyWJeIecal4f8dXOkZyXRe+KQK96iSc=; b=7iyo9oMfduiVREmcKZ//zI5nSDbrwk+Pbfkhimna6qkEThOUGf31QQyAAKzp7cAjNhNLra YDa0SysTVnqodCDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 08/36] tests/migration-test: Remove postcopy_data from MigrateCommon Date: Fri, 23 Jan 2026 16:53:23 -0300 Message-ID: <20260123195352.12850-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 853E133868 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198210498158500 Content-Type: text/plain; charset="utf-8" From: Peter Xu Now postcopy is not the only user of start_hook / end_hook that will pass in a opaque pointer. It doesn't need to be defined in MigrateCommon as part of the framework, as all other hook users can pass hook_data around. Do it too for postcopy. Reviewed-by: Prasad Pandit Signed-off-by: Peter Xu Link: https://lore.kernel.org/qemu-devel/20260114153751.2427172-2-peterx@re= dhat.com Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 18 ++++++++++-------- tests/qtest/migration/framework.h | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 57d3b9b7c5..78bd3ec31a 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -541,6 +541,7 @@ void migrate_end(QTestState *from, QTestState *to, bool= test_dest) =20 static int migrate_postcopy_prepare(QTestState **from_ptr, QTestState **to_ptr, + void **hook_data, MigrateCommon *args) { QTestState *from, *to; @@ -554,7 +555,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, } =20 if (args->start_hook) { - args->postcopy_data =3D args->start_hook(from, to); + *hook_data =3D args->start_hook(from, to); } =20 migrate_ensure_non_converge(from); @@ -582,7 +583,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, } =20 static void migrate_postcopy_complete(QTestState *from, QTestState *to, - MigrateCommon *args) + void *hook_data, MigrateCommon *args) { MigrationTestEnv *env =3D migration_get_env(); =20 @@ -601,8 +602,7 @@ static void migrate_postcopy_complete(QTestState *from,= QTestState *to, } =20 if (args->end_hook) { - args->end_hook(from, to, args->postcopy_data); - args->postcopy_data =3D NULL; + args->end_hook(from, to, hook_data); } =20 migrate_end(from, to, true); @@ -610,13 +610,14 @@ static void migrate_postcopy_complete(QTestState *fro= m, QTestState *to, =20 void test_postcopy_common(MigrateCommon *args) { + void *hook_data =3D NULL; QTestState *from, *to; =20 - if (migrate_postcopy_prepare(&from, &to, args)) { + if (migrate_postcopy_prepare(&from, &to, &hook_data, args)) { return; } migrate_postcopy_start(from, to, &src_state); - migrate_postcopy_complete(from, to, args); + migrate_postcopy_complete(from, to, hook_data, args); } =20 static void wait_for_postcopy_status(QTestState *one, const char *status) @@ -742,6 +743,7 @@ void test_postcopy_recovery_common(MigrateCommon *args) { QTestState *from, *to; g_autofree char *uri =3D NULL; + void *hook_data =3D NULL; =20 /* * Always enable OOB QMP capability for recovery tests, migrate-recove= r is @@ -752,7 +754,7 @@ void test_postcopy_recovery_common(MigrateCommon *args) /* Always hide errors for postcopy recover tests since they're expecte= d */ args->start.hide_stderr =3D true; =20 - if (migrate_postcopy_prepare(&from, &to, args)) { + if (migrate_postcopy_prepare(&from, &to, &hook_data, args)) { return; } =20 @@ -808,7 +810,7 @@ void test_postcopy_recovery_common(MigrateCommon *args) /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); =20 - migrate_postcopy_complete(from, to, args); + migrate_postcopy_complete(from, to, hook_data, args); } =20 int test_precopy_common(MigrateCommon *args) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 2ef0f57962..c180cc3e46 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -231,7 +231,6 @@ typedef struct { bool live; =20 /* Postcopy specific fields */ - void *postcopy_data; PostcopyRecoveryFailStage postcopy_recovery_fail_stage; } MigrateCommon; =20 --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198306; cv=none; d=zohomail.com; s=zohoarc; b=Iz/w2FVun2Wd0t+TY7ApDA0OmnqpWwhb/PCxYH6B6Ezn/Fqn7zQY1ZsJXnPZ9wtD26xpRg0lPadE4L2qt/zjFrVwI0NywswBDgcT7lfK20voAEpQDGBGTBzCd8VnMpTaS/ViiH9dE902ok9vPdj1eDw31Fo8+aeKE+z4mjcmy+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198306; h=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=uaiI/AssrYeE/BeFlqJs+cjWEBQJzpqKM0VTCNdISJk=; b=VmzdSHGIEsXAQrFguM7ZzErs+HLZ8hZP47j73YCwEhXaKNnJiTjFxBf5Fb7zYvG0eFndgQhgHWPqakgVnOr3TzOvALFBmTdbpFDIE3fGxM+yfjg5uT7rMamFQZrt7KHuKkD4UMVe0D/aerfCWwMRS5KklSLWCalw2g8gB0nwhtg= 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 1769198306362399.13414849644687; Fri, 23 Jan 2026 11:58:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEb-0001xt-BC; Fri, 23 Jan 2026 14:54:21 -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 1vjNEZ-0001xf-SZ for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:19 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEY-0003Tw-5t for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:19 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 53A5E5BCCD; Fri, 23 Jan 2026 19:54:12 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F28EB1395E; Fri, 23 Jan 2026 19:54:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uNQPLOLRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198052; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uaiI/AssrYeE/BeFlqJs+cjWEBQJzpqKM0VTCNdISJk=; b=SckBUTSg4gJQBMAKz0+ObPuWzk5s6PmudP9FiGHKvLAVjp5ofCwSgcckhL1LvbPFI0WzeK KF1+wY+XSJDPJlk3DMPZE0EgHP0cuE42EtErsM3IL4V/5YDkm+bCs8SI5tkb3pDE7NkTF5 1OH2rijBDvJ5bfnWBY3AR2FZ5IDLqtk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198052; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uaiI/AssrYeE/BeFlqJs+cjWEBQJzpqKM0VTCNdISJk=; b=teOA7dfce81qyMyztSjjxB082DIBhfx9n35EIV7+La/ZawtpXHvkMNJepcZnE9KhEwZDQ2 91evcympvdaaA/Cw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=SckBUTSg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=teOA7dfc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198052; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uaiI/AssrYeE/BeFlqJs+cjWEBQJzpqKM0VTCNdISJk=; b=SckBUTSg4gJQBMAKz0+ObPuWzk5s6PmudP9FiGHKvLAVjp5ofCwSgcckhL1LvbPFI0WzeK KF1+wY+XSJDPJlk3DMPZE0EgHP0cuE42EtErsM3IL4V/5YDkm+bCs8SI5tkb3pDE7NkTF5 1OH2rijBDvJ5bfnWBY3AR2FZ5IDLqtk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198052; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uaiI/AssrYeE/BeFlqJs+cjWEBQJzpqKM0VTCNdISJk=; b=teOA7dfce81qyMyztSjjxB082DIBhfx9n35EIV7+La/ZawtpXHvkMNJepcZnE9KhEwZDQ2 91evcympvdaaA/Cw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 09/36] tests/migration-test: Remove postcopy_recovery_fail_stage from MigrateCommon Date: Fri, 23 Jan 2026 16:53:24 -0300 Message-ID: <20260123195352.12850-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 53A5E5BCCD X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198307011158500 Content-Type: text/plain; charset="utf-8" From: Peter Xu The parameter can be instead passed into the function to avoid polluting the global address space of MigrateCommon. Reviewed-by: Prasad Pandit Signed-off-by: Peter Xu Link: https://lore.kernel.org/qemu-devel/20260114153751.2427172-3-peterx@re= dhat.com Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 7 ++++--- tests/qtest/migration/framework.h | 6 ++---- tests/qtest/migration/postcopy-tests.c | 12 ++++-------- tests/qtest/migration/tls-tests.c | 8 ++++---- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 78bd3ec31a..d5240104b1 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -739,7 +739,8 @@ static void postcopy_recover_fail(QTestState *from, QTe= stState *to, #endif } =20 -void test_postcopy_recovery_common(MigrateCommon *args) +void test_postcopy_recovery_common(MigrateCommon *args, + PostcopyRecoveryFailStage fail_stage) { QTestState *from, *to; g_autofree char *uri =3D NULL; @@ -784,12 +785,12 @@ void test_postcopy_recovery_common(MigrateCommon *arg= s) wait_for_postcopy_status(to, "postcopy-paused"); wait_for_postcopy_status(from, "postcopy-paused"); =20 - if (args->postcopy_recovery_fail_stage) { + if (fail_stage) { /* * Test when a wrong socket specified for recover, and then the * ability to kick it out, and continue with a correct socket. */ - postcopy_recover_fail(from, to, args->postcopy_recovery_fail_stage= ); + postcopy_recover_fail(from, to, fail_stage); /* continue with a good recovery */ } =20 diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index c180cc3e46..40984d0493 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -229,9 +229,6 @@ typedef struct { * refer to existing ones with live=3Dtrue), or use live=3Doff by defa= ult. */ bool live; - - /* Postcopy specific fields */ - PostcopyRecoveryFailStage postcopy_recovery_fail_stage; } MigrateCommon; =20 void wait_for_serial(const char *side); @@ -244,7 +241,8 @@ int migrate_start(QTestState **from, QTestState **to, c= onst char *uri, void migrate_end(QTestState *from, QTestState *to, bool test_dest); =20 void test_postcopy_common(MigrateCommon *args); -void test_postcopy_recovery_common(MigrateCommon *args); +void test_postcopy_recovery_common(MigrateCommon *args, + PostcopyRecoveryFailStage fail_stage); int test_precopy_common(MigrateCommon *args); void test_file_common(MigrateCommon *args, bool stop_src); void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from, diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 7ae4d765d7..13a5759655 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -41,30 +41,26 @@ static void test_postcopy_preempt(char *name, MigrateCo= mmon *args) =20 static void test_postcopy_recovery(char *name, MigrateCommon *args) { - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); } =20 static void test_postcopy_recovery_fail_handshake(char *name, MigrateCommon *args) { - args->postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_RECOVERY; - - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_RECOVERY); } =20 static void test_postcopy_recovery_fail_reconnect(char *name, MigrateCommon *args) { - args->postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_CHANNEL_ESTABLISH; - - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_CHANNEL_ESTABLISH); } =20 static void test_postcopy_preempt_recovery(char *name, MigrateCommon *args) { args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); } =20 static void migration_test_add_postcopy_smoke(MigrationTestEnv *env) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 6a20c65104..bf0bb06a29 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -385,7 +385,7 @@ static void test_postcopy_recovery_tls_psk(char *name, = MigrateCommon *args) args->start_hook =3D migrate_hook_start_tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); } =20 static void test_multifd_postcopy_recovery_tls_psk(char *name, @@ -396,7 +396,7 @@ static void test_multifd_postcopy_recovery_tls_psk(char= *name, =20 args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); } =20 /* This contains preempt+recovery+tls test altogether */ @@ -407,7 +407,7 @@ static void test_postcopy_preempt_all(char *name, Migra= teCommon *args) =20 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); } =20 static void test_multifd_postcopy_preempt_recovery_tls_psk(char *name, @@ -419,7 +419,7 @@ static void test_multifd_postcopy_preempt_recovery_tls_= psk(char *name, args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); } =20 static void test_precopy_unix_tls_psk(char *name, MigrateCommon *args) --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198138; cv=none; d=zohomail.com; s=zohoarc; b=aV10RkTFPAiU8eoK6MrJ9ZbvuxGj1XIW4qBIQm614i5g0KHaRMyJx8q2cmdfHPHYbR5+rlO9jCjfWD3YJuz3XvuvL70TbOl/U0Edzfw2LgBJlrNtFwscrHKJuMY5rKSeV0ETTCGVIgNCZjtmQcb0xdhWAbvz5D/U0ntd+y0jzz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198138; h=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=EMTf0uhPWrpw0qFSweSfrNMabonCrvDY5bWvqbymo7w=; b=R2hYxYJi6uCOvPbah9IvoZt1ltR7lX017TD6zVAUfVESkGhAJj6MJgFJ/1oAJdPjgz+PMOX/EvFGVoFGJGDa8hq2kUwsMuK3CrOZxoogpOGJM0/uqqB9IDDF5HJmVhWDYEWoHrqLZ1e++xz8WhVm0gKiWzM9HyvuoPiaUfyWmEg= 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 1769198138148573.7846597730612; Fri, 23 Jan 2026 11:55:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEh-00022Z-9D; Fri, 23 Jan 2026 14:54:27 -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 1vjNEf-0001zf-HC for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:25 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEd-0003Uh-Mo for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:25 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 23BD75BCCF; Fri, 23 Jan 2026 19:54:14 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C1B041395E; Fri, 23 Jan 2026 19:54:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id gEYPIOTRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EMTf0uhPWrpw0qFSweSfrNMabonCrvDY5bWvqbymo7w=; b=Umz8XOMJ5KJK7QUVvPoLMtYlkwHYzmFNL8Vt6SOi+NoIsKgn12wDt6v1C75l1bnhs0h+od OA+Y0m6zXNlx6nEVQf5Iqyho3FdvruZqK7UIgFJL7fMmOmwvbej2W+mXj7RVnKBsHeJbjc sCSmWYzHN7onWkAKctopGWUMo6XE8Cw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EMTf0uhPWrpw0qFSweSfrNMabonCrvDY5bWvqbymo7w=; b=sl2TdwB/ITuC/5/A/UxebuwdkNWWMNlR4Vey8z+HCE/1blgpPI+8HdIiPA0qWsGrXX332+ mIv6I2VZH3hwF8CA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Umz8XOMJ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="sl2TdwB/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EMTf0uhPWrpw0qFSweSfrNMabonCrvDY5bWvqbymo7w=; b=Umz8XOMJ5KJK7QUVvPoLMtYlkwHYzmFNL8Vt6SOi+NoIsKgn12wDt6v1C75l1bnhs0h+od OA+Y0m6zXNlx6nEVQf5Iqyho3FdvruZqK7UIgFJL7fMmOmwvbej2W+mXj7RVnKBsHeJbjc sCSmWYzHN7onWkAKctopGWUMo6XE8Cw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EMTf0uhPWrpw0qFSweSfrNMabonCrvDY5bWvqbymo7w=; b=sl2TdwB/ITuC/5/A/UxebuwdkNWWMNlR4Vey8z+HCE/1blgpPI+8HdIiPA0qWsGrXX332+ mIv6I2VZH3hwF8CA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster Subject: [PULL 10/36] migration: Remove zero-blocks capability Date: Fri, 23 Jan 2026 16:53:25 -0300 Message-ID: <20260123195352.12850-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 23BD75BCCF X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198140212158500 Content-Type: text/plain; charset="utf-8" From: Peter Xu It was declared deprecated since 9.2. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/qemu-devel/20260115225503.3083355-2-peterx@re= dhat.com Signed-off-by: Fabiano Rosas --- docs/about/deprecated.rst | 6 ------ docs/about/removed-features.rst | 7 +++++++ migration/options.c | 5 ----- qapi/migration.json | 12 ------------ 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 4595cc2db5..ae9a3b8aea 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -532,9 +532,3 @@ usage of providing a file descriptor to a plain file ha= s been deprecated in favor of explicitly using the ``file:`` URI with the file descriptor being passed as an ``fdset``. Refer to the ``add-fd`` command documentation for details on the ``fdset`` usage. - -``zero-blocks`` capability (since 9.2) -'''''''''''''''''''''''''''''''''''''' - -The ``zero-blocks`` capability was part of the block migration which -doesn't exist anymore since it was removed in QEMU v9.1. diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index ebdfb696ed..92f80a32e4 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -723,6 +723,13 @@ Block migration has been removed. For a replacement, s= ee "QMP invocation for live storage migration with ``blockdev-mirror`` + NBD" in docs/interop/live-block-operations.rst. =20 +``migrate-set-capabilities`` ``zero-blocks`` option (removed in 11.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The ``zero-blocks`` capability was accidentally left behind when +block migration capability got removed in 9.1. Removed with no +replacement. + ``migrate-set-parameter`` ``compress-level`` option (removed in 9.1) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/migration/options.c b/migration/options.c index 9a5a39c886..68a4536150 100644 --- a/migration/options.c +++ b/migration/options.c @@ -188,7 +188,6 @@ const Property migration_properties[] =3D { DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), - DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), DEFINE_PROP_MIG_CAP("x-postcopy-preempt", @@ -576,10 +575,6 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) ERRP_GUARD(); MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) { - warn_report("zero-blocks capability is deprecated"); - } - #ifndef CONFIG_REPLICATION if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { error_setg(errp, "QEMU compiled without replication module" diff --git a/qapi/migration.json b/qapi/migration.json index c99ae433e0..f925e5541b 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -440,13 +440,6 @@ # footprint is mlock()'d on demand or all at once. Refer to # docs/rdma.txt for usage. Disabled by default. (since 2.0) # -# @zero-blocks: During storage migration encode blocks of zeroes -# efficiently. This essentially saves 1MB of zeroes per block on -# the wire. Enabling requires source and target VM to support -# this feature. To enable it is sufficient to enable the -# capability on the source VM. The feature is disabled by -# default. (since 1.6) -# # @events: generate events for each migration state change (since 2.4) # # @auto-converge: If enabled, QEMU will automatically throttle down @@ -531,14 +524,10 @@ # # @unstable: Members @x-colo and @x-ignore-shared are experimental. # -# @deprecated: Member @zero-blocks is deprecated as being part of -# block migration which was already removed. -# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', - { 'name': 'zero-blocks', 'features': [ 'deprecated' ] }, 'events', 'postcopy-ram', { 'name': 'x-colo', 'features': [ 'unstable' ] }, 'release-ram', @@ -595,7 +584,6 @@ # {"state": false, "capability": "xbzrle"}, # {"state": false, "capability": "rdma-pin-all"}, # {"state": false, "capability": "auto-converge"}, -# {"state": false, "capability": "zero-blocks"}, # {"state": true, "capability": "events"}, # {"state": false, "capability": "postcopy-ram"}, # {"state": false, "capability": "x-colo"} --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198270; cv=none; d=zohomail.com; s=zohoarc; b=Vh4B9jQwbYlRXhx8nwtb66z7oBSP/LrZwd9fY6avz++yTOF01STQPS2LN1xkJRchvGvm4O27AOoVudz/FLeWUTSfvVjc7Bouw54ufb9WwyD7bK37AXV/WKJu/RfDnfzGvl+74G1QnyScQArWm57SoEwOaXiCgLaZDZQQ1Z0isMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198270; h=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=PdPVU7dy7nYLNsiolxyE299cuedhXP9PrZceedfWPn4=; b=Q4cIn4AGMkmQ8jD890dyMtSfmh4tP5A5EKzSptb+vJugK3YHTAa4UaG1xDtdTrgcTuFG3QsoF1EafGzJzDzDCSo9Qp7eQuK9eHRqCYviLI7mm42df7e9XSXXxMJsn/oLhmxehg4N6bvzbU2yP9UczLVsvX/mXL63z8xOeV3Emzw= 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 1769198270670291.1176056042922; Fri, 23 Jan 2026 11:57:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEu-0002Ck-W5; Fri, 23 Jan 2026 14:54:41 -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 1vjNEt-00029W-IX for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:39 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEr-0003X6-PE for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:39 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id E3F9933865; Fri, 23 Jan 2026 19:54:15 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 90B1F1395E; Fri, 23 Jan 2026 19:54:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mHokFObRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198055; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PdPVU7dy7nYLNsiolxyE299cuedhXP9PrZceedfWPn4=; b=XsD8t3ZIfZy3ECnTqJ1Mi9Oy0fuREhTlWVZv5xSJIjQ7RkQUXhAWXWuska1URitCHQJy48 seEsor0un84fEzTUheOqaSeney5Gu/Z7su7uAKE2CDHV1jk4KM7T47DQs7vOHLN2R3WZdQ w0i/EoLJuWoN8bGnlgdn7XdRtOjrTT0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198055; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PdPVU7dy7nYLNsiolxyE299cuedhXP9PrZceedfWPn4=; b=yd/zT56wxJ2ztDo0VaYnykZuAUHnO8mH8vZqcLG9lSnXmxOWu++PmkoDOesw9iQt5oEGhw kVrZufghpmyey5Cw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198055; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PdPVU7dy7nYLNsiolxyE299cuedhXP9PrZceedfWPn4=; b=XsD8t3ZIfZy3ECnTqJ1Mi9Oy0fuREhTlWVZv5xSJIjQ7RkQUXhAWXWuska1URitCHQJy48 seEsor0un84fEzTUheOqaSeney5Gu/Z7su7uAKE2CDHV1jk4KM7T47DQs7vOHLN2R3WZdQ w0i/EoLJuWoN8bGnlgdn7XdRtOjrTT0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198055; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PdPVU7dy7nYLNsiolxyE299cuedhXP9PrZceedfWPn4=; b=yd/zT56wxJ2ztDo0VaYnykZuAUHnO8mH8vZqcLG9lSnXmxOWu++PmkoDOesw9iQt5oEGhw kVrZufghpmyey5Cw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 11/36] migration: Remove fd: support on files Date: Fri, 23 Jan 2026 16:53:26 -0300 Message-ID: <20260123195352.12850-12-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198271863154100 Content-Type: text/plain; charset="utf-8" From: Peter Xu This feature was deprecated in 9.1. Remove it in this release (11.0). We also need to remove one unit test (/migration/precopy/fd/file) that covers the fd: file migration, because it'll stop working now. Reviewed-by: Prasad Pandit Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Link: https://lore.kernel.org/qemu-devel/20260115225503.3083355-3-peterx@re= dhat.com Signed-off-by: Fabiano Rosas --- docs/about/deprecated.rst | 14 --------- docs/about/removed-features.rst | 9 ++++++ migration/fd.c | 11 ++++--- tests/qtest/migration/precopy-tests.c | 41 --------------------------- 4 files changed, 16 insertions(+), 59 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ae9a3b8aea..1d5c4f3707 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -518,17 +518,3 @@ If the user requests a modern x86 CPU model (i.e. not = one of ``486``, ``athlon``, ``kvm32``, ``pentium``, ``pentium2``, ``pentium3``or ``qemu32`= `) a warning will be displayed until a future QEMU version when such CPUs will be rejected. - -Migration ---------- - -``fd:`` URI when used for file migration (since 9.1) -'''''''''''''''''''''''''''''''''''''''''''''''''''' - -The ``fd:`` URI can currently provide a file descriptor that -references either a socket or a plain file. These are two different -types of migration. In order to reduce ambiguity, the ``fd:`` URI -usage of providing a file descriptor to a plain file has been -deprecated in favor of explicitly using the ``file:`` URI with the -file descriptor being passed as an ``fdset``. Refer to the ``add-fd`` -command documentation for details on the ``fdset`` usage. diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index 92f80a32e4..41bec8b8e3 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -716,6 +716,15 @@ Use blockdev-mirror with NBD instead. See "QMP invocat= ion for live storage migration with ``blockdev-mirror`` + NBD" in docs/interop/live-block-operations.rst for a detailed explanation. =20 +``migrate`` command with file-based ``fd:`` URI (removed in 11.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +In order to reduce ambiguity, the ``fd:`` URI usage of providing a +file descriptor to a plain file has been removed in favor of +explicitly using the ``file:`` URI with the file descriptor being +passed as an ``fdset``. Refer to the ``add-fd`` command documentation +for details on the ``fdset`` usage. + ``migrate-set-capabilities`` ``block`` option (removed in 9.1) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/migration/fd.c b/migration/fd.c index 9bf9be6acb..fdeece2101 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -24,6 +24,7 @@ #include "qemu/sockets.h" #include "io/channel-util.h" #include "trace.h" +#include "qapi/error.h" =20 static bool fd_is_pipe(int fd) { @@ -58,8 +59,9 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 if (!migration_fd_valid(fd)) { - warn_report("fd: migration to a file is deprecated." - " Use file: instead."); + error_setg(errp, "fd: migration to a file is not supported." + " Use file: instead."); + return; } =20 trace_migration_fd_outgoing(fd); @@ -92,8 +94,9 @@ void fd_start_incoming_migration(const char *fdname, Erro= r **errp) } =20 if (!migration_fd_valid(fd)) { - warn_report("fd: migration to a file is deprecated." - " Use file: instead."); + error_setg(errp, "fd: migration to a file is not supported." + " Use file: instead."); + return; } =20 trace_migration_fd_incoming(fd); diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 0283da43e3..a5423ca33c 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -289,45 +289,6 @@ static void test_precopy_fd_socket(char *name, Migrate= Common *args) =20 test_precopy_common(args); } - -static void *migrate_hook_start_precopy_fd_file(QTestState *from, - QTestState *to) -{ - g_autofree char *file =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); - int src_flags =3D O_CREAT | O_RDWR; - int dst_flags =3D O_CREAT | O_RDWR; - int fds[2]; - - fds[0] =3D open(file, src_flags, 0660); - assert(fds[0] !=3D -1); - - fds[1] =3D open(file, dst_flags, 0660); - assert(fds[1] !=3D -1); - - - qtest_qmp_fds_assert_success(to, &fds[0], 1, - "{ 'execute': 'getfd'," - " 'arguments': { 'fdname': 'fd-mig' }}"); - - qtest_qmp_fds_assert_success(from, &fds[1], 1, - "{ 'execute': 'getfd'," - " 'arguments': { 'fdname': 'fd-mig' }}"); - - close(fds[0]); - close(fds[1]); - - return NULL; -} - -static void test_precopy_fd_file(char *name, MigrateCommon *args) -{ - args->listen_uri =3D "defer"; - args->connect_uri =3D "fd:fd-mig"; - args->start_hook =3D migrate_hook_start_precopy_fd_file; - args->end_hook =3D migrate_hook_end_fd; - - test_file_common(args, true); -} #endif /* _WIN32 */ =20 /* @@ -1255,8 +1216,6 @@ void migration_test_add_precopy(MigrationTestEnv *env) #ifndef _WIN32 migration_test_add("/migration/precopy/fd/tcp", test_precopy_fd_socket); - migration_test_add("/migration/precopy/fd/file", - test_precopy_fd_file); #endif =20 /* --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198215; cv=none; d=zohomail.com; s=zohoarc; b=dnN5b455St7AU680LCTi52wFcgufa+EoaEWu2okqL72bdBSX0g0JuV4sh1T9JC7iN0pjyJtLHSkkGBkZgwRZdR6sFg6qZm9avTsJ26iDK9bPPwm+qouhav3Zs18Wqo7ea3jq5JLwtdC9A5ssA4VvKJaCtyBSZ7WqiDa05We63Z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198215; h=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=AuoDLyyk/3E2QhjL/ir3+uXfbzvNvj0G+c3J869J/XE=; b=bF0e5VqaKZRFhKZWPMfVMW5n72EPdD9pkOYlragnIHag89jPuRkTqdKUS58LO2gaxMLi+OSrtTBUyqFsJ/DQCL9BZqJcke2wEMBSvW5uj0/waoTXVnWnSfJMF6mhY8IjQe6jLW0KFwD1RSDffi8o5Y2/HTg64qn47PPR7VFjnrk= 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 1769198215253864.1509714106351; Fri, 23 Jan 2026 11:56:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNF1-0002Np-6l; Fri, 23 Jan 2026 14:54:47 -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 1vjNEz-0002LT-5z for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:45 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEx-0003Xh-JO for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:44 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 71AF63385F; Fri, 23 Jan 2026 19:54:17 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5DE581395E; Fri, 23 Jan 2026 19:54:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EJLTB+jRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198057; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuoDLyyk/3E2QhjL/ir3+uXfbzvNvj0G+c3J869J/XE=; b=ug3jRqLHwhSyIxykXV5gPgm9Fv2rAsgqn/rXu85GT+NVnV391Ewwb4FAYHBagviZDYJVTx P5MNWvFyhFYw247yGwszVKF/Bu6fNirXxWIvpbsP+8vRVmKycLMtl5kHPjYCJEC8UpU+Cy gdyOjnRAoNxMetmRfy8XSfGnilbnNfc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198057; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuoDLyyk/3E2QhjL/ir3+uXfbzvNvj0G+c3J869J/XE=; b=Dkg378tNCcAaxHeTqIZgMW/KZLzHyraCD0SSijKGIpyiDVsFVM909yO5lNPTgYqAnZFNds YNUkUeZRro3C9sAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ug3jRqLH; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Dkg378tN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198057; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuoDLyyk/3E2QhjL/ir3+uXfbzvNvj0G+c3J869J/XE=; b=ug3jRqLHwhSyIxykXV5gPgm9Fv2rAsgqn/rXu85GT+NVnV391Ewwb4FAYHBagviZDYJVTx P5MNWvFyhFYw247yGwszVKF/Bu6fNirXxWIvpbsP+8vRVmKycLMtl5kHPjYCJEC8UpU+Cy gdyOjnRAoNxMetmRfy8XSfGnilbnNfc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198057; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuoDLyyk/3E2QhjL/ir3+uXfbzvNvj0G+c3J869J/XE=; b=Dkg378tNCcAaxHeTqIZgMW/KZLzHyraCD0SSijKGIpyiDVsFVM909yO5lNPTgYqAnZFNds YNUkUeZRro3C9sAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 12/36] migration: Remove redundant state change Date: Fri, 23 Jan 2026 16:53:27 -0300 Message-ID: <20260123195352.12850-13-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 71AF63385F X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198216975154100 Content-Type: text/plain; charset="utf-8" If local_err is set, migration_connect_error_propagate() will be called and that function already has a state transition from SETUP to FAILED. Reviewed-by: Peter Xu Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-2-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/migration.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4062c12d33..b46e01b8c0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2323,8 +2323,6 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { error_setg(&local_err, "uri is not a valid migration protocol"); - migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); } =20 if (local_err) { --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198181; cv=none; d=zohomail.com; s=zohoarc; b=R6OmzwhUYy8BoPR4m+i1ZauppRc3YS9jhfROQO0ai/mgwTeHdq1AV//FKlGu0s0qoZ+Ia+rXjs535sBfTeMBks8HJzr/b8OwUjwq8cSa51cniryYzV5XuqZLzsMohx0M5dsv9lSCJfHZNJ5Gitn+sBkOfT0sp+dr4OOMcsQCXnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198181; h=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=cO4ra0lKk23qtqVNB9is0PdTmRJPEqr4zx/qXcdsIg0=; b=K2ctw6SmMgUuOP06sTCwBdb/F8H9TObi/hYZ2qfzjvZ/8SBhDd71Pn8M4eZEYVGy+oO3E7Kd//NLmA8Q7E74KO58ltvJHlqK1hdG3BK9nrCwfylCwM9fjRpU7du6H3rviqw2QdFAUE2PYPxLY3X3IR+FsfxpUqWzLRAsEEe7IVE= 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 1769198181303402.29030871558666; Fri, 23 Jan 2026 11:56:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEn-00025q-64; Fri, 23 Jan 2026 14:54:33 -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 1vjNEl-000257-97 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:31 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEj-0003Vg-RH for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:31 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 416C85BCC7; Fri, 23 Jan 2026 19:54:19 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E0F231395E; Fri, 23 Jan 2026 19:54:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yHirJ+nRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cO4ra0lKk23qtqVNB9is0PdTmRJPEqr4zx/qXcdsIg0=; b=G4EX+FHFfDoCBpPGYN4KMA446ewCOuarMRsun0hVPcbVX5BjT++hclbZaKdBEX7pU9TFaV hW+Abc2Vh6krpc92tBv/D9cTG2EKxGjMWsauaT1PUhM66Sqh6S2j0Hs4eZlhi4g5Hochx9 U6BM17YlE64TCgPugmq8iQznCHBHB5M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cO4ra0lKk23qtqVNB9is0PdTmRJPEqr4zx/qXcdsIg0=; b=IZiwNLsD6C4D65SAtNqcgu89NFW4CPF/h9pNLhwa4DFEvPI3IbI4vkJ2oSjSByJMgn+csF 8S0PCyjqgQc+WjDw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=G4EX+FHF; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=IZiwNLsD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cO4ra0lKk23qtqVNB9is0PdTmRJPEqr4zx/qXcdsIg0=; b=G4EX+FHFfDoCBpPGYN4KMA446ewCOuarMRsun0hVPcbVX5BjT++hclbZaKdBEX7pU9TFaV hW+Abc2Vh6krpc92tBv/D9cTG2EKxGjMWsauaT1PUhM66Sqh6S2j0Hs4eZlhi4g5Hochx9 U6BM17YlE64TCgPugmq8iQznCHBHB5M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cO4ra0lKk23qtqVNB9is0PdTmRJPEqr4zx/qXcdsIg0=; b=IZiwNLsD6C4D65SAtNqcgu89NFW4CPF/h9pNLhwa4DFEvPI3IbI4vkJ2oSjSByJMgn+csF 8S0PCyjqgQc+WjDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 13/36] migration: Fix state change at migration_channel_process_incoming Date: Fri, 23 Jan 2026 16:53:28 -0300 Message-ID: <20260123195352.12850-14-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 416C85BCC7 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198182426158500 Content-Type: text/plain; charset="utf-8" When the incoming migration fails during the channel connection phase, the state transition to FAILED is currently being done in the MigrationState->state, but the MigrationIncomingState->state is the one that should be used. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-3-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/channel.c b/migration/channel.c index 92435fa7f7..4768c71455 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -48,7 +48,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) =20 if (local_err) { error_report_err(local_err); - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); + migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED= ); if (mis->exit_on_error) { exit(EXIT_FAILURE); } --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198114; cv=none; d=zohomail.com; s=zohoarc; b=U9fJ/1RqhqiQuEbIKnCQXDKh24zfzQ4vjS3ygM7/D/gQq3r4lloJji6POyMleqimfJaXX58Xer7LDU7afzdKu+mUabFS53fc0bqFt/aLi1Q2RdUNpLvmjYab8PHGr3w78Zshg2KNZt5o79U7ETjoMjDuxy8MkBN/xOuLV9L6LM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198114; h=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=L1QVuy4S2iBSycq/jK+3tgfakh+nEA6Rqn78Yi22uow=; b=nY5lVDG4UFLX6bK1AUeSiUucrlsFXPphv1j6qlAmDqGUt3eJQKdVR6yUrG6zYfjZcSmgnpGJIqD6QNhU2+SGhyBFs1z8pjQyY6j8uLpDeM1sWOSmSF7qSzcJfSPSmDphlUoAYJfwt/sj0sv5/pf4NJCtLwepiL5G+gtFZ2kYK2U= 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 17691981146436.726681051172022; Fri, 23 Jan 2026 11:55:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEs-00028p-QL; Fri, 23 Jan 2026 14:54:38 -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 1vjNEr-00027v-2g for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:37 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEp-0003Wh-Aw for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:36 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 103655BCCC; Fri, 23 Jan 2026 19:54:21 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AF8BE1395E; Fri, 23 Jan 2026 19:54:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oEy2G+vRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1QVuy4S2iBSycq/jK+3tgfakh+nEA6Rqn78Yi22uow=; b=L4p5yOpc9nQ4eZZ6+MK4DciNthzgoLNUYJlBwIAOaL22Kx9J1nXx7f2wIVsK74PzC6FccJ uswGBGxhb1XPB0GIjKQT9HxSvii5FpAOx60qzV551BCzO2OfwCNjbAgGOtnebH98Z6O7vO FGlndokl6tMs5PqOlp640T5RmSNS5RA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1QVuy4S2iBSycq/jK+3tgfakh+nEA6Rqn78Yi22uow=; b=cWzp2IFmxPwI78wqgtTd5MfCi/CoIOEN2k/WDYw6IHZWIiKokRm2HkU57m96OKxAPZFaAn 822FOxk0WOJ3dqBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=L4p5yOpc; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=cWzp2IFm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1QVuy4S2iBSycq/jK+3tgfakh+nEA6Rqn78Yi22uow=; b=L4p5yOpc9nQ4eZZ6+MK4DciNthzgoLNUYJlBwIAOaL22Kx9J1nXx7f2wIVsK74PzC6FccJ uswGBGxhb1XPB0GIjKQT9HxSvii5FpAOx60qzV551BCzO2OfwCNjbAgGOtnebH98Z6O7vO FGlndokl6tMs5PqOlp640T5RmSNS5RA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1QVuy4S2iBSycq/jK+3tgfakh+nEA6Rqn78Yi22uow=; b=cWzp2IFmxPwI78wqgtTd5MfCi/CoIOEN2k/WDYw6IHZWIiKokRm2HkU57m96OKxAPZFaAn 822FOxk0WOJ3dqBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 14/36] migration/tls: Remove unused parameter Date: Fri, 23 Jan 2026 16:53:29 -0300 Message-ID: <20260123195352.12850-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 103655BCCC X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198117937154100 Content-Type: text/plain; charset="utf-8" The MigrationState parameter is not used at migration_tls_channel_process_incoming(). The last usage was removed by commit 3f461a0c0b ("migration: Drop unused parameter for migration_tls_get_creds()") Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-4-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/channel.c | 3 +-- migration/tls.c | 4 +--- migration/tls.h | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 4768c71455..b4ab676048 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -32,7 +32,6 @@ */ void migration_channel_process_incoming(QIOChannel *ioc) { - MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; =20 @@ -40,7 +39,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) ioc, object_get_typename(OBJECT(ioc))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_process_incoming(s, ioc, &local_err); + migration_tls_channel_process_incoming(ioc, &local_err); } else { migration_ioc_register_yank(ioc); migration_ioc_process_incoming(ioc, &local_err); diff --git a/migration/tls.c b/migration/tls.c index 56b5d1cc90..1df31bdcbb 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -71,9 +71,7 @@ static void migration_tls_incoming_handshake(QIOTask *tas= k, object_unref(OBJECT(ioc)); } =20 -void migration_tls_channel_process_incoming(MigrationState *s, - QIOChannel *ioc, - Error **errp) +void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp) { QCryptoTLSCreds *creds; QIOChannelTLS *tioc; diff --git a/migration/tls.h b/migration/tls.h index 58b25e1228..7607cfe803 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -24,9 +24,7 @@ #include "io/channel.h" #include "io/channel-tls.h" =20 -void migration_tls_channel_process_incoming(MigrationState *s, - QIOChannel *ioc, - Error **errp); +void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp); =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, const char *hostname, --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198192; cv=none; d=zohomail.com; s=zohoarc; b=NVPu5j15/9VsHhMjD+IVV9w8ogu9kntrlrv63cmDYLrGQVSWF0lmukAODTmbtZh+q3qOiF1kGa2KRpjVADzv1rHQj8G9MJr7oJmx0C4MGpVbHSrLEtttQNXOhZ2n37XCu6wLqvn8wzZDER8Sppzipu85ygKWLYjzjsNlIXjU4jY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198192; h=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=3P2j2KMhBI33MDwUhVbw/y26mwVUcllMHFzAlWioDqY=; b=RwzPxkogDqwmsifWCoA5wSKUYc+Zq3Lp3fydCOsuxYxmnohFiUWxEov+mY/NjGkhJYe07QZK6+7LhCMn3vzctIxj2Jgk4WDufM+h0mmkUJGgbAKKlKi72zKWyN7kSQZWK1+zzQSopVjhQG7w8BkKtRJkaYhTE0JM6lNK89LFbhE= 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 1769198192237636.5155120319483; Fri, 23 Jan 2026 11:56:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNEz-0002Lo-G5; Fri, 23 Jan 2026 14:54:45 -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 1vjNEx-0002JB-7T for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:43 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNEu-0003XY-Mv for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:42 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id D267E5BCCD; Fri, 23 Jan 2026 19:54:22 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7D0D81395E; Fri, 23 Jan 2026 19:54:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kDhpD+3Rc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198062; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3P2j2KMhBI33MDwUhVbw/y26mwVUcllMHFzAlWioDqY=; b=TGt7ClHgH0edxT2OEeE9AADbfX30EX4o6qCv7WQTNPrIzXpo8J5K41A6nz56xkQ9cTSwHi qB1TsaavQAIqv9S4ChepiYpqLGS0MmdZbmZ1+igUajph4LYG7GAO9H9WmWR2RC/mXAY/CK iiC99wkEjFISAHOI+2gtOxb0ex3L3nA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198062; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3P2j2KMhBI33MDwUhVbw/y26mwVUcllMHFzAlWioDqY=; b=z9Ldc+cT/V7wwW6k2Hpo5Yhe+B7a5WdqWGVO9ERoscsQ7Lh3ckLFO9Ot/5XmpDIYHVl+gk a4A0FI31uA7ZxjAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198062; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3P2j2KMhBI33MDwUhVbw/y26mwVUcllMHFzAlWioDqY=; b=TGt7ClHgH0edxT2OEeE9AADbfX30EX4o6qCv7WQTNPrIzXpo8J5K41A6nz56xkQ9cTSwHi qB1TsaavQAIqv9S4ChepiYpqLGS0MmdZbmZ1+igUajph4LYG7GAO9H9WmWR2RC/mXAY/CK iiC99wkEjFISAHOI+2gtOxb0ex3L3nA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198062; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3P2j2KMhBI33MDwUhVbw/y26mwVUcllMHFzAlWioDqY=; b=z9Ldc+cT/V7wwW6k2Hpo5Yhe+B7a5WdqWGVO9ERoscsQ7Lh3ckLFO9Ot/5XmpDIYHVl+gk a4A0FI31uA7ZxjAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 15/36] migration: Cleanup TLS handshake hostname passing Date: Fri, 23 Jan 2026 16:53:30 -0300 Message-ID: <20260123195352.12850-16-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198194900154100 Content-Type: text/plain; charset="utf-8" The TLS hostname is doing a tour around the world just to be cached into s->hostname. We're already abusing MigrationState by doing that, so incorporate the s->hostname into migration_tls_hostname() and stop passing the string around. The old route was roughly: -transport code (socket.c, fd.c, etc): if (SOCKET_ADDRESS_TYPE_INET) hostname =3D saddr->u.inet.host else hostname =3D NULL migration_channel_connect(..., hostname) s->hostname =3D hostname; migration_tls_client_create(..., hostname) if (migrate_tls_hostname()) qio_channel_tls_new_client(migrate_tls_hostname()) else qio_channel_tls_new_client(hostname) -postcopy_preempt_setup: postcopy_preempt_send_channel_new migration_tls_client_create(..., s->hostname) New route is: -socket.c only: if SOCKET_ADDRESS_TYPE_INET s->hostname =3D saddr->u.inet.host migration_channel_connect() migration_tls_client_create() qio_channel_tls_new_client(migrate_tls_hostname()) -postcopy_preempt_setup: postcopy_preempt_send_channel_new migration_tls_client_create() qio_channel_tls_new_client(migrate_tls_hostname()) Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-5-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/channel.c | 6 ++---- migration/channel.h | 1 - migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/multifd.c | 9 +++------ migration/options.c | 5 +++++ migration/postcopy-ram.c | 2 +- migration/socket.c | 9 +++------ migration/tls.c | 17 ++++------------- migration/tls.h | 2 -- migration/trace-events | 10 +++++----- 12 files changed, 26 insertions(+), 41 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index b4ab676048..ba14f66d85 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,20 +60,18 @@ void migration_channel_process_incoming(QIOChannel *ioc) * * @s: Current migration state * @ioc: Channel to which we are connecting - * @hostname: Where we want to connect * @error: Error indicating failure to connect, free'd here */ void migration_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error *error) { trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), hostname, error); + ioc, object_get_typename(OBJECT(ioc)), error); =20 if (!error) { if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc, hostname, &error); + migration_tls_channel_connect(s, ioc, &error); =20 if (!error) { /* tls_channel_connect will call back to this diff --git a/migration/channel.h b/migration/channel.h index 5bdb8208a7..2215091323 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -22,7 +22,6 @@ void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error *error_in); =20 int migration_channel_read_peek(QIOChannel *ioc, diff --git a/migration/exec.c b/migration/exec.c index 20e6cccf8c..78fe0fff13 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index fdeece2101..b92bc4c4eb 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -72,7 +72,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index bb8031e3c7..c490f2b219 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/multifd.c b/migration/multifd.c index 24785db93b..a8366cd588 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -805,12 +805,10 @@ static bool multifd_tls_channel_connect(MultiFDSendPa= rams *p, QIOChannel *ioc, Error **errp) { - MigrationState *s =3D migrate_get_current(); - const char *hostname =3D s->hostname; MultiFDTLSThreadArgs *args; QIOChannelTLS *tioc; =20 - tioc =3D migration_tls_client_create(ioc, hostname, errp); + tioc =3D migration_tls_client_create(ioc, errp); if (!tioc) { return false; } @@ -820,7 +818,7 @@ static bool multifd_tls_channel_connect(MultiFDSendPara= ms *p, * created TLS channel, which has already taken a reference. */ object_unref(OBJECT(ioc)); - trace_multifd_tls_outgoing_handshake_start(ioc, tioc, hostname); + trace_multifd_tls_outgoing_handshake_start(ioc, tioc); qio_channel_set_name(QIO_CHANNEL(tioc), "multifd-tls-outgoing"); =20 args =3D g_new0(MultiFDTLSThreadArgs, 1); @@ -867,8 +865,7 @@ static void multifd_new_send_channel_async(QIOTask *tas= k, gpointer opaque) goto out; } =20 - trace_multifd_set_outgoing_channel(ioc, object_get_typename(OBJECT(ioc= )), - migrate_get_current()->hostname); + trace_multifd_set_outgoing_channel(ioc, object_get_typename(OBJECT(ioc= ))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { ret =3D multifd_tls_channel_connect(p, ioc, &local_err); diff --git a/migration/options.c b/migration/options.c index 68a4536150..1ffe85a2d8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -951,6 +951,11 @@ const char *migrate_tls_hostname(void) return s->parameters.tls_hostname->u.s; } =20 + /* hostname saved from a previously connected channel */ + if (s->hostname) { + return s->hostname; + } + return NULL; } =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index ac410676ef..f5ef93f193 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1966,7 +1966,7 @@ postcopy_preempt_send_channel_new(QIOTask *task, gpoi= nter opaque) } =20 if (migrate_channel_requires_tls_upgrade(ioc)) { - tioc =3D migration_tls_client_create(ioc, s->hostname, &local_err); + tioc =3D migration_tls_client_create(ioc, &local_err); if (!tioc) { goto out; } diff --git a/migration/socket.c b/migration/socket.c index 9e379bf56f..426f363b99 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -44,7 +44,6 @@ void socket_send_channel_create(QIOTaskFunc f, void *data) =20 struct SocketConnectData { MigrationState *s; - char *hostname; }; =20 static void socket_connect_data_free(void *opaque) @@ -53,7 +52,6 @@ static void socket_connect_data_free(void *opaque) if (!data) { return; } - g_free(data->hostname); g_free(data); } =20 @@ -69,7 +67,7 @@ static void socket_outgoing_migration(QIOTask *task, goto out; } =20 - trace_migration_socket_outgoing_connected(data->hostname); + trace_migration_socket_outgoing_connected(); =20 if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { @@ -77,7 +75,7 @@ static void socket_outgoing_migration(QIOTask *task, } =20 out: - migration_channel_connect(data->s, sioc, data->hostname, err); + migration_channel_connect(data->s, sioc, err); object_unref(OBJECT(sioc)); } =20 @@ -96,7 +94,7 @@ void socket_start_outgoing_migration(MigrationState *s, outgoing_args.saddr =3D addr; =20 if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET) { - data->hostname =3D g_strdup(saddr->u.inet.host); + s->hostname =3D g_strdup(saddr->u.inet.host); } =20 qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing"); @@ -180,4 +178,3 @@ void socket_start_incoming_migration(SocketAddress *sad= dr, qapi_free_SocketAddress(address); } } - diff --git a/migration/tls.c b/migration/tls.c index 1df31bdcbb..82f58cbc78 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -112,12 +112,11 @@ static void migration_tls_outgoing_handshake(QIOTask = *task, } else { trace_migration_tls_outgoing_handshake_complete(); } - migration_channel_connect(s, ioc, NULL, err); + migration_channel_connect(s, ioc, err); object_unref(OBJECT(ioc)); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, - const char *hostname, Error **errp) { QCryptoTLSCreds *creds; @@ -127,29 +126,21 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel= *ioc, return NULL; } =20 - const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname) { - hostname =3D tls_hostname; - } - - return qio_channel_tls_new_client(ioc, creds, hostname, errp); + return qio_channel_tls_new_client(ioc, creds, migrate_tls_hostname(), = errp); } =20 void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error **errp) { QIOChannelTLS *tioc; =20 - tioc =3D migration_tls_client_create(ioc, hostname, errp); + tioc =3D migration_tls_client_create(ioc, errp); if (!tioc) { return; } =20 - /* Save hostname into MigrationState for handshake */ - s->hostname =3D g_strdup(hostname); - trace_migration_tls_outgoing_handshake_start(hostname); + trace_migration_tls_outgoing_handshake_start(); qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing"); =20 if (migrate_postcopy_ram() || migrate_return_path()) { diff --git a/migration/tls.h b/migration/tls.h index 7607cfe803..7cd9c76013 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -27,12 +27,10 @@ void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp); =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, - const char *hostname, Error **errp); =20 void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error **errp); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ diff --git a/migration/trace-events b/migration/trace-events index bf11b62b17..da8f909cac 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -149,10 +149,10 @@ multifd_send_sync_main_wait(uint8_t id) "channel %u" multifd_send_terminate_threads(void) "" multifd_send_thread_end(uint8_t id, uint64_t packets) "channel %u packets = %" PRIu64 multifd_send_thread_start(uint8_t id) "%u" -multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *ho= stname) "ioc=3D%p tioc=3D%p hostname=3D%s" +multifd_tls_outgoing_handshake_start(void *ioc, void *tioc) "ioc=3D%p tioc= =3D%p" multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=3D%p= err=3D%s" multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=3D%p" -multifd_set_outgoing_channel(void *ioc, const char *ioctype, const char *h= ostname) "ioc=3D%p ioctype=3D%s hostname=3D%s" +multifd_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p io= ctype=3D%s" =20 # migration.c migrate_set_state(const char *new_state) "new state %s" @@ -204,7 +204,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype, const char = *hostname, void *err) "ioc=3D%p ioctype=3D%s hostname=3D%s err=3D%p" +migration_set_outgoing_channel(void *ioc, const char *ioctype, void *err) = "ioc=3D%p ioctype=3D%s err=3D%p" =20 # global_state.c migrate_state_too_big(void) "" @@ -328,11 +328,11 @@ migration_file_incoming(const char *filename) "filena= me=3D%s" =20 # socket.c migration_socket_incoming_accepted(void) "" -migration_socket_outgoing_connected(const char *hostname) "hostname=3D%s" +migration_socket_outgoing_connected(void) "" migration_socket_outgoing_error(const char *err) "error=3D%s" =20 # tls.c -migration_tls_outgoing_handshake_start(const char *hostname) "hostname=3D%= s" +migration_tls_outgoing_handshake_start(void) "" migration_tls_outgoing_handshake_error(const char *err) "err=3D%s" migration_tls_outgoing_handshake_complete(void) "" migration_tls_incoming_handshake_start(void) "" --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198282; cv=none; d=zohomail.com; s=zohoarc; b=KwylM1tX+WFFaGwvXjjhLLHcW44bXFjPxHXi3SxOJfveSOXqDCHpZIvVW0WJ/ir2MpTBIxFJNH2Tw/a8gfXtb8Puycca0aQencx24iDacmgQ+nhQGn99Rcui4SRvVZvMbBUpVi4ajT+7RJYT6Gy7kkYQWzQ1Yzu710M/YwlAvTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198282; h=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=cY7wnAHX7L3molQ8xknNrSG2tO6JiAhhNEOk6WxZQHs=; b=Jcyy4szJkYw5A1DiTIOJD0nZU1RlHWMwPBIGZkVIar7UTnmb/m+DIvwkCtaLI9Zw4JWArTOjFhHM2zZnkssaexhII/xZ94iYREtm/bgyHgAWyFgEyYEQ4LzKIeXkY9k1MQ5SgaYAH4KMWMVMsnENNom6yFSYbZBnxOKInjZHuoQ= 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 1769198282964387.68939040973476; Fri, 23 Jan 2026 11:58:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNF7-00036L-Cq; Fri, 23 Jan 2026 14:54:53 -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 1vjNF5-0002oy-4h for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:51 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNF3-0003Yl-9R for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:50 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id A00E433866; Fri, 23 Jan 2026 19:54:24 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4B4A91395E; Fri, 23 Jan 2026 19:54:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cKMqA+/Rc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198064; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cY7wnAHX7L3molQ8xknNrSG2tO6JiAhhNEOk6WxZQHs=; b=W+lusMWPWeSWowU1u4aMMiZeBHg06oHSI7T7NxPRYjS9wb2XSND82awV67TIsFDlSksye0 NfxT6c6OqTR/aYLtX+ZYCzRxNYlz41i0hD1yrwb8BkwZEorz4vKVmLxRfL2hb2xLOnzY0X oStRa+4tph9LJMmeYx5olB0iHC9qqJQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198064; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cY7wnAHX7L3molQ8xknNrSG2tO6JiAhhNEOk6WxZQHs=; b=bkTghgdUIs+abalXViSIYgizkQAeMWXg7FrD6P7ffQah1vbdCMhG3aEyRrhSIXRxfxu+zp CsEYr6k07+pew4DQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198064; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cY7wnAHX7L3molQ8xknNrSG2tO6JiAhhNEOk6WxZQHs=; b=W+lusMWPWeSWowU1u4aMMiZeBHg06oHSI7T7NxPRYjS9wb2XSND82awV67TIsFDlSksye0 NfxT6c6OqTR/aYLtX+ZYCzRxNYlz41i0hD1yrwb8BkwZEorz4vKVmLxRfL2hb2xLOnzY0X oStRa+4tph9LJMmeYx5olB0iHC9qqJQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198064; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cY7wnAHX7L3molQ8xknNrSG2tO6JiAhhNEOk6WxZQHs=; b=bkTghgdUIs+abalXViSIYgizkQAeMWXg7FrD6P7ffQah1vbdCMhG3aEyRrhSIXRxfxu+zp CsEYr6k07+pew4DQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 16/36] migration: Move postcopy_try_recover into migration_incoming_process Date: Fri, 23 Jan 2026 16:53:31 -0300 Message-ID: <20260123195352.12850-17-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198284009154100 Content-Type: text/plain; charset="utf-8" The postcopy_try_recover() call doesn't need to be duplicated, move it into migration_incoming_process(). This removes code from migration_fd_process_incoming() so it can be removed in the near future. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-6-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/migration.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b46e01b8c0..ec45996654 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -942,12 +942,6 @@ static void migration_incoming_setup(QEMUFile *f) qemu_file_set_blocking(f, false, &error_abort); } =20 -void migration_incoming_process(void) -{ - Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); - qemu_coroutine_enter(co); -} - /* Returns true if recovered from a paused migration, otherwise false */ static bool postcopy_try_recover(void) { @@ -981,12 +975,19 @@ static bool postcopy_try_recover(void) return false; } =20 +void migration_incoming_process(void) +{ + if (postcopy_try_recover()) { + return; + } + + Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); + qemu_coroutine_enter(co); +} + void migration_fd_process_incoming(QEMUFile *f) { migration_incoming_setup(f); - if (postcopy_try_recover()) { - return; - } migration_incoming_process(); } =20 @@ -1086,10 +1087,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc,= Error **errp) } =20 if (migration_has_main_and_multifd_channels()) { - /* If it's a recovery, we're done */ - if (postcopy_try_recover()) { - return; - } migration_incoming_process(); } } --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198204; cv=none; d=zohomail.com; s=zohoarc; b=kXP83oVV0nLHxsbhLiLHk/JE0JmoTZNXeLLol5tsDyEgP0CcARPB2VSp/ispC0R/oVn4nsa/bOqUcIi1bQ1RPDHT1cLUJHg8YUsC2EWT3+/x8BLff+qSiYRXpGXJv2oxGWD66vMDd3pbB3Hig28fLxUkq6o6rPn6GSW/2lB6gHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198204; h=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=nadf+TWitNjFU/RDFRbNn80F/t/s0DMQqW9FyvH7ErA=; b=m6h9ENtGhg6hBUagOuwhDrhJzScf5fgBF8dGwdnTIyHmU0GR4gIw0Lf+U1xZ4ppJS62tOhyjanSCW22WhTYlbGPi5gGW5aWMdlT1pbXiqzuXEmmbnyW1qabjcwPG6BiM/A3WX+Ig8Eh6IyhFsBCsfGAfzVYOfwBcIQpAxBTNa9Y= 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 1769198204707960.222181399399; Fri, 23 Jan 2026 11:56:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNF5-0002pa-A8; Fri, 23 Jan 2026 14:54:51 -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 1vjNF3-0002f7-Tr for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:49 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNF1-0003YO-8K for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:49 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id EA09C5BCCF; Fri, 23 Jan 2026 19:54:26 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 189281395E; Fri, 23 Jan 2026 19:54:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CK6PMvDRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198067; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nadf+TWitNjFU/RDFRbNn80F/t/s0DMQqW9FyvH7ErA=; b=1013o99MGUgUhPo+wu6+KvUQ4rchPQX6IqAjQA1lXH5b2FHTLluhmGDju58yw9mwHJdUv+ /st8JSr4jP5lCyl1k4w6a822jYmWacX4l8zPrEj582Xk3n47VPMKBCy8Bd7lk8rtHuG9Ap fxHnnsdzfL9wl7P8ze9GtHyU/bwaeiw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198067; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nadf+TWitNjFU/RDFRbNn80F/t/s0DMQqW9FyvH7ErA=; b=wlDnxfPtqsW/DOQwFRoMjNidSteFn27XJgalA1jp0ldCmve9UgkUQiE6Xy3qjoQy09wpJ5 Ui0eGUy9RvnVG4Bw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198066; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nadf+TWitNjFU/RDFRbNn80F/t/s0DMQqW9FyvH7ErA=; b=nZKQwKu8rk9MVxfLDd/aoWgCXMp4YXwaM4/1Jm2hfn2XptRdTzM+n9YXatIHFJYrgqWql9 0Lv+6GC/tOPcrw/G8ZZmoj4xY/1rEInh+NvyRQR9g4exquvp9zjTj4xvVYW6P6+Z2GvdZA HuVe6tXGewZPMcP/cxl6nh9HJ4kzhUg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198066; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nadf+TWitNjFU/RDFRbNn80F/t/s0DMQqW9FyvH7ErA=; b=JV1K7hpwVjpUVVSDAbah5fGjb8cc+uyZPzF86MoLG8QHjvyntbg8SkwZ1YH3yPefQbOFcx xLLL9VCnHnH0woAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Mark Kanda , Ben Chaney , Prasad Pandit Subject: [PULL 17/36] migration: Use migrate_mode() to query for cpr-transfer Date: Fri, 23 Jan 2026 16:53:32 -0300 Message-ID: <20260123195352.12850-18-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[oracle.com:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769198206617158500 Content-Type: text/plain; charset="utf-8" cpr_set_incoming_mode() is only called on the target side, so migrate_mode() on the source side is the same as s->parameters.mode. Use the function to reduce explicit access to s->parameters, we have options.c for that. Cc: Mark Kanda Cc: Ben Chaney Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-7-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/cpr-exec.c | 2 +- migration/migration.c | 27 +++++++++++++-------------- migration/migration.h | 5 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index da287d8031..e315a30f92 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -164,7 +164,7 @@ static void cpr_exec_cb(void *opaque) err =3D NULL; =20 /* Note, we can go from state COMPLETED to FAILED */ - migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); =20 if (!migration_block_activate(&err)) { /* error was already reported */ diff --git a/migration/migration.c b/migration/migration.c index ec45996654..d34c31298e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1533,7 +1533,7 @@ static void migration_cleanup(MigrationState *s) } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; - migration_call_notifiers(s, type, NULL); + migration_call_notifiers(type, NULL); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 @@ -1693,10 +1693,9 @@ void migration_remove_notifier(NotifierWithReturn *n= otify) } } =20 -int migration_call_notifiers(MigrationState *s, MigrationEventType type, - Error **errp) +int migration_call_notifiers(MigrationEventType type, Error **errp) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D migrate_mode(); MigrationEvent e; NotifierWithReturn *notifier; GSList *elem, *next; @@ -1777,9 +1776,9 @@ bool migration_thread_is_self(void) return qemu_thread_is_self(&s->thread); } =20 -bool migrate_mode_is_cpr(MigrationState *s) +bool migrate_mode_is_cpr(void) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D migrate_mode(); return mode =3D=3D MIG_MODE_CPR_REBOOT || mode =3D=3D MIG_MODE_CPR_TRANSFER || mode =3D=3D MIG_MODE_CPR_EXEC; @@ -2133,7 +2132,7 @@ static bool migrate_prepare(MigrationState *s, bool r= esume, Error **errp) } } =20 - if (migrate_mode_is_cpr(s)) { + if (migrate_mode_is_cpr()) { const char *conflict =3D NULL; =20 if (migrate_postcopy()) { @@ -2249,7 +2248,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - if (s->parameters.mode =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { error_setg(errp, "missing 'cpr' migration channel"); return; } @@ -2274,7 +2273,7 @@ void qmp_migrate(const char *uri, bool has_channels, * in which case the target will not listen for the incoming migration * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ - if (s->parameters.mode =3D=3D MIG_MODE_CPR_TRANSFER) { + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, QAPI_CLONE(MigrationAddress, addr)); =20 @@ -2849,7 +2848,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) * at the transition to postcopy and after the device state; in partic= ular * spice needs to trigger a transition now */ - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_DONE, NULL); =20 migration_downtime_end(ms); =20 @@ -2898,7 +2897,7 @@ fail: migrate_set_state(&ms->state, ms->state, MIGRATION_STATUS_FAILED); } migration_block_activate(NULL); - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_FAILED, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); bql_unlock(); return -1; } @@ -3000,7 +2999,7 @@ static int migration_completion_precopy(MigrationStat= e *s) =20 bql_lock(); =20 - if (!migrate_mode_is_cpr(s)) { + if (!migrate_mode_is_cpr()) { ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { goto out_unlock; @@ -4041,7 +4040,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) rate_limit =3D migrate_max_bandwidth(); =20 /* Notify before starting migration thread */ - if (migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP, &local_er= r)) { + if (migration_call_notifiers(MIG_EVENT_PRECOPY_SETUP, &local_err))= { goto fail; } } @@ -4077,7 +4076,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) return; } =20 - if (migrate_mode_is_cpr(s)) { + if (migrate_mode_is_cpr()) { ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { error_setg(&local_err, "migration_stop_vm failed, error %d", -= ret); diff --git a/migration/migration.h b/migration/migration.h index ccc4e536a5..8b55d4741a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -538,8 +538,7 @@ bool migrate_has_error(MigrationState *s); =20 void migration_connect(MigrationState *s, Error *error_in); =20 -int migration_call_notifiers(MigrationState *s, MigrationEventType type, - Error **errp); +int migration_call_notifiers(MigrationEventType type, Error **errp); =20 int migrate_init(MigrationState *s, Error **errp); bool migration_is_blocked(Error **errp); @@ -548,7 +547,7 @@ bool migration_in_postcopy(void); bool migration_postcopy_is_alive(MigrationStatus state); MigrationState *migrate_get_current(void); bool migration_has_failed(MigrationState *); -bool migrate_mode_is_cpr(MigrationState *); +bool migrate_mode_is_cpr(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198127; cv=none; d=zohomail.com; s=zohoarc; b=bHW6qPTkDYMQnxVadAMslaexX6pQSuIudde1rM5vtbc053/00N/nCXP/DPSbFzy8XstsljNXKNXKCW7f5D7zK3UobhkoEUDrfJbNa3Wt58vh0IHmwaSYXZjx6IF3n0RLkB5XSk0KMKnYKBLv02fxzib+zDwGYL9nDLpnEt2zU6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198127; h=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=3/nFSuzQ0Lf2TU/iY+VKzqdVQEAVcTY8BBevBt3b5aQ=; b=e/YvvspCR1A9a0HPubRv8WQNFuXSY+JvmUQHFVj6n+04KUMtXoY0UQ+OH1m0EAAHvOLmOArXqUVvnYN4aAFzAw9lJOxeWqgBQ1eEFdGqRd80LtaQyRzs3XhXJZKzhgWwJ0qZrAtsr2ynNW7lxT6NCQd4bkAPayLJDCea6hwPIMY= 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 1769198127148700.1942832937925; Fri, 23 Jan 2026 11:55:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFD-0003bE-NY; Fri, 23 Jan 2026 14:54:59 -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 1vjNFA-0003Kb-PK for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:56 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNF8-0003ZU-T8 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:56 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id B727333863; Fri, 23 Jan 2026 19:54:28 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 623971395E; Fri, 23 Jan 2026 19:54:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KGaqCPPRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/nFSuzQ0Lf2TU/iY+VKzqdVQEAVcTY8BBevBt3b5aQ=; b=lT1jGESMwOeBQU9lFUoWt6D4ILLOdXQc/MmS85DhGBsrht/N+8ORVBvzsTSubciKGE+dpe M01wdT1z0uIQ07J/F1Tr3nixlbazO1npSAyDWSOZZEuzU42EMgiWy76RfiWpIsy1VjNcwb XdkC19iWbWKXwGs1OMGqO4IvoBVUwTI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/nFSuzQ0Lf2TU/iY+VKzqdVQEAVcTY8BBevBt3b5aQ=; b=FmLWICb3EZBnIlddvMNQ8lowIJzGmaV2vpPDxWhrcB/4/ts8mLIqOd58GtY7MYhwd3L/00 Ne86BNzGrORgmgCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/nFSuzQ0Lf2TU/iY+VKzqdVQEAVcTY8BBevBt3b5aQ=; b=lT1jGESMwOeBQU9lFUoWt6D4ILLOdXQc/MmS85DhGBsrht/N+8ORVBvzsTSubciKGE+dpe M01wdT1z0uIQ07J/F1Tr3nixlbazO1npSAyDWSOZZEuzU42EMgiWy76RfiWpIsy1VjNcwb XdkC19iWbWKXwGs1OMGqO4IvoBVUwTI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/nFSuzQ0Lf2TU/iY+VKzqdVQEAVcTY8BBevBt3b5aQ=; b=FmLWICb3EZBnIlddvMNQ8lowIJzGmaV2vpPDxWhrcB/4/ts8mLIqOd58GtY7MYhwd3L/00 Ne86BNzGrORgmgCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 18/36] migration: Free the error earlier in the resume case Date: Fri, 23 Jan 2026 16:53:33 -0300 Message-ID: <20260123195352.12850-19-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198129841154101 Content-Type: text/plain; charset="utf-8" Freeing the error at migration_connect() is redundant in the normal migration case. The freeing already happened at migrate_init(): qmp_migrate() -> migrate_prepare() -> migrate_init() -> qmp_migrate_finish() -> *_start_outgoing_migration() -> migration_channel_connect() -> migration_connect() For the resume case, migrate_prepare() returns early and doesn't reach migrate_init(). Move the extra migrate_error_free() call to migrate_prepare() along with the resume check. Also change migrate_init() to use migrate_error_free(), so it's easier to see where are the places the error gets freed. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-8-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/migration.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d34c31298e..93013608ef 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1808,8 +1808,8 @@ int migrate_init(MigrationState *s, Error **errp) s->setup_time =3D 0; s->start_postcopy =3D false; s->migration_thread_running =3D false; - error_free(s->error); - s->error =3D NULL; + + migrate_error_free(s); =20 if (should_send_vmdesc()) { s->vmdesc =3D json_writer_new(false); @@ -2084,6 +2084,13 @@ static bool migrate_prepare(MigrationState *s, bool = resume, Error **errp) migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_PAUSED, MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP); =20 + /* + * If there's a previous error, free it and prepare for + * another one. For the non-resume case, this happens at + * migrate_init() below. + */ + migrate_error_free(s); + /* This is a resume, skip init status */ return true; } @@ -4007,13 +4014,6 @@ void migration_connect(MigrationState *s, Error *err= or_in) bool resume =3D (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP); int ret; =20 - /* - * If there's a previous error, free it and prepare for another one. - * Meanwhile if migration completes successfully, there won't have an = error - * dumped when calling migration_cleanup(). - */ - migrate_error_free(s); - s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198149; cv=none; d=zohomail.com; s=zohoarc; b=YE/X+j99uoKXwXweeXB3gblIDoofeVgj8ge76G9HYdxsW5wuUMtD0e860mnh3d/4KiPOyb8tRQ+ULxnXZYAys3g+fpT4NkPAfbikQd4zigGHZOm/jz2JynTPRv3ZQE7PHgXqGOjNZcjZODHBbn0ncAUojnVXBUsAPP3mPS3Touk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198149; h=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=uvA72mKs7LI4Q5bMl7UpS+Asxq3ud15Jc50hDQV9YHk=; b=F/S4aG3B7GgY3PTXuKQY0XoKQWGuUnrEr6mk8YIztGKTpu1SdTCU2QItUmdsC1zYxhTrUs/DPonW7Ilz+4GPrx+oAKqznFD5K0/fPkA3cNkhZe2MS5IdHFD5vXf+7DYc+/5eanr5fpD3/JwXRsM9KjMJTbcMohvdORBvDrp1vR4= 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 1769198149581688.3724792071984; Fri, 23 Jan 2026 11:55:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFB-0003Lm-1a; Fri, 23 Jan 2026 14:54:57 -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 1vjNF9-0003ES-E3 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:55 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNF7-0003ZP-Ew for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:54:55 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 809FB5BCD0; Fri, 23 Jan 2026 19:54:30 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2EB9C1395E; Fri, 23 Jan 2026 19:54:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 6PTqN/TRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198070; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uvA72mKs7LI4Q5bMl7UpS+Asxq3ud15Jc50hDQV9YHk=; b=QmNpn7QWS1q8AtSY1GWeNZXoJCVymae9IN30SXXFL8rlLjxk3RnhLpGgql471caz5cWyR5 Bo2DXv7xDi2Kf+tqEwJMOmNPPyrrA5NFHNoSCvUVP5l5zCykcgS/gfjME5DHNkx0LnvILc 71yv8Dpke1Kwn1cLv6QAlB7sY5q1Wis= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198070; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uvA72mKs7LI4Q5bMl7UpS+Asxq3ud15Jc50hDQV9YHk=; b=l9s8HvoETsqMMdGbgjR+VV9e0Qm+zMyHM0kD7Q2C5IdWVbtdiS/mGqpmuV3KnUBkp6zRa0 xlA0DZ2/b3BHrmAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=QmNpn7QW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=l9s8HvoE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198070; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uvA72mKs7LI4Q5bMl7UpS+Asxq3ud15Jc50hDQV9YHk=; b=QmNpn7QWS1q8AtSY1GWeNZXoJCVymae9IN30SXXFL8rlLjxk3RnhLpGgql471caz5cWyR5 Bo2DXv7xDi2Kf+tqEwJMOmNPPyrrA5NFHNoSCvUVP5l5zCykcgS/gfjME5DHNkx0LnvILc 71yv8Dpke1Kwn1cLv6QAlB7sY5q1Wis= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198070; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uvA72mKs7LI4Q5bMl7UpS+Asxq3ud15Jc50hDQV9YHk=; b=l9s8HvoETsqMMdGbgjR+VV9e0Qm+zMyHM0kD7Q2C5IdWVbtdiS/mGqpmuV3KnUBkp6zRa0 xlA0DZ2/b3BHrmAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 19/36] migration: Move error reporting out of migration_cleanup Date: Fri, 23 Jan 2026 16:53:34 -0300 Message-ID: <20260123195352.12850-20-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 809FB5BCD0 X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198152232158501 Content-Type: text/plain; charset="utf-8" In the next patches migration_cleanup() will be used in qmp_migrate(), which currently does not show an error message. Move the error reporting out of migration_cleanup() to avoid duplicate messages. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-9-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/migration.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 93013608ef..000f113307 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1527,10 +1527,6 @@ static void migration_cleanup(MigrationState *s) MIGRATION_STATUS_CANCELLED); } =20 - if (s->error) { - /* It is used on info migrate. We can't free it */ - error_report_err(error_copy(s->error)); - } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; migration_call_notifiers(type, NULL); @@ -1539,7 +1535,12 @@ static void migration_cleanup(MigrationState *s) =20 static void migration_cleanup_bh(void *opaque) { - migration_cleanup(opaque); + MigrationState *s =3D opaque; + + migration_cleanup(s); + if (s->error) { + error_report_err(error_copy(s->error)); + } } =20 /* @@ -4017,18 +4018,12 @@ void migration_connect(MigrationState *s, Error *er= ror_in) s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); - if (resume) { - /* - * Don't do cleanup for resume if channel is invalid, but only= dump - * the error. We wait for another channel connect from the us= er. - * The error_report still gives HMP user a hint on what failed. - * It's normally done in migration_cleanup(), but call it here - * explicitly. - */ - error_report_err(error_copy(s->error)); - } else { + if (!resume) { migration_cleanup(s); } + if (s->error) { + error_report_err(error_copy(s->error)); + } return; } =20 @@ -4107,8 +4102,10 @@ fail: if (s->state !=3D MIGRATION_STATUS_CANCELLING) { migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); } - error_report_err(local_err); migration_cleanup(s); + if (s->error) { + error_report_err(error_copy(s->error)); + } } =20 static void migration_class_init(ObjectClass *klass, const void *data) --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198180; cv=none; d=zohomail.com; s=zohoarc; b=FwMYaNzz6itjp4uDP3rW1GxoVFcsGYz0DZAjEVn7gITVIF76VIPHEQf0NLwAgVZ9X2Pibd3zAGuV/n+opWQYIaUkslRMZgEiJ+AZpZA8vU6m3eXYWUE2Ube7r62Z2C5mDDa3IJKee2xbm2zEnFsLBeMZqZjFD6jD/71h9fYBK64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198180; h=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=IUnDK3WpqxryWIvg8TMFpCBEQuNkZay+AhRJeUZx8Yo=; b=Y0Kad+dgrQI9Xu5d3rBNwmFfZhAm+eVfT9fOsR3G4uvp8zEdhAvxNhkuY/hM4QKnJUVaMSMTTCEwSfISVAHirHRJxxuq8knQyzezaLSLlSAXAW9aqKnG9R8D8ulhpULD9mFaL6UwR5iI0lSoraBBkTxUslCqLo7ZmKZ0s8/iKs4= 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 1769198180849577.5817796176767; Fri, 23 Jan 2026 11:56:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFH-0003kq-Jb; Fri, 23 Jan 2026 14:55: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 1vjNFG-0003jF-0u for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:02 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFE-0003aE-AM for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:01 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 4E7F03386C; Fri, 23 Jan 2026 19:54:32 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EED151395E; Fri, 23 Jan 2026 19:54:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8BMDK/bRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198072; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IUnDK3WpqxryWIvg8TMFpCBEQuNkZay+AhRJeUZx8Yo=; b=05rRXPKZa0QN1hyND2JVRpiEIWpxJ9kOj+WbygnxcZGVWmHSiLiU6DYGtCrA2297nShNBh PwVTjTHX0wSJBxnIvSrxg3xgHJUTbTJpopruLsq95XZj4YCk2ZuLRst8+mjTcUA+KlFWj5 Ya+5OBlLEWBlKzI7XxRCLIkqMGqkoxE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198072; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IUnDK3WpqxryWIvg8TMFpCBEQuNkZay+AhRJeUZx8Yo=; b=rWFm3Pru0J1iDNksBE6NRqViIO/inHS4NLxzJBSGO/UQ578SMnene7yXBH6NGvLOjHQxUe 6zdrTuTpbKuY0VBw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=05rRXPKZ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=rWFm3Pru DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198072; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IUnDK3WpqxryWIvg8TMFpCBEQuNkZay+AhRJeUZx8Yo=; b=05rRXPKZa0QN1hyND2JVRpiEIWpxJ9kOj+WbygnxcZGVWmHSiLiU6DYGtCrA2297nShNBh PwVTjTHX0wSJBxnIvSrxg3xgHJUTbTJpopruLsq95XZj4YCk2ZuLRst8+mjTcUA+KlFWj5 Ya+5OBlLEWBlKzI7XxRCLIkqMGqkoxE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198072; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IUnDK3WpqxryWIvg8TMFpCBEQuNkZay+AhRJeUZx8Yo=; b=rWFm3Pru0J1iDNksBE6NRqViIO/inHS4NLxzJBSGO/UQ578SMnene7yXBH6NGvLOjHQxUe 6zdrTuTpbKuY0VBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 20/36] migration: Expand migration_connect_error_propagate to cover cancelling Date: Fri, 23 Jan 2026 16:53:35 -0300 Message-ID: <20260123195352.12850-21-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 4E7F03386C X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198182591154100 Content-Type: text/plain; charset="utf-8" Cover the CANCELLING state in migration_connect_error_propagate() and use it to funnel errors from migrate_prepare() until the end of migration_connect(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-10-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/migration.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 000f113307..a83edb39a0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1572,18 +1572,25 @@ static void migrate_error_free(MigrationState *s) static void migration_connect_error_propagate(MigrationState *s, Error *er= ror) { MigrationStatus current =3D s->state; - MigrationStatus next; - - assert(s->to_dst_file =3D=3D NULL); + MigrationStatus next =3D MIGRATION_STATUS_NONE; =20 switch (current) { case MIGRATION_STATUS_SETUP: next =3D MIGRATION_STATUS_FAILED; break; + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: /* Never fail a postcopy migration; switch back to PAUSED instead = */ next =3D MIGRATION_STATUS_POSTCOPY_PAUSED; break; + + case MIGRATION_STATUS_CANCELLING: + /* + * Don't move out of CANCELLING, the only valid transition is to + * CANCELLED, at migration_cleanup(). + */ + break; + default: /* * This really shouldn't happen. Just be careful to not crash a VM @@ -1594,7 +1601,10 @@ static void migration_connect_error_propagate(Migrat= ionState *s, Error *error) return; } =20 - migrate_set_state(&s->state, current, next); + if (next) { + migrate_set_state(&s->state, current, next); + } + migrate_error_propagate(s, error); } =20 @@ -4098,10 +4108,7 @@ void migration_connect(MigrationState *s, Error *err= or_in) return; =20 fail: - migrate_error_propagate(s, error_copy(local_err)); - if (s->state !=3D MIGRATION_STATUS_CANCELLING) { - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); - } + migration_connect_error_propagate(s, local_err); migration_cleanup(s); if (s->error) { error_report_err(error_copy(s->error)); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198323; cv=none; d=zohomail.com; s=zohoarc; b=arqxLmx1b9Cd1V0ArRhYNxnhgKy1rgWQJG7T3YX8iT39xz0qs1M8eiexhA0I21PFpFT5mQ6mnqqHWbU0ed+2I1A6JtbhPAsx9DCvxv1uMpSusIggJBftj46JbcgkYEs/tLv3Y0sucPpn6uwlSwkFcTRoY7FUrSIdfavCXPOTw40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198323; h=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=EBP99HjEEaobYKMdTt1XjdtLBJtwI6qoL14gQOQ+EGw=; b=ZzUrQhPR6qyKmAxPV7NepdK0M/jQrXttfjvwkcssQesm8yhwTDtXC+VcYsI2bYmRMynDU6106/LGeYD9Ulfoa5JZa9cvJx3XTqKS3lIK2brjE/h2ZvmeRF/nKlHnYX7YbcIDhIWWlpQyvdaqA601UwOd5HqSWGGo2dSMW1VVYTw= 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 1769198323131936.6043403734698; Fri, 23 Jan 2026 11:58:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFI-0003lh-03; Fri, 23 Jan 2026 14:55:04 -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 1vjNFF-0003ix-OX for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:01 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFD-0003aC-RI for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:01 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 1FB2A5BCC7; Fri, 23 Jan 2026 19:54:34 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BC8A31395E; Fri, 23 Jan 2026 19:54:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sHbiHvjRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198074; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EBP99HjEEaobYKMdTt1XjdtLBJtwI6qoL14gQOQ+EGw=; b=mT6X8SMrs9A3YoCsUQDIGExyL94BTqjr2Uecv6uX/IFrNoNUNrYPFM5KBnvBXuPZhjMhFC H4IjNHJru79rzijBkZLrizrB9VUB3O5pqsZ3tiolu831M8fdbRXrhsGf5NcTRhkTk/QaH9 xwLrN7TdFGpy8b3Wfbp8oJfa27o47eg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198074; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EBP99HjEEaobYKMdTt1XjdtLBJtwI6qoL14gQOQ+EGw=; b=R4Kd/md31R9B5y/JXJVaQexzQWxdAD3kBQGxqKHtqnz3Ww198NZ3rDW6Kb1SwJTmfKJ8vN JtS9UJni1Z0EjwBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mT6X8SMr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="R4Kd/md3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198074; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EBP99HjEEaobYKMdTt1XjdtLBJtwI6qoL14gQOQ+EGw=; b=mT6X8SMrs9A3YoCsUQDIGExyL94BTqjr2Uecv6uX/IFrNoNUNrYPFM5KBnvBXuPZhjMhFC H4IjNHJru79rzijBkZLrizrB9VUB3O5pqsZ3tiolu831M8fdbRXrhsGf5NcTRhkTk/QaH9 xwLrN7TdFGpy8b3Wfbp8oJfa27o47eg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198074; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EBP99HjEEaobYKMdTt1XjdtLBJtwI6qoL14gQOQ+EGw=; b=R4Kd/md31R9B5y/JXJVaQexzQWxdAD3kBQGxqKHtqnz3Ww198NZ3rDW6Kb1SwJTmfKJ8vN JtS9UJni1Z0EjwBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 21/36] migration: yank: Move register instance earlier Date: Fri, 23 Jan 2026 16:53:36 -0300 Message-ID: <20260123195352.12850-22-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 1FB2A5BCC7 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198325033158500 Content-Type: text/plain; charset="utf-8" Move the register_instance call to migrate_prepare() so it can be paired with the unregister_instance at migration_cleanup(). Otherwise, the cleanup cannot be run when cpr_state_save() fails because the instance is registered only after it. When resuming from a paused postcopy migration, migrate_prepare() returns early, but migration_cleanup() doesn't run, so the yank will remain paired. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-11-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a83edb39a0..fd67076b1d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2177,11 +2177,12 @@ static bool migrate_prepare(MigrationState *s, bool= resume, Error **errp) return false; } =20 + yank_register_instance(MIGRATION_YANK_INSTANCE, &error_abort); + return true; } =20 -static void qmp_migrate_finish(MigrationAddress *addr, bool resume_request= ed, - Error **errp); +static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); =20 static void migrate_hup_add(MigrationState *s, QIOChannel *ioc, GSourceFun= c cb, void *opaque) @@ -2206,7 +2207,7 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, { MigrationAddress *addr =3D opaque; =20 - qmp_migrate_finish(addr, false, NULL); + qmp_migrate_finish(addr, NULL); =20 cpr_state_close(); migrate_hup_delete(migrate_get_current()); @@ -2218,7 +2219,6 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_resume, bool resume, Error **errp) { - bool resume_requested; Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationChannel) channel =3D NULL; @@ -2271,8 +2271,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - resume_requested =3D has_resume && resume; - if (!migrate_prepare(s, resume_requested, errp)) { + if (!migrate_prepare(s, has_resume && resume, errp)) { /* Error detected, put into errp */ return; } @@ -2296,28 +2295,22 @@ void qmp_migrate(const char *uri, bool has_channels, QAPI_CLONE(MigrationAddress, addr)); =20 } else { - qmp_migrate_finish(addr, resume_requested, errp); + qmp_migrate_finish(addr, errp); } =20 out: if (local_err) { + yank_unregister_instance(MIGRATION_YANK_INSTANCE); migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); } } =20 -static void qmp_migrate_finish(MigrationAddress *addr, bool resume_request= ed, - Error **errp) +static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) { MigrationState *s =3D migrate_get_current(); Error *local_err =3D NULL; =20 - if (!resume_requested) { - if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) { - return; - } - } - if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { SocketAddress *saddr =3D &addr->u.socket; if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || @@ -2340,9 +2333,6 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, } =20 if (local_err) { - if (!resume_requested) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); - } migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); return; --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198272; cv=none; d=zohomail.com; s=zohoarc; b=H9tKmHkFaVIUxmz5awSqrZNwm1bgDrzcsqniKRZ4aJScjmpM4lfs1VGXKZie4G/GCLAFJoKlnTn3YTSku52/xq+IjaIPIi8qrkL0A+G5hV+pjMD5EfItdzrqhkIcolPt6gPg0frIJ9IAp+UzS/xjyqgvHvfxCFojiTEmCxcrFwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198272; h=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=MjukEcgl+gQCfY31fWpmdzDxbrNvPcADxA8CPWKzUHo=; b=X+FEtE5gFC4MyfrcYB3oNiJqpNYR39CXeP3X5FrXDRmMfIoO5pvsplZdSMSJIMtmZ6jGa/GaQ+aa1QVo5ELDpUhcHFN4BEVGAJsG5NDRozJ0QLY+TmMqWgJXbqW8l/6/yny6+CwCPV73Ygg7hLpbHehzYQTbRLv21oVrX6OYPqY= 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 1769198272142527.6090228337698; Fri, 23 Jan 2026 11:57:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFN-0004Js-69; Fri, 23 Jan 2026 14:55:09 -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 1vjNFL-00048j-9a for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:07 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFJ-0003m3-C8 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:07 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id E107C5BCD2; Fri, 23 Jan 2026 19:54:35 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8D68D1395E; Fri, 23 Jan 2026 19:54:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yEFHE/rRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198075; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjukEcgl+gQCfY31fWpmdzDxbrNvPcADxA8CPWKzUHo=; b=QHhZQno2XYkdN30CwfzgVIHcVa9hGelZxja4zI+fsC8o7xjxDtBx4zTT7GAscet+OT3bwK /K7u99U9xrzYRfLkFDK/2nZWRlmDl01t3CHDV95tgf6cvzSyuyLiYW+sTvnBdqqr7LQ49d /sEyxEtEptUYIOUWohbO7bn9+PLxMb4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198075; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjukEcgl+gQCfY31fWpmdzDxbrNvPcADxA8CPWKzUHo=; b=5OZX/XfwMgh8F3mkLnLtGMMeO4JRJV5doQLJ8o61+6VklTA5rnOaVw/3g5ZMn+BMqkZAq7 0Cm1Scy9ZTpV4sAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198075; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjukEcgl+gQCfY31fWpmdzDxbrNvPcADxA8CPWKzUHo=; b=QHhZQno2XYkdN30CwfzgVIHcVa9hGelZxja4zI+fsC8o7xjxDtBx4zTT7GAscet+OT3bwK /K7u99U9xrzYRfLkFDK/2nZWRlmDl01t3CHDV95tgf6cvzSyuyLiYW+sTvnBdqqr7LQ49d /sEyxEtEptUYIOUWohbO7bn9+PLxMb4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198075; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjukEcgl+gQCfY31fWpmdzDxbrNvPcADxA8CPWKzUHo=; b=5OZX/XfwMgh8F3mkLnLtGMMeO4JRJV5doQLJ8o61+6VklTA5rnOaVw/3g5ZMn+BMqkZAq7 0Cm1Scy9ZTpV4sAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 22/36] migration: Fold migration_cleanup() into migration_connect_error_propagate() Date: Fri, 23 Jan 2026 16:53:37 -0300 Message-ID: <20260123195352.12850-23-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198273806154100 Content-Type: text/plain; charset="utf-8" Whenever an error occurs between migrate_init() and the start of migration_thread, do cleanup immediately. This allows the special casing for resume to be removed from migration_connect(), that check is now done at migration_connect_error_propagate() which already had a case for resume. The cleanup at qmp_migrate_finish_cb can also be removed because it will always be reached either via the error path at qmp_migrate_finish->migration_connect_error_propagate or via the migrate_cleanup_bh. The yank_unregister_instance at qmp_migrate() is now replaced by the one at migration_cleanup(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-12-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/migration.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index fd67076b1d..a78c2f4840 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1573,15 +1573,21 @@ static void migration_connect_error_propagate(Migra= tionState *s, Error *error) { MigrationStatus current =3D s->state; MigrationStatus next =3D MIGRATION_STATUS_NONE; + bool resume =3D false; =20 switch (current) { case MIGRATION_STATUS_SETUP: next =3D MIGRATION_STATUS_FAILED; break; =20 + case MIGRATION_STATUS_POSTCOPY_PAUSED: + resume =3D true; + break; + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: /* Never fail a postcopy migration; switch back to PAUSED instead = */ next =3D MIGRATION_STATUS_POSTCOPY_PAUSED; + resume =3D true; break; =20 case MIGRATION_STATUS_CANCELLING: @@ -1606,6 +1612,10 @@ static void migration_connect_error_propagate(Migrat= ionState *s, Error *error) } =20 migrate_error_propagate(s, error); + + if (!resume) { + migration_cleanup(s); + } } =20 void migration_cancel(void) @@ -2208,9 +2218,6 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, MigrationAddress *addr =3D opaque; =20 qmp_migrate_finish(addr, NULL); - - cpr_state_close(); - migrate_hup_delete(migrate_get_current()); qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } @@ -2219,7 +2226,6 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_resume, bool resume, Error **errp) { - Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationChannel) channel =3D NULL; MigrationAddress *addr =3D NULL; @@ -2276,6 +2282,13 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 + /* + * The migrate_prepare() above calls migrate_init(). From this + * point on, until the end of migration, make sure any failures + * eventually result in a call to migration_cleanup(). + */ + Error *local_err =3D NULL; + if (!cpr_state_save(cpr_channel, &local_err)) { goto out; } @@ -2300,7 +2313,6 @@ void qmp_migrate(const char *uri, bool has_channels, =20 out: if (local_err) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); } @@ -4018,9 +4030,6 @@ void migration_connect(MigrationState *s, Error *erro= r_in) s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); - if (!resume) { - migration_cleanup(s); - } if (s->error) { error_report_err(error_copy(s->error)); } @@ -4099,7 +4108,6 @@ void migration_connect(MigrationState *s, Error *erro= r_in) =20 fail: migration_connect_error_propagate(s, local_err); - migration_cleanup(s); if (s->error) { error_report_err(error_copy(s->error)); } --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198271; cv=none; d=zohomail.com; s=zohoarc; b=W2mbCp5GvrJmRj0ODZSBjCLqn6kvPEz1ZGGN4mHuMw53HbJI9nPKk9ixYusk3whbKRwXcvQqO+S8KFOXvxz1jhJSS4ceIDrx0/pyu3IfxdnvcqsVroPr/oB25fr5ILFHH+IXgt0fpv1c4Y1IOjC7BJX3v98XfDIjzcWXdZq1JAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198271; h=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=/YWHCUSygdNx4mlYt6JKjPtldreXCVz9pqJ1aGkeTRo=; b=X/KIwe4smvCworQDcIkiNVAG+6Tsg12YusMsoy2M17iUmi2f4wgcWv8asB+G88GOQk/VRig69IQ2UG7HQqSMc9q8d+BfXUfbsYqbPdX3DCZ5AjSwMP9dLnQs6QMDRVKDIcEYH6JPgiwYK43B2kS8FHzLLE8dIDdfHjC9Oukl9gA= 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 1769198271985384.4362381667952; Fri, 23 Jan 2026 11:57:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFT-0004ue-Gr; Fri, 23 Jan 2026 14:55:15 -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 1vjNFR-0004jl-Ns for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:13 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFP-0003nP-2j for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:13 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id AD4A15BCCC; Fri, 23 Jan 2026 19:54:37 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5A6201395E; Fri, 23 Jan 2026 19:54:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YBL6BvzRc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YWHCUSygdNx4mlYt6JKjPtldreXCVz9pqJ1aGkeTRo=; b=W6ZdejUvkjTiPVIfULumR5hH3W2LYzGtN1NePzJo19LowUfwoUVC0BxwaWJlAF44FIdiJQ tmwHCqCJ6Qp+wbL6N8L+/I33mc4vbtktJOMBaD6yKfhw8D0rOdHDOojK90N4Y7NSM9S9Ba 7ZevDJm9k/Wk/NjGdYWWKsKHNZZKJdA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YWHCUSygdNx4mlYt6JKjPtldreXCVz9pqJ1aGkeTRo=; b=3MxbmZgtZAn17vWOiO8WCnTPFBY0lfg/WkeMkAEDk7I+ING0iXHYw9N5+5X3zMsqvd4kev FzY/xw34Jyyu1DBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=W6ZdejUv; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=3MxbmZgt DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YWHCUSygdNx4mlYt6JKjPtldreXCVz9pqJ1aGkeTRo=; b=W6ZdejUvkjTiPVIfULumR5hH3W2LYzGtN1NePzJo19LowUfwoUVC0BxwaWJlAF44FIdiJQ tmwHCqCJ6Qp+wbL6N8L+/I33mc4vbtktJOMBaD6yKfhw8D0rOdHDOojK90N4Y7NSM9S9Ba 7ZevDJm9k/Wk/NjGdYWWKsKHNZZKJdA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YWHCUSygdNx4mlYt6JKjPtldreXCVz9pqJ1aGkeTRo=; b=3MxbmZgtZAn17vWOiO8WCnTPFBY0lfg/WkeMkAEDk7I+ING0iXHYw9N5+5X3zMsqvd4kev FzY/xw34Jyyu1DBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 23/36] migration: Handle error in the early async paths Date: Fri, 23 Jan 2026 16:53:38 -0300 Message-ID: <20260123195352.12850-24-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: AD4A15BCCC X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198273984154100 Content-Type: text/plain; charset="utf-8" Simplify migration_channel_connect() and migration_connect() to not take an error as input. Move the error handling into the paths that generate the error. To achieve this, call migration_connect_error_propagate() from socket.c and tls.c, which are the async paths. For the sync paths, the handling is done as normal by returning all the way to qmp_migrate_finish(), except that now the sync paths don't pass the error forward into migration_connect() anymore. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-13-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 49 ++++++++++++++++++++---------------------- migration/channel.h | 4 +--- migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/migration.c | 11 ++-------- migration/migration.h | 3 ++- migration/rdma.c | 2 +- migration/socket.c | 17 ++++++++------- migration/tls.c | 14 ++++++------ migration/tls.h | 3 +-- migration/trace-events | 2 +- 12 files changed, 50 insertions(+), 61 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index ba14f66d85..26cb7bf059 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,38 +60,35 @@ void migration_channel_process_incoming(QIOChannel *ioc) * * @s: Current migration state * @ioc: Channel to which we are connecting - * @error: Error indicating failure to connect, free'd here */ -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - Error *error) +void migration_channel_connect(MigrationState *s, QIOChannel *ioc) { - trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), error); + trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); =20 - if (!error) { - if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc, &error); + if (migrate_channel_requires_tls_upgrade(ioc)) { + Error *local_err =3D NULL; =20 - if (!error) { - /* tls_channel_connect will call back to this - * function after the TLS handshake, - * so we mustn't call migration_connect until then - */ - - return; - } - } else { - QEMUFile *f =3D qemu_file_new_output(ioc); - - migration_ioc_register_yank(ioc); - - qemu_mutex_lock(&s->qemu_file_lock); - s->to_dst_file =3D f; - qemu_mutex_unlock(&s->qemu_file_lock); + migration_tls_channel_connect(s, ioc, &local_err); + if (local_err) { + migration_connect_error_propagate(s, local_err); } + + /* + * async: the above will call back to this function after + * the TLS handshake is successfully completed. + */ + return; } - migration_connect(s, error); + + QEMUFile *f =3D qemu_file_new_output(ioc); + + migration_ioc_register_yank(ioc); + + qemu_mutex_lock(&s->qemu_file_lock); + s->to_dst_file =3D f; + qemu_mutex_unlock(&s->qemu_file_lock); + + migration_connect(s); } =20 =20 diff --git a/migration/channel.h b/migration/channel.h index 2215091323..ccfeaaef18 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -20,9 +20,7 @@ =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - Error *error_in); +void migration_channel_connect(MigrationState *s, QIOChannel *ioc); =20 int migration_channel_read_peek(QIOChannel *ioc, const char *buf, diff --git a/migration/exec.c b/migration/exec.c index 78fe0fff13..d83a07435a 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index b92bc4c4eb..f5cf58e6ee 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -72,7 +72,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index c490f2b219..7bb9c1c79f 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/migration.c b/migration/migration.c index a78c2f4840..82e431b637 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1569,7 +1569,7 @@ static void migrate_error_free(MigrationState *s) s->error =3D NULL; } =20 -static void migration_connect_error_propagate(MigrationState *s, Error *er= ror) +void migration_connect_error_propagate(MigrationState *s, Error *error) { MigrationStatus current =3D s->state; MigrationStatus next =3D MIGRATION_STATUS_NONE; @@ -4020,7 +4020,7 @@ fail_setup: return NULL; } =20 -void migration_connect(MigrationState *s, Error *error_in) +void migration_connect(MigrationState *s) { Error *local_err =3D NULL; uint64_t rate_limit; @@ -4028,13 +4028,6 @@ void migration_connect(MigrationState *s, Error *err= or_in) int ret; =20 s->expected_downtime =3D migrate_downtime_limit(); - if (error_in) { - migration_connect_error_propagate(s, error_in); - if (s->error) { - error_report_err(error_copy(s->error)); - } - return; - } =20 if (resume) { /* This is a resumed migration */ diff --git a/migration/migration.h b/migration/migration.h index 8b55d4741a..d134881eaf 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -533,10 +533,11 @@ void migration_incoming_process(void); =20 bool migration_has_all_channels(void); =20 +void migration_connect_error_propagate(MigrationState *s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 -void migration_connect(MigrationState *s, Error *error_in); +void migration_connect(MigrationState *s); =20 int migration_call_notifiers(MigrationEventType type, Error **errp); =20 diff --git a/migration/rdma.c b/migration/rdma.c index cced173379..c41c3e24b9 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3996,7 +3996,7 @@ void rdma_start_outgoing_migration(void *opaque, =20 s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; - migration_connect(s, NULL); + migration_connect(s); return; return_path_err: qemu_rdma_cleanup(rdma); diff --git a/migration/socket.c b/migration/socket.c index 426f363b99..676fe26712 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -59,24 +59,25 @@ static void socket_outgoing_migration(QIOTask *task, gpointer opaque) { struct SocketConnectData *data =3D opaque; - QIOChannel *sioc =3D QIO_CHANNEL(qio_task_get_source(task)); + g_autoptr(QIOChannel) sioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { - trace_migration_socket_outgoing_error(error_get_pretty(err)); - goto out; + goto fail; } =20 - trace_migration_socket_outgoing_connected(); - if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { error_setg(&err, "Zero copy send feature not detected in host kern= el"); + goto fail; } =20 -out: - migration_channel_connect(data->s, sioc, err); - object_unref(OBJECT(sioc)); + trace_migration_socket_outgoing_connected(); + migration_channel_connect(data->s, sioc); + return; +fail: + trace_migration_socket_outgoing_error(error_get_pretty(err)); + migration_connect_error_propagate(data->s, err); } =20 void socket_start_outgoing_migration(MigrationState *s, diff --git a/migration/tls.c b/migration/tls.c index 82f58cbc78..837b08294f 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -104,16 +104,17 @@ static void migration_tls_outgoing_handshake(QIOTask = *task, gpointer opaque) { MigrationState *s =3D opaque; - QIOChannel *ioc =3D QIO_CHANNEL(qio_task_get_source(task)); + g_autoptr(QIOChannel) ioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { trace_migration_tls_outgoing_handshake_error(error_get_pretty(err)= ); - } else { - trace_migration_tls_outgoing_handshake_complete(); + migration_connect_error_propagate(s, err); + return; } - migration_channel_connect(s, ioc, err); - object_unref(OBJECT(ioc)); + + trace_migration_tls_outgoing_handshake_complete(); + migration_channel_connect(s, ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, @@ -129,8 +130,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, return qio_channel_tls_new_client(ioc, creds, migrate_tls_hostname(), = errp); } =20 -void migration_tls_channel_connect(MigrationState *s, - QIOChannel *ioc, +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, Error **errp) { QIOChannelTLS *tioc; diff --git a/migration/tls.h b/migration/tls.h index 7cd9c76013..0e86d38862 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -29,8 +29,7 @@ void migration_tls_channel_process_incoming(QIOChannel *i= oc, Error **errp); QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, Error **errp); =20 -void migration_tls_channel_connect(MigrationState *s, - QIOChannel *ioc, +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, Error **errp); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ diff --git a/migration/trace-events b/migration/trace-events index da8f909cac..cbf10d0b63 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -204,7 +204,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype, void *err) = "ioc=3D%p ioctype=3D%s err=3D%p" +migration_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" =20 # global_state.c migrate_state_too_big(void) "" --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198200; cv=none; d=zohomail.com; s=zohoarc; b=J0re9poJaOlablRbkrmD2av5bd4vXOViNV/1dGUg2YpeXSDqqHa6s2vfiWbC4UHp56w50HsMT9lV53QiTMqLQHT1xM3MMtxPA/QMPmyLtdaHjHBo8if31ozScNsNz8nSahLz9HfINKhe3yr3aU//w89myWJjKzTXi0lshNujnIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198200; h=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=cs/emzgF4ZDbOTKGVmoQT4deHlBtNsqpF1VHdzfG7/k=; b=Rh4exYhJcW5FZnrA33Xrqi65J/fuGjXvupXVhriTajDPBb988l9KPjJKf4NOawx5P06QIVhJ/HAFx0I7xzOiU1yRXsbK7Ra7sBNZZJS0e7YWS+8SUkbWCr3Jj05StYRpGY4QmyHObHdTnxcLqoS2PFNTqZ/RCc+NVsMbL6RCC/E= 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 1769198200211242.02756623260518; Fri, 23 Jan 2026 11:56:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFO-0004So-Km; Fri, 23 Jan 2026 14:55:10 -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 1vjNFM-0004Iy-TN for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:08 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFJ-0003m7-S0 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:08 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 7983533865; Fri, 23 Jan 2026 19:54:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 26F5B1395E; Fri, 23 Jan 2026 19:54:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sMncNf3Rc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198079; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cs/emzgF4ZDbOTKGVmoQT4deHlBtNsqpF1VHdzfG7/k=; b=PniQ1dHG5psrYdKumOdxqXVM4H81Id/Nhj0EEEu+Zmb8VFLrnYHXZgwqdrA9n83VUvg7fB 6OTxiFIEq57HMnug+EhdzxlNuILP9ItsAGy6vrI2Eb1ANe5UlQn3WP7zzEPenouT3BTjBS un1lM+kfzItxJHKf7J8iaMGbzPSEj14= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198079; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cs/emzgF4ZDbOTKGVmoQT4deHlBtNsqpF1VHdzfG7/k=; b=d2etFfIX9XcA3waE4XJBLLEV67Y8lhM6L+r94Zz5DvAUho/gKyNwfXpEnpKIqq9e+I986u 6gQUKrJWwN/qr3Dw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PniQ1dHG; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=d2etFfIX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198079; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cs/emzgF4ZDbOTKGVmoQT4deHlBtNsqpF1VHdzfG7/k=; b=PniQ1dHG5psrYdKumOdxqXVM4H81Id/Nhj0EEEu+Zmb8VFLrnYHXZgwqdrA9n83VUvg7fB 6OTxiFIEq57HMnug+EhdzxlNuILP9ItsAGy6vrI2Eb1ANe5UlQn3WP7zzEPenouT3BTjBS un1lM+kfzItxJHKf7J8iaMGbzPSEj14= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198079; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cs/emzgF4ZDbOTKGVmoQT4deHlBtNsqpF1VHdzfG7/k=; b=d2etFfIX9XcA3waE4XJBLLEV67Y8lhM6L+r94Zz5DvAUho/gKyNwfXpEnpKIqq9e+I986u 6gQUKrJWwN/qr3Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 24/36] migration: Move setting of QEMUFile into migration_outgoing|incoming_setup Date: Fri, 23 Jan 2026 16:53:39 -0300 Message-ID: <20260123195352.12850-25-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 7983533865 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198200526158500 Content-Type: text/plain; charset="utf-8" Centralize, on both sides of migration, the setting of the to_src_file and from_dst_file QEMUFiles. This will clean up the interface with channel.c and rdma.c, allowing those files to stop dealing with QEMUFile themselves. (multifd_recv_new_channel was changed to return bool+errp for convenience) Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-14-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 9 +---- migration/migration.c | 84 ++++++++++++++++++++++++++----------------- migration/migration.h | 2 ++ migration/multifd.c | 8 +++-- migration/multifd.h | 2 +- 5 files changed, 61 insertions(+), 44 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 26cb7bf059..6acce7b2a2 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -14,7 +14,6 @@ #include "channel.h" #include "tls.h" #include "migration.h" -#include "qemu-file.h" #include "trace.h" #include "qapi/error.h" #include "io/channel-tls.h" @@ -80,14 +79,8 @@ void migration_channel_connect(MigrationState *s, QIOCha= nnel *ioc) return; } =20 - QEMUFile *f =3D qemu_file_new_output(ioc); - migration_ioc_register_yank(ioc); - - qemu_mutex_lock(&s->qemu_file_lock); - s->to_dst_file =3D f; - qemu_mutex_unlock(&s->qemu_file_lock); - + migration_outgoing_setup(ioc); migration_connect(s); } =20 diff --git a/migration/migration.c b/migration/migration.c index 82e431b637..dbb28da38f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -929,17 +929,56 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -/** - * migration_incoming_setup: Setup incoming migration - * @f: file for main migration channel +static bool migration_has_main_and_multifd_channels(void); + +/* + * Returns whether all the necessary channels to proceed with the + * incoming migration have been established without error. */ -static void migration_incoming_setup(QEMUFile *f) +bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); + QEMUFile *f; =20 - assert(!mis->from_src_file); - mis->from_src_file =3D f; - qemu_file_set_blocking(f, false, &error_abort); + if (multifd_recv_setup(errp) !=3D 0) { + return false; + } + + switch (channel) { + case CH_MAIN: + f =3D qemu_file_new_input(ioc); + assert(!mis->from_src_file); + mis->from_src_file =3D f; + qemu_file_set_blocking(f, false, &error_abort); + break; + + case CH_MULTIFD: + if (!multifd_recv_new_channel(ioc, errp)) { + return false; + } + break; + + case CH_POSTCOPY: + assert(!mis->postcopy_qemufile_dst); + f =3D qemu_file_new_input(ioc); + postcopy_preempt_new_channel(mis, f); + return false; + + default: + g_assert_not_reached(); + } + + return migration_has_main_and_multifd_channels(); +} + +void migration_outgoing_setup(QIOChannel *ioc) +{ + MigrationState *s =3D migrate_get_current(); + QEMUFile *f =3D qemu_file_new_output(ioc); + + qemu_mutex_lock(&s->qemu_file_lock); + s->to_dst_file =3D f; + qemu_mutex_unlock(&s->qemu_file_lock); } =20 /* Returns true if recovered from a paused migration, otherwise false */ @@ -987,7 +1026,11 @@ void migration_incoming_process(void) =20 void migration_fd_process_incoming(QEMUFile *f) { - migration_incoming_setup(f); + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + assert(!mis->from_src_file); + mis->from_src_file =3D f; + qemu_file_set_blocking(f, false, &error_abort); migration_incoming_process(); } =20 @@ -1010,8 +1053,6 @@ static bool migration_has_main_and_multifd_channels(v= oid) void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); - Error *local_err =3D NULL; - QEMUFile *f; uint8_t channel; uint32_t channel_magic =3D 0; int ret =3D 0; @@ -1065,28 +1106,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc,= Error **errp) channel =3D CH_POSTCOPY; } =20 - if (multifd_recv_setup(errp) !=3D 0) { - return; - } - - if (channel =3D=3D CH_MAIN) { - f =3D qemu_file_new_input(ioc); - migration_incoming_setup(f); - } else if (channel =3D=3D CH_MULTIFD) { - /* Multiple connections */ - multifd_recv_new_channel(ioc, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - } else if (channel =3D=3D CH_POSTCOPY) { - assert(!mis->postcopy_qemufile_dst); - f =3D qemu_file_new_input(ioc); - postcopy_preempt_new_channel(mis, f); - return; - } - - if (migration_has_main_and_multifd_channels()) { + if (migration_incoming_setup(ioc, channel, errp)) { migration_incoming_process(); } } diff --git a/migration/migration.h b/migration/migration.h index d134881eaf..4dcf299719 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -530,6 +530,8 @@ void migrate_set_state(MigrationStatus *state, Migratio= nStatus old_state, void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); +bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); +void migration_outgoing_setup(QIOChannel *ioc); =20 bool migration_has_all_channels(void); =20 diff --git a/migration/multifd.c b/migration/multifd.c index a8366cd588..ad6261688f 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1512,7 +1512,7 @@ bool multifd_recv_all_channels_created(void) * Try to receive all multifd channels to get ready for the migration. * Sets @errp when failing to receive the current channel. */ -void multifd_recv_new_channel(QIOChannel *ioc, Error **errp) +bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp) { MultiFDRecvParams *p; Error *local_err =3D NULL; @@ -1527,7 +1527,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) "failed to receive packet" " via multifd channel %d: ", qatomic_read(&multifd_recv_state->coun= t)); - return; + return false; } trace_multifd_recv_new_channel(id); } else { @@ -1540,7 +1540,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) id); multifd_recv_terminate_threads(error_copy(local_err)); error_propagate(errp, local_err); - return; + return false; } p->c =3D ioc; object_ref(OBJECT(ioc)); @@ -1549,4 +1549,6 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p, QEMU_THREAD_JOINABLE); qatomic_inc(&multifd_recv_state->count); + + return true; } diff --git a/migration/multifd.h b/migration/multifd.h index 9b6d81e7ed..89a395aef2 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -42,7 +42,7 @@ int multifd_recv_setup(Error **errp); void multifd_recv_cleanup(void); void multifd_recv_shutdown(void); bool multifd_recv_all_channels_created(void); -void multifd_recv_new_channel(QIOChannel *ioc, Error **errp); +bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp); void multifd_recv_sync_main(void); int multifd_send_sync_main(MultiFDSyncReq req); bool multifd_queue_page(RAMBlock *block, ram_addr_t offset); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198118; cv=none; d=zohomail.com; s=zohoarc; b=G6dBXm9mv1JB0OoUJYG55fy+rvD07xNd+j6srTkshG4D6N5jWioUsR2xIIsOgn9NwDU2C1JATCq/YxTmdZlmgTIVhT9yP2OX8hOJ0Guz3PXgGTouEh5GofpZ6p+3Lf9DZ2Y3JKtYIJzVCGrlLfPgUXKohk/UUOxPGxNpL8HG6Mg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198118; h=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=eBfBtMexc6Q4KzT1isEsummEGEzS3cWOpbOmeEXMzzA=; b=ObZdbO/HDf0lvDMFAbz9DHg7PG6J17ROZhU0Q1vKh4aPeXO97RLcRsNItRQZEaSVE76h2RsARKioGcqp4+YVfxpQKRP/QPdouw5/6V7E73CcU0rdti1Uyoj1SjpoPJfTKpRlgPyjZ+LPiWdTJkgGOsjCrGmI5PGIdf2vi+D6x9o= 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 176919811841454.736970075247086; Fri, 23 Jan 2026 11:55:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFU-0004yw-DW; Fri, 23 Jan 2026 14:55:16 -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 1vjNFT-0004t7-6i for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:15 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFR-0003nf-2f for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:14 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 45CD733868; Fri, 23 Jan 2026 19:54:41 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E68B31395E; Fri, 23 Jan 2026 19:54:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 6Nc0Kf/Rc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eBfBtMexc6Q4KzT1isEsummEGEzS3cWOpbOmeEXMzzA=; b=0quOCBFXLL3RrRuhB/IBF7EuVogLzbX0z4evQujWHg1PFjxQstA372XDcK4C6WELyVY0cx 547ZG4dh/bAFdJNGWplQgvydfqWuYRRFrx1bBTktnBeUImnr2AeZLY8tpllQX7ksC71yeg T8yuWzIJqne7izeusXvhSqWG6eCfdYY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eBfBtMexc6Q4KzT1isEsummEGEzS3cWOpbOmeEXMzzA=; b=IkQ5XpMnLEpwkjzbBi+Cp0V4NfBonFMXaSkb+4MqGTxgt3fMan8Sb9oMzkoz/pc85ytvLW R0OIcL/PKIBoZ1BA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eBfBtMexc6Q4KzT1isEsummEGEzS3cWOpbOmeEXMzzA=; b=0quOCBFXLL3RrRuhB/IBF7EuVogLzbX0z4evQujWHg1PFjxQstA372XDcK4C6WELyVY0cx 547ZG4dh/bAFdJNGWplQgvydfqWuYRRFrx1bBTktnBeUImnr2AeZLY8tpllQX7ksC71yeg T8yuWzIJqne7izeusXvhSqWG6eCfdYY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eBfBtMexc6Q4KzT1isEsummEGEzS3cWOpbOmeEXMzzA=; b=IkQ5XpMnLEpwkjzbBi+Cp0V4NfBonFMXaSkb+4MqGTxgt3fMan8Sb9oMzkoz/pc85ytvLW R0OIcL/PKIBoZ1BA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 25/36] migration/rdma: Use common connection paths Date: Fri, 23 Jan 2026 16:53:40 -0300 Message-ID: <20260123195352.12850-26-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198120431158500 Content-Type: text/plain; charset="utf-8" Use the common connection paths for the incoming and outgoing sides of rdma migration. This removes one usage of QEMUFile from rdma.c. It also allows further unification of the connection code in next patches. Move the channels enum to channel.h so rdma.c can access it. The RDMA channel is considered a CH_MAIN channel. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-15-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.h | 7 +++++++ migration/migration.c | 13 ------------- migration/migration.h | 1 - migration/rdma.c | 23 +++++++++++------------ 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/migration/channel.h b/migration/channel.h index ccfeaaef18..93dedbf52b 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -18,6 +18,13 @@ =20 #include "io/channel.h" =20 +/* Migration channel types */ +enum { + CH_MAIN, + CH_MULTIFD, + CH_POSTCOPY +}; + void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect(MigrationState *s, QIOChannel *ioc); diff --git a/migration/migration.c b/migration/migration.c index dbb28da38f..93ebed5f8e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -90,9 +90,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 -/* Migration channel types */ -enum { CH_MAIN, CH_MULTIFD, CH_POSTCOPY }; - /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -1024,16 +1021,6 @@ void migration_incoming_process(void) qemu_coroutine_enter(co); } =20 -void migration_fd_process_incoming(QEMUFile *f) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - - assert(!mis->from_src_file); - mis->from_src_file =3D f; - qemu_file_set_blocking(f, false, &error_abort); - migration_incoming_process(); -} - static bool migration_has_main_and_multifd_channels(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/migration.h b/migration/migration.h index 4dcf299719..cd6cfd62ba 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -527,7 +527,6 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); diff --git a/migration/rdma.c b/migration/rdma.c index c41c3e24b9..98a6cebb17 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "channel.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "exec/target_page.h" @@ -384,7 +385,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdmain; RDMAContext *rdmaout; - QEMUFile *file; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -3835,32 +3835,30 @@ static void qio_channel_rdma_register_types(void) =20 type_init(qio_channel_rdma_register_types); =20 -static QEMUFile *rdma_new_input(RDMAContext *rdma) +static QIOChannel *rdma_new_input(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); rioc->rdmain =3D rdma; rioc->rdmaout =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 -static QEMUFile *rdma_new_output(RDMAContext *rdma) +static QIOChannel *rdma_new_output(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); rioc->rdmaout =3D rdma; rioc->rdmain =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 static void rdma_accept_incoming_migration(void *opaque) { RDMAContext *rdma =3D opaque; - QEMUFile *f; + QIOChannel *ioc; =20 trace_qemu_rdma_accept_incoming_migration(); if (qemu_rdma_accept(rdma) < 0) { @@ -3874,15 +3872,16 @@ static void rdma_accept_incoming_migration(void *op= aque) return; } =20 - f =3D rdma_new_input(rdma); - if (f =3D=3D NULL) { + ioc =3D rdma_new_input(rdma); + if (ioc =3D=3D NULL) { error_report("RDMA ERROR: could not open RDMA for input"); qemu_rdma_cleanup(rdma); return; } =20 rdma->migration_started_on_destination =3D 1; - migration_fd_process_incoming(f); + migration_incoming_setup(ioc, CH_MAIN, &error_abort); + migration_incoming_process(); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, @@ -3994,8 +3993,8 @@ void rdma_start_outgoing_migration(void *opaque, =20 trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 - s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; + migration_outgoing_setup(rdma_new_output(rdma)); migration_connect(s); return; return_path_err: --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198337; cv=none; d=zohomail.com; s=zohoarc; b=Z2iNFBPOrtYQFKpSLelq7lmu8gYFnvMz6o7hSxxnKYqK131rZ0waEMxuYl//z2/3k55HM0L0M52Saa6fPEqZbPnQtcZA6NUAlsMtz63t8iwyI7fcqguaNpAIAvccqb5kHemotg/YlX+3YK6dHxYBRIX2Hpwp5/JJz/Cs/NMhVlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198337; h=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=qHMFMv2RYAluVai076CrPk2IYV1uk3Pvq6OIGR9JWoU=; b=K9eQqPpt4XnkgUcjHoIv6946yyf0UVj6KXzdVj9uwNFdn+80yVSt4LcG7SVE+TS8NCzu/ReFnFTNx/hY5mP6jzCg9fHQx3xDPKplBQLBH4g2MVgh7C2fB57or4YDWo+GxAzIKPnG/mX3KqOxrM6fLNLUh7s0Gz6IDP+d5XCfLkY= 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 1769198337557886.5140444359644; Fri, 23 Jan 2026 11:58:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFZ-0005MA-Ed; Fri, 23 Jan 2026 14:55:21 -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 1vjNFX-0005DG-5q for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:19 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFV-0003oH-3M for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:18 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 12F6F5BCCD; Fri, 23 Jan 2026 19:54:43 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B41B11395E; Fri, 23 Jan 2026 19:54:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sASEHAHSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198083; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qHMFMv2RYAluVai076CrPk2IYV1uk3Pvq6OIGR9JWoU=; b=15IBe+B3+OszSj2b5LPAy+60HqKgDADs0fjkqPH1FTVon8RoblaC0kB1K7qBIQtcOtAlWP bymC09PMjuUPzfiYHUujxjxhdPbV3+iY43vbM79JA+hC8RGaWz7zE2fnrV/RIj0fQkG+/S mQVNLclSH5zKKoNOzfufmVs0RNpW09c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198083; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qHMFMv2RYAluVai076CrPk2IYV1uk3Pvq6OIGR9JWoU=; b=94VPyqFYMZAVZzMrT7JZb/SxCusul5erKqfaQwtFYkvzK2LdwPo3pyfZSR3b9jWlO48eM5 LJvrjrYKiO4NTGCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=15IBe+B3; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=94VPyqFY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198083; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qHMFMv2RYAluVai076CrPk2IYV1uk3Pvq6OIGR9JWoU=; b=15IBe+B3+OszSj2b5LPAy+60HqKgDADs0fjkqPH1FTVon8RoblaC0kB1K7qBIQtcOtAlWP bymC09PMjuUPzfiYHUujxjxhdPbV3+iY43vbM79JA+hC8RGaWz7zE2fnrV/RIj0fQkG+/S mQVNLclSH5zKKoNOzfufmVs0RNpW09c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198083; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qHMFMv2RYAluVai076CrPk2IYV1uk3Pvq6OIGR9JWoU=; b=94VPyqFYMZAVZzMrT7JZb/SxCusul5erKqfaQwtFYkvzK2LdwPo3pyfZSR3b9jWlO48eM5 LJvrjrYKiO4NTGCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 26/36] migration: Start incoming from channel.c Date: Fri, 23 Jan 2026 16:53:41 -0300 Message-ID: <20260123195352.12850-27-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 12F6F5BCCD X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198339025158500 Content-Type: text/plain; charset="utf-8" Leave migration_ioc_process_incoming to do only the channel identification process and move the migration start into channel.c. Both routines will be renamed in the next patches to better reflect their usage. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-16-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 12 ++++++++++-- migration/channel.h | 5 +++-- migration/migration.c | 13 +++++-------- migration/migration.h | 3 ++- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 6acce7b2a2..b8d757c17b 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -33,6 +33,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) { MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; + MigChannelType ch; =20 trace_migration_set_incoming_channel( ioc, object_get_typename(OBJECT(ioc))); @@ -41,9 +42,16 @@ void migration_channel_process_incoming(QIOChannel *ioc) migration_tls_channel_process_incoming(ioc, &local_err); } else { migration_ioc_register_yank(ioc); - migration_ioc_process_incoming(ioc, &local_err); - } + ch =3D migration_ioc_process_incoming(ioc, &local_err); + if (!ch) { + goto out; + } =20 + if (migration_incoming_setup(ioc, ch, &local_err)) { + migration_incoming_process(); + } + } +out: if (local_err) { error_report_err(local_err); migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED= ); diff --git a/migration/channel.h b/migration/channel.h index 93dedbf52b..b361e1c838 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -19,11 +19,12 @@ #include "io/channel.h" =20 /* Migration channel types */ -enum { +typedef enum { + CH_NONE, CH_MAIN, CH_MULTIFD, CH_POSTCOPY -}; +} MigChannelType; =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 diff --git a/migration/migration.c b/migration/migration.c index 93ebed5f8e..8a27d93498 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1037,10 +1037,10 @@ static bool migration_has_main_and_multifd_channels= (void) return true; } =20 -void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) +MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p) { MigrationIncomingState *mis =3D migration_incoming_get_current(); - uint8_t channel; + MigChannelType channel =3D CH_NONE; uint32_t channel_magic =3D 0; int ret =3D 0; =20 @@ -1059,7 +1059,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, = Error **errp) ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, sizeof(channel_magic), errp); if (ret !=3D 0) { - return; + goto out; } =20 channel_magic =3D be32_to_cpu(channel_magic); @@ -1074,7 +1074,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, = Error **errp) channel =3D CH_MAIN; } else { error_setg(errp, "unknown channel magic: %u", channel_magi= c); - return; } } else if (mis->from_src_file && migrate_multifd()) { /* @@ -1086,16 +1085,14 @@ void migration_ioc_process_incoming(QIOChannel *ioc= , Error **errp) channel =3D CH_MAIN; } else { error_setg(errp, "non-peekable channel used without multifd"); - return; } } else { assert(migrate_postcopy_preempt()); channel =3D CH_POSTCOPY; } =20 - if (migration_incoming_setup(ioc, channel, errp)) { - migration_incoming_process(); - } +out: + return channel; } =20 /** diff --git a/migration/migration.h b/migration/migration.h index cd6cfd62ba..b55cc40613 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -28,6 +28,7 @@ #include "postcopy-ram.h" #include "system/runstate.h" #include "migration/misc.h" +#include "channel.h" =20 #define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" #define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" @@ -527,7 +528,7 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); +MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); void migration_outgoing_setup(QIOChannel *ioc); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198213; cv=none; d=zohomail.com; s=zohoarc; b=Y9hN5B2RzSeEkhVPWYkwBQuvK1OLcrOdV1WxC14zgWDiVva/qc0jsENtW7L3ato3Yt8aNdO4aHOglduYwH+1Q1j9RZ+I1BroJywZlMeww9es8mTIQleIw6eUIdxbv3xkKDk0J8O6o/yiZ11/+B3uj10Z5vn7SgOmNVfc3Q/lg+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198213; h=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=SL1gGaSUZ5ZleQCZXhz4avRkMzIE6yFz78Rl6LQqGt8=; b=EKMk/Q9jEib4AtBbwwiVqvEhHrBlcdpi8OGZTwbGbadiKpy+RQw8sfnE/Qt1+nopGnOlb5KRDWPz0IbqMXhjFeAGVVmMhbpMQnKiG5kdMC1xtmWSkiQWJU23rOF6F1E7Ms/1HTGb74jGJpI8Iz1wtmeJUZOsSTRVyxwF8JZRzcM= 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 1769198213523433.5449703985755; Fri, 23 Jan 2026 11:56:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFh-0005nW-GJ; Fri, 23 Jan 2026 14:55:29 -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 1vjNFc-0005Vc-G0 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:26 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFa-0003oy-Eg for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:24 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id D756C5BCD3; Fri, 23 Jan 2026 19:54:44 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 804C21395E; Fri, 23 Jan 2026 19:54:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uNQ6EAPSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198085; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1gGaSUZ5ZleQCZXhz4avRkMzIE6yFz78Rl6LQqGt8=; b=AqeuUrNBI7oIroe8NzCIUJRFFD5Gy1Nzl9rCVxUD2r6iddU/+5whaFX8ouE3/acSmUv3eL tFKoghdkfpjTvJf291L5D1RM4T3frV3dlD4ajjt/pu4jz3QeA2hJpPG8OQASzdZZWJmo6X 8t+gGd33OdSsnmsl+1oUsxXAo7hZoiM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198085; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1gGaSUZ5ZleQCZXhz4avRkMzIE6yFz78Rl6LQqGt8=; b=Q69cVYZS82YUX7TCrz6oq6WHk18fJxRquWDGzXarFJLUdhfG+liR4uBQMhTBrhYn7H3ouG XodxbkwO/FAIFcCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1gGaSUZ5ZleQCZXhz4avRkMzIE6yFz78Rl6LQqGt8=; b=0Ln9eyrmGAtSiFRECz9UikU1GGGrKUnbBFjuu4LSniA9qJ7RkPGgYXVhn68uQB/100qoix XzoMC7S6bJ0kGzuAEIKR0ZSASCEtfWjyc59ThW5oLspKGgNuL3AEUj33V4+Ii0D2jmlytO g4byLrgzn/dQBnXpfNcw5jJPnh9rYGo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1gGaSUZ5ZleQCZXhz4avRkMzIE6yFz78Rl6LQqGt8=; b=s8Ht2Mnc4ZXgZm+A/IMo7+ML2ikedpKVhjrhT7wKOjVAZXT/62ICi2aFvPCaOToBQWV1Hv Gxvt3WRopvSY9TCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 27/36] migration/channel: Rename migration_channel_connect Date: Fri, 23 Jan 2026 16:53:42 -0300 Message-ID: <20260123195352.12850-28-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769198214997154100 Content-Type: text/plain; charset="utf-8" Rename migration_channel_connect to indicate this is the source side. Future patches will do similar changes to the incoming side and this will avoid inconsistencies in naming. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-17-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 9 +-------- migration/channel.h | 2 +- migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/socket.c | 2 +- migration/tls.c | 2 +- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index b8d757c17b..f41333adcc 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -61,14 +61,7 @@ out: } } =20 - -/** - * @migration_channel_connect - Create new outgoing migration channel - * - * @s: Current migration state - * @ioc: Channel to which we are connecting - */ -void migration_channel_connect(MigrationState *s, QIOChannel *ioc) +void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc) { trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); =20 diff --git a/migration/channel.h b/migration/channel.h index b361e1c838..574bfec65c 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -28,7 +28,7 @@ typedef enum { =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 -void migration_channel_connect(MigrationState *s, QIOChannel *ioc); +void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc= ); =20 int migration_channel_read_peek(QIOChannel *ioc, const char *buf, diff --git a/migration/exec.c b/migration/exec.c index d83a07435a..d1629944dc 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index f5cf58e6ee..20166fef46 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -72,7 +72,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index 7bb9c1c79f..935402f36b 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/socket.c b/migration/socket.c index 676fe26712..f94959828f 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -73,7 +73,7 @@ static void socket_outgoing_migration(QIOTask *task, } =20 trace_migration_socket_outgoing_connected(); - migration_channel_connect(data->s, sioc); + migration_channel_connect_outgoing(data->s, sioc); return; fail: trace_migration_socket_outgoing_error(error_get_pretty(err)); diff --git a/migration/tls.c b/migration/tls.c index 837b08294f..89ba52de02 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -114,7 +114,7 @@ static void migration_tls_outgoing_handshake(QIOTask *t= ask, } =20 trace_migration_tls_outgoing_handshake_complete(); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198176; cv=none; d=zohomail.com; s=zohoarc; b=e95ozEry5CE2E5rE4HPOKPtoun26k/VnWPwwMW3MvBD34118ZR1ry05tLZh2GQqxGgsW/LLaNcQieWWUjbG9nimbqc9xyzPAFh4acA6PMFfHUyPtl2FPikWGcvyPyahMmmTN5CxwBSfAVjKMkckWqtDDsnMxin9sADrLR8L2q1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198176; h=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=l98H5SnYUDml+UJQOWewqvreR+nOqNTsC3mKlWBtXXo=; b=IN1mfxWNsroLuRCR1h1EL63SHX/cW1qzdmxu+ykUILXh3XD1uopCk9A9C4RQ/dOO42b8/wWP+0sSyiBFOOmsqeSsA8fg5p+0SZR7iO8Jea20g8ZPMoOMjEj7aFgfB9BroNZ0C4/aDqvi+nPyWhVXNluscppUPJiwewhuvloayT0= 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 1769198176819724.6289397425827; Fri, 23 Jan 2026 11:56:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFa-0005S0-R3; Fri, 23 Jan 2026 14:55:22 -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 1vjNFZ-0005Kf-3x for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:21 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFW-0003oS-8A for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:20 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id A478F3385F; Fri, 23 Jan 2026 19:54:46 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 50741139E8; Fri, 23 Jan 2026 19:54:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SBudBAXSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l98H5SnYUDml+UJQOWewqvreR+nOqNTsC3mKlWBtXXo=; b=PYbnsAx4tr+urGDTR72l5Q4QeHYU6V/GFAvbC2eoSzcZSylmtNqRpNsMo76cYmyv2K9zS1 4PESul5CEBi11WOWaRLChV/V/mtZ749UuRbxO9qTJ0dBXrrCTed2E/6h07I7AT98u53VQ6 aBTiJohCOEpqdAyCdgwne2qcR+AbVbo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l98H5SnYUDml+UJQOWewqvreR+nOqNTsC3mKlWBtXXo=; b=NZauczggDfILHRt1+PJmuPQCVJmgM0JIuJV8+XWOpJQr8k0mpCPPft+/CEJA97yUQo6CaO VEF5GpK/sKjFYgAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PYbnsAx4; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=NZauczgg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l98H5SnYUDml+UJQOWewqvreR+nOqNTsC3mKlWBtXXo=; b=PYbnsAx4tr+urGDTR72l5Q4QeHYU6V/GFAvbC2eoSzcZSylmtNqRpNsMo76cYmyv2K9zS1 4PESul5CEBi11WOWaRLChV/V/mtZ749UuRbxO9qTJ0dBXrrCTed2E/6h07I7AT98u53VQ6 aBTiJohCOEpqdAyCdgwne2qcR+AbVbo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l98H5SnYUDml+UJQOWewqvreR+nOqNTsC3mKlWBtXXo=; b=NZauczggDfILHRt1+PJmuPQCVJmgM0JIuJV8+XWOpJQr8k0mpCPPft+/CEJA97yUQo6CaO VEF5GpK/sKjFYgAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 28/36] migration: Rename instances of start Date: Fri, 23 Jan 2026 16:53:43 -0300 Message-ID: <20260123195352.12850-29-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: A478F3385F X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198178642154100 Content-Type: text/plain; charset="utf-8" To make it easier to follow the code, rename the functions that start the migration thread and migration coroutine to contain the word "start". This will give new contributors the chance of seeing the word start and reaching the actual migration code, instead of twists and turns of qio_channel_add_watch and qio_task_run_in_thread. Remove all other instances of "start" and use wording more suitable to what the current migration stage is. The transport code such as fd_start_migration_outgoing becomes fd_connect_outgoing, the early setup code such as qemu_start_incoming_migration becomes qemu_setup_incoming_migration and so on. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-18-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 4 ++-- migration/exec.c | 5 ++--- migration/exec.h | 5 ++--- migration/fd.c | 4 ++-- migration/fd.h | 6 +++--- migration/file.c | 6 +++--- migration/file.h | 6 +++--- migration/migration.c | 30 +++++++++++++++--------------- migration/migration.h | 3 ++- migration/rdma.c | 21 ++++++++++----------- migration/rdma.h | 6 +++--- migration/socket.c | 8 +++----- migration/socket.h | 6 +++--- migration/trace-events | 10 +++++----- 14 files changed, 58 insertions(+), 62 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index f41333adcc..d1eec4942b 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -48,7 +48,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) } =20 if (migration_incoming_setup(ioc, ch, &local_err)) { - migration_incoming_process(); + migration_start_incoming(); } } out: @@ -82,7 +82,7 @@ void migration_channel_connect_outgoing(MigrationState *s= , QIOChannel *ioc) =20 migration_ioc_register_yank(ioc); migration_outgoing_setup(ioc); - migration_connect(s); + migration_start_outgoing(s); } =20 =20 diff --git a/migration/exec.c b/migration/exec.c index d1629944dc..c3085e803e 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -40,8 +40,7 @@ const char *exec_get_cmd_path(void) } #endif =20 -void exec_start_outgoing_migration(MigrationState *s, strList *command, - Error **errp) +void exec_connect_outgoing(MigrationState *s, strList *command, Error **er= rp) { QIOChannel *ioc =3D NULL; g_auto(GStrv) argv =3D strv_from_str_list(command); @@ -68,7 +67,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel= *ioc, return G_SOURCE_REMOVE; } =20 -void exec_start_incoming_migration(strList *command, Error **errp) +void exec_connect_incoming(strList *command, Error **errp) { QIOChannel *ioc; g_auto(GStrv) argv =3D strv_from_str_list(command); diff --git a/migration/exec.h b/migration/exec.h index 3107f205e3..e7e8e475ac 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -23,8 +23,7 @@ #ifdef WIN32 const char *exec_get_cmd_path(void); #endif -void exec_start_incoming_migration(strList *host_port, Error **errp); +void exec_connect_incoming(strList *host_port, Error **errp); =20 -void exec_start_outgoing_migration(MigrationState *s, strList *host_port, - Error **errp); +void exec_connect_outgoing(MigrationState *s, strList *host_port, Error **= errp); #endif diff --git a/migration/fd.c b/migration/fd.c index 20166fef46..530aac1a5b 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -50,7 +50,7 @@ static bool migration_fd_valid(int fd) return false; } =20 -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Er= ror **errp) +void fd_connect_outgoing(MigrationState *s, const char *fdname, Error **er= rp) { QIOChannel *ioc; int fd =3D monitor_get_fd(monitor_cur(), fdname, errp); @@ -85,7 +85,7 @@ static gboolean fd_accept_incoming_migration(QIOChannel *= ioc, return G_SOURCE_REMOVE; } =20 -void fd_start_incoming_migration(const char *fdname, Error **errp) +void fd_connect_incoming(const char *fdname, Error **errp) { QIOChannel *ioc; int fd =3D monitor_fd_param(monitor_cur(), fdname, errp); diff --git a/migration/fd.h b/migration/fd.h index b901bc014e..7211629270 100644 --- a/migration/fd.h +++ b/migration/fd.h @@ -16,8 +16,8 @@ =20 #ifndef QEMU_MIGRATION_FD_H #define QEMU_MIGRATION_FD_H -void fd_start_incoming_migration(const char *fdname, Error **errp); +void fd_connect_incoming(const char *fdname, Error **errp); =20 -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, - Error **errp); +void fd_connect_outgoing(MigrationState *s, const char *fdname, + Error **errp); #endif diff --git a/migration/file.c b/migration/file.c index 935402f36b..b7b0fb5194 100644 --- a/migration/file.c +++ b/migration/file.c @@ -93,8 +93,8 @@ out: return ret; } =20 -void file_start_outgoing_migration(MigrationState *s, - FileMigrationArgs *file_args, Error **e= rrp) +void file_connect_outgoing(MigrationState *s, + FileMigrationArgs *file_args, Error **errp) { g_autoptr(QIOChannelFile) fioc =3D NULL; g_autofree char *filename =3D g_strdup(file_args->filename); @@ -173,7 +173,7 @@ static void file_create_incoming_channels(QIOChannel *i= oc, char *filename, } } =20 -void file_start_incoming_migration(FileMigrationArgs *file_args, Error **e= rrp) +void file_connect_incoming(FileMigrationArgs *file_args, Error **errp) { g_autofree char *filename =3D g_strdup(file_args->filename); QIOChannelFile *fioc =3D NULL; diff --git a/migration/file.h b/migration/file.h index 1a1115f7f1..9b1e874bb7 100644 --- a/migration/file.h +++ b/migration/file.h @@ -13,10 +13,10 @@ #include "channel.h" #include "multifd.h" =20 -void file_start_incoming_migration(FileMigrationArgs *file_args, Error **e= rrp); +void file_connect_incoming(FileMigrationArgs *file_args, Error **errp); =20 -void file_start_outgoing_migration(MigrationState *s, - FileMigrationArgs *file_args, Error **e= rrp); +void file_connect_outgoing(MigrationState *s, + FileMigrationArgs *file_args, Error **errp); int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp); void file_cleanup_outgoing_migration(void); bool file_send_channel_create(gpointer opaque, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index 8a27d93498..24ef583d96 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -739,7 +739,7 @@ migration_incoming_state_setup(MigrationIncomingState *= mis, Error **errp) return true; } =20 -static void qemu_start_incoming_migration(const char *uri, bool has_channe= ls, +static void qemu_setup_incoming_migration(const char *uri, bool has_channe= ls, MigrationChannelList *channels, Error **errp) { @@ -787,18 +787,18 @@ static void qemu_start_incoming_migration(const char = *uri, bool has_channels, if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_start_incoming_migration(saddr, errp); + socket_connect_incoming(saddr, errp); } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_start_incoming_migration(saddr->u.fd.str, errp); + fd_connect_incoming(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_incoming_migration(&addr->u.rdma, errp); + rdma_connect_incoming(&addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_incoming_migration(addr->u.exec.args, errp); + exec_connect_incoming(addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_start_incoming_migration(&addr->u.file, errp); + file_connect_incoming(&addr->u.file, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1011,7 +1011,7 @@ static bool postcopy_try_recover(void) return false; } =20 -void migration_incoming_process(void) +void migration_start_incoming(void) { if (postcopy_try_recover()) { return; @@ -1968,7 +1968,7 @@ void qmp_migrate_incoming(const char *uri, bool has_c= hannels, mis->exit_on_error =3D has_exit_on_error ? exit_on_error : INMIGRATE_DEFAULT_EXIT_ON_ERRO= R; =20 - qemu_start_incoming_migration(uri, has_channels, channels, &local_err); + qemu_setup_incoming_migration(uri, has_channels, channels, &local_err); =20 if (local_err) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); @@ -2015,7 +2015,7 @@ void qmp_migrate_recover(const char *uri, Error **err= p) * only re-setup the migration stream and poke existing migration * to continue using that newly established channel. */ - qemu_start_incoming_migration(uri, false, NULL, errp); + qemu_setup_incoming_migration(uri, false, NULL, errp); } =20 void qmp_migrate_pause(Error **errp) @@ -2332,18 +2332,18 @@ static void qmp_migrate_finish(MigrationAddress *ad= dr, Error **errp) if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_start_outgoing_migration(s, saddr, &local_err); + socket_connect_outgoing(s, saddr, &local_err); } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); + fd_connect_outgoing(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_outgoing_migration(s, &addr->u.rdma, &local_err); + rdma_connect_outgoing(s, &addr->u.rdma, &local_err); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_outgoing_migration(s, addr->u.exec.args, &local_err); + exec_connect_outgoing(s, addr->u.exec.args, &local_err); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_start_outgoing_migration(s, &addr->u.file, &local_err); + file_connect_outgoing(s, &addr->u.file, &local_err); } else { error_setg(&local_err, "uri is not a valid migration protocol"); } @@ -4024,7 +4024,7 @@ fail_setup: return NULL; } =20 -void migration_connect(MigrationState *s) +void migration_start_outgoing(MigrationState *s) { Error *local_err =3D NULL; uint64_t rate_limit; diff --git a/migration/migration.h b/migration/migration.h index b55cc40613..c4ea57d80a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -539,7 +539,8 @@ void migration_connect_error_propagate(MigrationState *= s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 -void migration_connect(MigrationState *s); +void migration_start_outgoing(MigrationState *s); +void migration_start_incoming(void); =20 int migration_call_notifiers(MigrationEventType type, Error **errp); =20 diff --git a/migration/rdma.c b/migration/rdma.c index 98a6cebb17..4d63fd723b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3881,17 +3881,16 @@ static void rdma_accept_incoming_migration(void *op= aque) =20 rdma->migration_started_on_destination =3D 1; migration_incoming_setup(ioc, CH_MAIN, &error_abort); - migration_incoming_process(); + migration_start_incoming(); } =20 -void rdma_start_incoming_migration(InetSocketAddress *host_port, - Error **errp) +void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp) { MigrationState *s =3D migrate_get_current(); int ret; RDMAContext *rdma; =20 - trace_rdma_start_incoming_migration(); + trace_rdma_connect_incoming(); =20 /* Avoid ram_block_discard_disable(), cannot change during migration. = */ if (ram_block_discard_is_required()) { @@ -3909,7 +3908,7 @@ void rdma_start_incoming_migration(InetSocketAddress = *host_port, goto err; } =20 - trace_rdma_start_incoming_migration_after_dest_init(); + trace_rdma_connect_incoming_after_dest_init(); =20 ret =3D rdma_listen(rdma->listen_id, 5); =20 @@ -3918,7 +3917,7 @@ void rdma_start_incoming_migration(InetSocketAddress = *host_port, goto cleanup_rdma; } =20 - trace_rdma_start_incoming_migration_after_rdma_listen(); + trace_rdma_connect_incoming_after_rdma_listen(); s->rdma_migration =3D true; qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration, NULL, (void *)(intptr_t)rdma); @@ -3933,8 +3932,8 @@ err: g_free(rdma); } =20 -void rdma_start_outgoing_migration(void *opaque, - InetSocketAddress *host_port, Error **errp) +void rdma_connect_outgoing(void *opaque, + InetSocketAddress *host_port, Error **errp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; @@ -3958,7 +3957,7 @@ void rdma_start_outgoing_migration(void *opaque, goto err; } =20 - trace_rdma_start_outgoing_migration_after_rdma_source_init(); + trace_rdma_connect_outgoing_after_rdma_source_init(); ret =3D qemu_rdma_connect(rdma, false, errp); =20 if (ret < 0) { @@ -3991,11 +3990,11 @@ void rdma_start_outgoing_migration(void *opaque, rdma_return_path->is_return_path =3D true; } =20 - trace_rdma_start_outgoing_migration_after_rdma_connect(); + trace_rdma_connect_outgoing_after_rdma_connect(); =20 s->rdma_migration =3D true; migration_outgoing_setup(rdma_new_output(rdma)); - migration_connect(s); + migration_start_outgoing(s); return; return_path_err: qemu_rdma_cleanup(rdma); diff --git a/migration/rdma.h b/migration/rdma.h index f74f16a459..170c25cf44 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,10 +21,10 @@ =20 #include "system/memory.h" =20 -void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_p= ort, - Error **errp); +void rdma_connect_outgoing(void *opaque, InetSocketAddress *host_port, + Error **errp); =20 -void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **e= rrp); +void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 /* * Constants used by rdma return codes diff --git a/migration/socket.c b/migration/socket.c index f94959828f..f57f1a8e7c 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -80,9 +80,8 @@ fail: migration_connect_error_propagate(data->s, err); } =20 -void socket_start_outgoing_migration(MigrationState *s, - SocketAddress *saddr, - Error **errp) +void socket_connect_outgoing(MigrationState *s, SocketAddress *saddr, + Error **errp) { QIOChannelSocket *sioc =3D qio_channel_socket_new(); struct SocketConnectData *data =3D g_new0(struct SocketConnectData, 1); @@ -140,8 +139,7 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } =20 -void socket_start_incoming_migration(SocketAddress *saddr, - Error **errp) +void socket_connect_incoming(SocketAddress *saddr, Error **errp) { QIONetListener *listener =3D qio_net_listener_new(); MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/socket.h b/migration/socket.h index 04ebbe95a1..f0c89b64c7 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -23,10 +23,10 @@ =20 void socket_send_channel_create(QIOTaskFunc f, void *data); =20 -void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); +void socket_connect_incoming(SocketAddress *saddr, Error **errp); =20 -void socket_start_outgoing_migration(MigrationState *s, - SocketAddress *saddr, Error **errp); +void socket_connect_outgoing(MigrationState *s, + SocketAddress *saddr, Error **errp); void socket_cleanup_outgoing_migration(void); =20 #endif diff --git a/migration/trace-events b/migration/trace-events index cbf10d0b63..91d7506634 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -271,11 +271,11 @@ rdma_registration_handle_wait(void) "" rdma_registration_start(uint64_t flags) "%" PRIu64 rdma_registration_stop(uint64_t flags) "%" PRIu64 rdma_registration_stop_ram(void) "" -rdma_start_incoming_migration(void) "" -rdma_start_incoming_migration_after_dest_init(void) "" -rdma_start_incoming_migration_after_rdma_listen(void) "" -rdma_start_outgoing_migration_after_rdma_connect(void) "" -rdma_start_outgoing_migration_after_rdma_source_init(void) "" +rdma_connect_incoming(void) "" +rdma_connect_incoming_after_dest_init(void) "" +rdma_connect_incoming_after_rdma_listen(void) "" +rdma_connect_outgoing_after_rdma_connect(void) "" +rdma_connect_outgoing_after_rdma_source_init(void) "" =20 # postcopy-ram.c postcopy_discard_send_finish(const char *ramblock, int nwords, int ncmds) = "%s mask words sent=3D%d in %d commands" --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198231; cv=none; d=zohomail.com; s=zohoarc; b=L9kyQMNTAJknaCrTSgmPQJn0mWufJso3qpagry54tGMPg8Vordm7l7odwKOxMdcw//xyUjuAXEutGyyZJM7lwGynh+3oKRBtFeouti5UvO14wQhKwlKT/oSYo3UNsmqmJTTGXpWgNy9wGl5STqxvziujhMlwp/azK8QhO76Unj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198231; h=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=0Tzma7zTzeBM4o+Q2l+82CuYRgsxHZfZQbrKsDA6jwI=; b=SXowi708QCLinxUENmvVgQ9aRcKi+tecHloByaY+Dk3XqzimDjeChpzYYyqgtRdAnmc6tgPdbYyM+XMtzmYfM39bXsvv//grSb4/GgJoPc1C721YEGwKMnnytL3xxmoMmT9SMNtqNU97di8ks3vMna4I4lNtB1Ctzf160RL5iSQ= 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 1769198231746215.01493993043061; Fri, 23 Jan 2026 11:57:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFm-0005xY-0Y; Fri, 23 Jan 2026 14:55:34 -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 1vjNFg-0005h3-Bc for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:28 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFd-0003pR-1e for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:27 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 3A1E33386E; Fri, 23 Jan 2026 19:54:48 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1DAFA1395E; Fri, 23 Jan 2026 19:54:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ANezMwbSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Tzma7zTzeBM4o+Q2l+82CuYRgsxHZfZQbrKsDA6jwI=; b=J3OaxuhZhbMgrAHOvVP1bij6BaP0Vgha7wBIa8LaDoAUyebRF7ATQ0Z/wfHJhjPOX2iQfS SAP/NZqo0qtS2iATIQmouNNy8BbcVUw05STcKE7QkDZjdUR1dy2UorvDkazZhFl+pZTyHZ 0KbkA6hzPphq+4uWzwuMl+7Ne0E+PNk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Tzma7zTzeBM4o+Q2l+82CuYRgsxHZfZQbrKsDA6jwI=; b=/cQMkkF1iLCscFniQLks5UALrSjwRb+PF+6kJ7toMcSBF2b6oPlS4DH31zUTNhthlF+Jbj m46+sb+CbqiJL4Bw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Tzma7zTzeBM4o+Q2l+82CuYRgsxHZfZQbrKsDA6jwI=; b=J3OaxuhZhbMgrAHOvVP1bij6BaP0Vgha7wBIa8LaDoAUyebRF7ATQ0Z/wfHJhjPOX2iQfS SAP/NZqo0qtS2iATIQmouNNy8BbcVUw05STcKE7QkDZjdUR1dy2UorvDkazZhFl+pZTyHZ 0KbkA6hzPphq+4uWzwuMl+7Ne0E+PNk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Tzma7zTzeBM4o+Q2l+82CuYRgsxHZfZQbrKsDA6jwI=; b=/cQMkkF1iLCscFniQLks5UALrSjwRb+PF+6kJ7toMcSBF2b6oPlS4DH31zUTNhthlF+Jbj m46+sb+CbqiJL4Bw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 29/36] migration: Move channel code to channel.c Date: Fri, 23 Jan 2026 16:53:44 -0300 Message-ID: <20260123195352.12850-30-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198232645158500 Content-Type: text/plain; charset="utf-8" Move the code responsible for the various channels connection into channel.c. This is all executed before the migration_thread and process_incoming_migration_co are running, so it helps the reasoning to have them out of migration.c. migration_ioc_process_incoming becomes migration_channel_identify which is more in line with what the function does. Reviewed-by: Peter Xu Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-19-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 99 ++++++++++++++++++++++++++++++++++++++++++- migration/channel.h | 4 ++ migration/migration.c | 96 ----------------------------------------- migration/migration.h | 4 -- migration/rdma.c | 1 + 5 files changed, 103 insertions(+), 101 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index d1eec4942b..f61d30d986 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -14,13 +14,110 @@ #include "channel.h" #include "tls.h" #include "migration.h" +#include "multifd.h" +#include "savevm.h" #include "trace.h" +#include "options.h" #include "qapi/error.h" #include "io/channel-tls.h" #include "io/channel-socket.h" #include "qemu/yank.h" #include "yank_functions.h" =20 +bool migration_has_main_and_multifd_channels(void) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + if (!mis->from_src_file) { + /* main channel not established */ + return false; + } + + if (migrate_multifd() && !multifd_recv_all_channels_created()) { + return false; + } + + /* main and all multifd channels are established */ + return true; +} + +/** + * @migration_has_all_channels: We have received all channels that we need + * + * Returns true when we have got connections to all the channels that + * we need for migration. + */ +bool migration_has_all_channels(void) +{ + if (!migration_has_main_and_multifd_channels()) { + return false; + } + + MigrationIncomingState *mis =3D migration_incoming_get_current(); + if (migrate_postcopy_preempt() && !mis->postcopy_qemufile_dst) { + return false; + } + + return true; +} + +static MigChannelType migration_channel_identify(MigrationIncomingState *m= is, + QIOChannel *ioc, Error **= errp) +{ + MigChannelType channel =3D CH_NONE; + uint32_t channel_magic =3D 0; + int ret =3D 0; + + if (!migration_has_main_and_multifd_channels()) { + if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK= )) { + /* + * With multiple channels, it is possible that we receive chan= nels + * out of order on destination side, causing incorrect mapping= of + * source channels on destination side. Check channel MAGIC to + * decide type of channel. Please note this is best effort, + * postcopy preempt channel does not send any magic number so + * avoid it for postcopy live migration. Also tls live migrati= on + * already does tls handshake while initializing main channel = so + * with tls this issue is not possible. + */ + ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, + sizeof(channel_magic), errp); + if (ret !=3D 0) { + goto out; + } + + channel_magic =3D be32_to_cpu(channel_magic); + if (channel_magic =3D=3D QEMU_VM_FILE_MAGIC) { + channel =3D CH_MAIN; + } else if (channel_magic =3D=3D MULTIFD_MAGIC) { + assert(migrate_multifd()); + channel =3D CH_MULTIFD; + } else if (!mis->from_src_file && + mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED= ) { + /* reconnect main channel for postcopy recovery */ + channel =3D CH_MAIN; + } else { + error_setg(errp, "unknown channel magic: %u", channel_magi= c); + } + } else if (mis->from_src_file && migrate_multifd()) { + /* + * Non-peekable channels like tls/file are processed as + * multifd channels when multifd is enabled. + */ + channel =3D CH_MULTIFD; + } else if (!mis->from_src_file) { + channel =3D CH_MAIN; + } else { + error_setg(errp, "non-peekable channel used without multifd"); + } + } else { + assert(migrate_postcopy_preempt()); + channel =3D CH_POSTCOPY; + } + +out: + return channel; +} + /** * @migration_channel_process_incoming - Create new incoming migration cha= nnel * @@ -42,7 +139,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) migration_tls_channel_process_incoming(ioc, &local_err); } else { migration_ioc_register_yank(ioc); - ch =3D migration_ioc_process_incoming(ioc, &local_err); + ch =3D migration_channel_identify(mis, ioc, &local_err); if (!ch) { goto out; } diff --git a/migration/channel.h b/migration/channel.h index 574bfec65c..19aa5ab795 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -34,4 +34,8 @@ int migration_channel_read_peek(QIOChannel *ioc, const char *buf, const size_t buflen, Error **errp); + +bool migration_has_main_and_multifd_channels(void); +bool migration_has_all_channels(void); + #endif diff --git a/migration/migration.c b/migration/migration.c index 24ef583d96..401b71c3fc 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -926,8 +926,6 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -static bool migration_has_main_and_multifd_channels(void); - /* * Returns whether all the necessary channels to proceed with the * incoming migration have been established without error. @@ -1021,100 +1019,6 @@ void migration_start_incoming(void) qemu_coroutine_enter(co); } =20 -static bool migration_has_main_and_multifd_channels(void) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - if (!mis->from_src_file) { - /* main channel not established */ - return false; - } - - if (migrate_multifd() && !multifd_recv_all_channels_created()) { - return false; - } - - /* main and all multifd channels are established */ - return true; -} - -MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - MigChannelType channel =3D CH_NONE; - uint32_t channel_magic =3D 0; - int ret =3D 0; - - if (!migration_has_main_and_multifd_channels()) { - if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK= )) { - /* - * With multiple channels, it is possible that we receive chan= nels - * out of order on destination side, causing incorrect mapping= of - * source channels on destination side. Check channel MAGIC to - * decide type of channel. Please note this is best effort, - * postcopy preempt channel does not send any magic number so - * avoid it for postcopy live migration. Also tls live migrati= on - * already does tls handshake while initializing main channel = so - * with tls this issue is not possible. - */ - ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, - sizeof(channel_magic), errp); - if (ret !=3D 0) { - goto out; - } - - channel_magic =3D be32_to_cpu(channel_magic); - if (channel_magic =3D=3D QEMU_VM_FILE_MAGIC) { - channel =3D CH_MAIN; - } else if (channel_magic =3D=3D MULTIFD_MAGIC) { - assert(migrate_multifd()); - channel =3D CH_MULTIFD; - } else if (!mis->from_src_file && - mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED= ) { - /* reconnect main channel for postcopy recovery */ - channel =3D CH_MAIN; - } else { - error_setg(errp, "unknown channel magic: %u", channel_magi= c); - } - } else if (mis->from_src_file && migrate_multifd()) { - /* - * Non-peekable channels like tls/file are processed as - * multifd channels when multifd is enabled. - */ - channel =3D CH_MULTIFD; - } else if (!mis->from_src_file) { - channel =3D CH_MAIN; - } else { - error_setg(errp, "non-peekable channel used without multifd"); - } - } else { - assert(migrate_postcopy_preempt()); - channel =3D CH_POSTCOPY; - } - -out: - return channel; -} - -/** - * @migration_has_all_channels: We have received all channels that we need - * - * Returns true when we have got connections to all the channels that - * we need for migration. - */ -bool migration_has_all_channels(void) -{ - if (!migration_has_main_and_multifd_channels()) { - return false; - } - - MigrationIncomingState *mis =3D migration_incoming_get_current(); - if (migrate_postcopy_preempt() && !mis->postcopy_qemufile_dst) { - return false; - } - - return true; -} - int migrate_send_rp_switchover_ack(MigrationIncomingState *mis) { return migrate_send_rp_message(mis, MIG_RP_MSG_SWITCHOVER_ACK, 0, NULL= ); diff --git a/migration/migration.h b/migration/migration.h index c4ea57d80a..b6888daced 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -28,7 +28,6 @@ #include "postcopy-ram.h" #include "system/runstate.h" #include "migration/misc.h" -#include "channel.h" =20 #define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" #define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" @@ -528,13 +527,10 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); void migration_outgoing_setup(QIOChannel *ioc); =20 -bool migration_has_all_channels(void); - void migration_connect_error_propagate(MigrationState *s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); diff --git a/migration/rdma.c b/migration/rdma.c index 4d63fd723b..e628a20aec 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -18,6 +18,7 @@ #include "channel.h" #include "qapi/error.h" #include "qemu/cutils.h" +#include "channel.h" #include "exec/target_page.h" #include "rdma.h" #include "migration.h" --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198303; cv=none; d=zohomail.com; s=zohoarc; b=AmORET/Ipapk+D/1Zpp1ukz/HKB1DrDWefpCUTpIenBYJVbCjn/Tg0MADUjI8p52387yw9YM/+Wxc2AWpqFaYenineYxVz3NutludWzPxV3IiSIyyYtAOuujjRF08Wq0NnGobTXW7pRdpIG0pdCI2Djbdji2PvFghljh/kbN/nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198303; h=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=3c/OiO7czQDIFsZ9VGY7/q+z63y6OkAvZRoDfWQrEK4=; b=hZwJKM38p/UkvqazCu/ZuLWYjp94HqKAWCIgSCOIkFYLDkeNcBU+84zf8JrDeMkK+le65GpR1OI9jdwrw/5luiiF1SH70uYlyv5MpRg8tGZ4lwFow/XWtTpEo4286HkWS2HyECW7AUB4dIzSe6fjWiVTrWVrHBl+H+YHC6syt/w= 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 1769198303594817.4053480581059; Fri, 23 Jan 2026 11:58:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFn-00066z-G9; Fri, 23 Jan 2026 14:55:35 -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 1vjNFk-0005xg-0x for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:33 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFh-0003pm-Da for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:31 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 0A2835BCCF; Fri, 23 Jan 2026 19:54:50 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A850C1395E; Fri, 23 Jan 2026 19:54:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uJ/yGQjSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198090; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3c/OiO7czQDIFsZ9VGY7/q+z63y6OkAvZRoDfWQrEK4=; b=kueRbBPfyhtSnP0InRN535TGYbNrwHHZKrICFrRqxy2LAS+D3NZUX2Vkoc4k57noy7p7y3 RbCzq9v6pEOXFTBKPTF+frg5CmruZP4VpnBR95Uqy84taBhkZ5q0J5dtDCQxh+SCitlCwD jtvje/TIXbVF/+WhA/knxHcq7DKRem0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198090; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3c/OiO7czQDIFsZ9VGY7/q+z63y6OkAvZRoDfWQrEK4=; b=AsqCLYAkPjAIZItzcN0tQo6oZSuh9UbZXBjRHJodhEAO1VKzeYoGwnlr7EanDJ1RJ1x7+8 UkvsNOWXyjBEOUBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198090; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3c/OiO7czQDIFsZ9VGY7/q+z63y6OkAvZRoDfWQrEK4=; b=kueRbBPfyhtSnP0InRN535TGYbNrwHHZKrICFrRqxy2LAS+D3NZUX2Vkoc4k57noy7p7y3 RbCzq9v6pEOXFTBKPTF+frg5CmruZP4VpnBR95Uqy84taBhkZ5q0J5dtDCQxh+SCitlCwD jtvje/TIXbVF/+WhA/knxHcq7DKRem0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198090; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3c/OiO7czQDIFsZ9VGY7/q+z63y6OkAvZRoDfWQrEK4=; b=AsqCLYAkPjAIZItzcN0tQo6oZSuh9UbZXBjRHJodhEAO1VKzeYoGwnlr7EanDJ1RJ1x7+8 UkvsNOWXyjBEOUBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 30/36] migration: Move transport connection code into channel.c Date: Fri, 23 Jan 2026 16:53:45 -0300 Message-ID: <20260123195352.12850-31-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198305037158500 Content-Type: text/plain; charset="utf-8" Move the _connect_incoming|outgoing functions to channel.c. It leaves migration.c to deal with the established connection only. While here, sort the includes. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-20-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 66 +++++++++++++++++++++++++++++++++++++++---- migration/channel.h | 4 +++ migration/migration.c | 46 ++---------------------------- 3 files changed, 67 insertions(+), 49 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index f61d30d986..56c80b5cdf 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -12,18 +12,74 @@ =20 #include "qemu/osdep.h" #include "channel.h" -#include "tls.h" +#include "exec.h" +#include "fd.h" +#include "file.h" +#include "io/channel-socket.h" +#include "io/channel-tls.h" #include "migration.h" #include "multifd.h" -#include "savevm.h" -#include "trace.h" #include "options.h" +#include "qapi/qapi-types-migration.h" #include "qapi/error.h" -#include "io/channel-tls.h" -#include "io/channel-socket.h" +#include "qemu-file.h" #include "qemu/yank.h" +#include "rdma.h" +#include "savevm.h" +#include "socket.h" +#include "tls.h" +#include "trace.h" #include "yank_functions.h" =20 +void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, + Error **errp) +{ + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &addr->u.socket; + if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { + socket_connect_outgoing(s, saddr, errp); + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + fd_connect_outgoing(s, saddr->u.fd.str, errp); + } +#ifdef CONFIG_RDMA + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_connect_outgoing(s, &addr->u.rdma, errp); +#endif + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_connect_outgoing(s, addr->u.exec.args, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_connect_outgoing(s, &addr->u.file, errp); + } else { + error_setg(errp, "uri is not a valid migration protocol"); + } +} + +void migration_connect_incoming(MigrationAddress *addr, Error **errp) +{ + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &addr->u.socket; + if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { + socket_connect_incoming(saddr, errp); + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + fd_connect_incoming(saddr->u.fd.str, errp); + } +#ifdef CONFIG_RDMA + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_connect_incoming(&addr->u.rdma, errp); +#endif + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_connect_incoming(addr->u.exec.args, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_connect_incoming(&addr->u.file, errp); + } else { + error_setg(errp, "unknown migration protocol"); + } +} + bool migration_has_main_and_multifd_channels(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/channel.h b/migration/channel.h index 19aa5ab795..8264fe327d 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -17,6 +17,7 @@ #define QEMU_MIGRATION_CHANNEL_H =20 #include "io/channel.h" +#include "qapi/qapi-types-migration.h" =20 /* Migration channel types */ typedef enum { @@ -38,4 +39,7 @@ int migration_channel_read_peek(QIOChannel *ioc, bool migration_has_main_and_multifd_channels(void); bool migration_has_all_channels(void); =20 +void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, + Error **errp); +void migration_connect_incoming(MigrationAddress *addr, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index 401b71c3fc..8226a6e557 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -20,13 +20,10 @@ #include "qemu/main-loop.h" #include "migration/blocker.h" #include "exec.h" -#include "fd.h" #include "file.h" -#include "socket.h" #include "system/runstate.h" #include "system/system.h" #include "system/cpu-throttle.h" -#include "rdma.h" #include "ram.h" #include "migration/cpr.h" #include "migration/global_state.h" @@ -782,26 +779,7 @@ static void qemu_setup_incoming_migration(const char *= uri, bool has_channels, return; } =20 - if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr =3D &addr->u.socket; - if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_connect_incoming(saddr, errp); - } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_connect_incoming(saddr->u.fd.str, errp); - } -#ifdef CONFIG_RDMA - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_connect_incoming(&addr->u.rdma, errp); -#endif - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_connect_incoming(addr->u.exec.args, errp); - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_connect_incoming(&addr->u.file, errp); - } else { - error_setg(errp, "unknown migration protocol: %s", uri); - } + migration_connect_incoming(addr, errp); =20 /* Close cpr socket to tell source that we are listening */ cpr_state_close(); @@ -2231,31 +2209,11 @@ static void qmp_migrate_finish(MigrationAddress *ad= dr, Error **errp) MigrationState *s =3D migrate_get_current(); Error *local_err =3D NULL; =20 - if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr =3D &addr->u.socket; - if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_connect_outgoing(s, saddr, &local_err); - } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_connect_outgoing(s, saddr->u.fd.str, &local_err); - } -#ifdef CONFIG_RDMA - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_connect_outgoing(s, &addr->u.rdma, &local_err); -#endif - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_connect_outgoing(s, addr->u.exec.args, &local_err); - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_connect_outgoing(s, &addr->u.file, &local_err); - } else { - error_setg(&local_err, "uri is not a valid migration protocol"); - } + migration_connect_outgoing(s, addr, &local_err); =20 if (local_err) { migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); - return; } } =20 --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198262; cv=none; d=zohomail.com; s=zohoarc; b=j/DcDLFABAV6v6hj9iKVzNA9ADQSHH0wfws/MOa30R1x977l84p/8jSS1OB5JBeHhQOHZh9wYfNbT3jKe1P84+4ulHeXjwlWLPxBDxJRySjbm8FqJkQ/Ess2Ltq280MyLFG8sjmquWXZxPDcIpE3g20QaGD3trfo5RtPv6L6+50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198262; h=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=4IATb0QqTzYKzS4rL9V/BnPc4x3MZhFA20VoNYqecfc=; b=Z5+b+z/6UNl68K4LDjgq+TRV9tq/mLt1le/gPbIIDbtrbCLlSxwwS8kekcM/SNZuTUXDmt+fv6wbeYcmmvxfBbKp/8KPZ9pTJkqW/FDfmXOANTGokLmyiC2p1LVUiKBYg2o8+zJtWvVmZPGXe0EqThzsS7Qqf/VonatALHXge78= 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 1769198262078188.457000513376; Fri, 23 Jan 2026 11:57:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFq-0006PW-E5; Fri, 23 Jan 2026 14:55:38 -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 1vjNFo-0006BB-2x for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:36 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFk-0003qI-8y for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:35 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id CBD1233866; Fri, 23 Jan 2026 19:54:51 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7758E1395E; Fri, 23 Jan 2026 19:54:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oHwCDgrSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198091; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4IATb0QqTzYKzS4rL9V/BnPc4x3MZhFA20VoNYqecfc=; b=JjR7PR6SQUybDHXiIr9g0hK7jJnAVi0Pu+7m+keDCoyQHqy8UFVg9i52Fh3WBDrhaeNP3l 1oHsvEcJ2h+0vP7Nd2pB4zMc04luD9S/s7Ujc+cfB83/Oks8Yn3MOr2vMmvj6shUAjwC1l rWBHGOusP6UNXRytJqF1HSUax72KUdM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198091; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4IATb0QqTzYKzS4rL9V/BnPc4x3MZhFA20VoNYqecfc=; b=4tSyvFkFngRFR2Bv2GIzGUU5rrUUqS+Tmb0KGnQCHaDIz7UmOhpKYHLOc1Xk5psJbQDIMM UnENLKwhNGHV6ADA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=JjR7PR6S; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=4tSyvFkF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198091; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4IATb0QqTzYKzS4rL9V/BnPc4x3MZhFA20VoNYqecfc=; b=JjR7PR6SQUybDHXiIr9g0hK7jJnAVi0Pu+7m+keDCoyQHqy8UFVg9i52Fh3WBDrhaeNP3l 1oHsvEcJ2h+0vP7Nd2pB4zMc04luD9S/s7Ujc+cfB83/Oks8Yn3MOr2vMmvj6shUAjwC1l rWBHGOusP6UNXRytJqF1HSUax72KUdM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198091; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4IATb0QqTzYKzS4rL9V/BnPc4x3MZhFA20VoNYqecfc=; b=4tSyvFkFngRFR2Bv2GIzGUU5rrUUqS+Tmb0KGnQCHaDIz7UmOhpKYHLOc1Xk5psJbQDIMM UnENLKwhNGHV6ADA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 31/36] migration: Move channel parsing to channel.c Date: Fri, 23 Jan 2026 16:53:46 -0300 Message-ID: <20260123195352.12850-32-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: CBD1233866 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198262776158500 Content-Type: text/plain; charset="utf-8" Encapsulate the MigrationChannelList parsing in a new migrate_channels_parse() located at channel.c. This also makes the memory management of the MigrationAddress more uniform. Previously, half the parsing code (uri parsing) would allocate memory for the address while the other half (channel parsing) would instead pass the original QAPI object along. After this patch, the MigrationAddress is always QAPI_CLONEd, so the callers can use g_autoptr(MigrationAddress) in all cases. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-21-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 49 +++++++++++++++++++++++++++++++++++++++ migration/channel.h | 5 ++++ migration/migration.c | 53 +++++++++++-------------------------------- 3 files changed, 67 insertions(+), 40 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 56c80b5cdf..433d67fba0 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "channel.h" #include "exec.h" #include "fd.h" @@ -20,7 +21,9 @@ #include "migration.h" #include "multifd.h" #include "options.h" +#include "qapi/clone-visitor.h" #include "qapi/qapi-types-migration.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/error.h" #include "qemu-file.h" #include "qemu/yank.h" @@ -280,3 +283,49 @@ int migration_channel_read_peek(QIOChannel *ioc, =20 return 0; } + +bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) +{ + MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; + + if (!cpr_channelp && channels->next) { + error_setg(errp, "Channel list must have only one entry, " + "for type 'main'"); + return false; + } + + for ( ; channels; channels =3D channels->next) { + MigrationChannelType type; + + type =3D channels->value->channel_type; + if (channelv[type]) { + error_setg(errp, "Channel list has more than one %s entry", + MigrationChannelType_str(type)); + return false; + } + channelv[type] =3D channels->value; + } + + if (cpr_channelp) { + *cpr_channelp =3D QAPI_CLONE(MigrationChannel, + channelv[MIGRATION_CHANNEL_TYPE_CPR]); + + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !*cpr_channelp)= { + error_setg(errp, "missing 'cpr' migration channel"); + return false; + } + } + + *main_channelp =3D QAPI_CLONE(MigrationChannel, + channelv[MIGRATION_CHANNEL_TYPE_MAIN]); + + if (!(*main_channelp)->addr) { + error_setg(errp, "Channel list has no main entry"); + return false; + } + + return true; +} diff --git a/migration/channel.h b/migration/channel.h index 8264fe327d..5110fb45a4 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -42,4 +42,9 @@ bool migration_has_all_channels(void); void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, Error **errp); void migration_connect_incoming(MigrationAddress *addr, Error **errp); + +bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index 8226a6e557..f823bf2584 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -740,8 +740,7 @@ static void qemu_setup_incoming_migration(const char *u= ri, bool has_channels, MigrationChannelList *channels, Error **errp) { - g_autoptr(MigrationChannel) channel =3D NULL; - MigrationAddress *addr =3D NULL; + g_autoptr(MigrationChannel) main_ch =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 /* @@ -753,25 +752,20 @@ static void qemu_setup_incoming_migration(const char = *uri, bool has_channels, } =20 if (channels) { - /* To verify that Migrate channel list has only item */ - if (channels->next) { - error_setg(errp, "Channel list must have only one entry, " - "for type 'main'"); + if (!migrate_channels_parse(channels, &main_ch, NULL, errp)) { return; } - addr =3D channels->value->addr; } =20 if (uri) { /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &channel, errp)) { + if (!migrate_uri_parse(uri, &main_ch, errp)) { return; } - addr =3D channel->addr; } =20 /* transport mechanism not suitable for migration? */ - if (!migration_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(main_ch->addr, errp)) { return; } =20 @@ -779,7 +773,7 @@ static void qemu_setup_incoming_migration(const char *u= ri, bool has_channels, return; } =20 - migration_connect_incoming(addr, errp); + migration_connect_incoming(main_ch->addr, errp); =20 /* Close cpr socket to tell source that we are listening */ cpr_state_close(); @@ -2113,10 +2107,8 @@ void qmp_migrate(const char *uri, bool has_channels, bool has_resume, bool resume, Error **errp) { MigrationState *s =3D migrate_get_current(); - g_autoptr(MigrationChannel) channel =3D NULL; - MigrationAddress *addr =3D NULL; - MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; - MigrationChannel *cpr_channel =3D NULL; + g_autoptr(MigrationChannel) main_ch =3D NULL; + g_autoptr(MigrationChannel) cpr_ch =3D NULL; =20 /* * Having preliminary checks for uri and channel @@ -2127,39 +2119,20 @@ void qmp_migrate(const char *uri, bool has_channels, } =20 if (channels) { - for ( ; channels; channels =3D channels->next) { - MigrationChannelType type =3D channels->value->channel_type; - - if (channelv[type]) { - error_setg(errp, "Channel list has more than one %s entry", - MigrationChannelType_str(type)); - return; - } - channelv[type] =3D channels->value; - } - cpr_channel =3D channelv[MIGRATION_CHANNEL_TYPE_CPR]; - addr =3D channelv[MIGRATION_CHANNEL_TYPE_MAIN]->addr; - if (!addr) { - error_setg(errp, "Channel list has no main entry"); + if (!migrate_channels_parse(channels, &main_ch, &cpr_ch, errp)) { return; } } =20 if (uri) { /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &channel, errp)) { + if (!migrate_uri_parse(uri, &main_ch, errp)) { return; } - addr =3D channel->addr; } =20 /* transport mechanism not suitable for migration? */ - if (!migration_transport_compatible(addr, errp)) { - return; - } - - if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { - error_setg(errp, "missing 'cpr' migration channel"); + if (!migration_transport_compatible(main_ch->addr, errp)) { return; } =20 @@ -2175,7 +2148,7 @@ void qmp_migrate(const char *uri, bool has_channels, */ Error *local_err =3D NULL; =20 - if (!cpr_state_save(cpr_channel, &local_err)) { + if (!cpr_state_save(cpr_ch, &local_err)) { goto out; } =20 @@ -2191,10 +2164,10 @@ void qmp_migrate(const char *uri, bool has_channels, */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, - QAPI_CLONE(MigrationAddress, addr)); + QAPI_CLONE(MigrationAddress, main_ch->addr)); =20 } else { - qmp_migrate_finish(addr, errp); + qmp_migrate_finish(main_ch->addr, errp); } =20 out: --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198305; cv=none; d=zohomail.com; s=zohoarc; b=efaacTsn1o/ed1z52q93Ttw4sPeFAd62GTArbd9EbJnkAL2ClBw+oH5fuEzvj8TwvkPc+cT/K04v9fEaWlSrtyobKFdygmzqk0i2LHtiEFiD53Q5MeyatdJtu/jjyL8L81qq+dL+hmbPOgO5Gae7akXAwZOP6JLLMBKbz0hv/MM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198305; h=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=8zDqLxoYlwVjgUAFNvnbMOjocAY9p1izeH2cO3nsfxA=; b=d5hYzUYWLhvSoAq2mYoaB59oq5gV+iLoxT8qO8D929akyWNYujEZQYeC9cix8LAFRb5qXJQlY1UBii/gOrN0jgcUzohV9gbbebJMB7eZOLqUfnE21T1qS0Yd8FLTWBo6HRABXuCwl+Ox8im4qXfSdZQzTedZpJ5eCpHU5+WMxvA= 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 1769198305981214.90885127840681; Fri, 23 Jan 2026 11:58:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFv-0006wm-VB; Fri, 23 Jan 2026 14:55:44 -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 1vjNFu-0006nQ-7E for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:42 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFr-0003rJ-U0 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:41 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 9BB6A33869; Fri, 23 Jan 2026 19:54:53 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 458ED1395E; Fri, 23 Jan 2026 19:54:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OATWAQzSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zDqLxoYlwVjgUAFNvnbMOjocAY9p1izeH2cO3nsfxA=; b=qi3q/ogOfsVFBhDMHR2PT2QiW8ocrOU57oF0Jac73g2qkWWEabedGsulUp6iyp9wpTno8Z +2QERTXAIllKUE+17yh8zthWiaMqXx/BhVpFnAWmpufwhrKZjlU+6AqrukbnDFnTZZ17xa ugFjb1Z1Vf5N80hGDtAo4bu5BbaogsY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zDqLxoYlwVjgUAFNvnbMOjocAY9p1izeH2cO3nsfxA=; b=4B1MhfZOkljJTfUxhsoRDgZ6acg4TzhAtQb1e4Rt9N603XTdymMacf5RbJe6yzaUXEoOt+ IrcPx5XkCfaOCLBA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="qi3q/ogO"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=4B1MhfZO DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zDqLxoYlwVjgUAFNvnbMOjocAY9p1izeH2cO3nsfxA=; b=qi3q/ogOfsVFBhDMHR2PT2QiW8ocrOU57oF0Jac73g2qkWWEabedGsulUp6iyp9wpTno8Z +2QERTXAIllKUE+17yh8zthWiaMqXx/BhVpFnAWmpufwhrKZjlU+6AqrukbnDFnTZZ17xa ugFjb1Z1Vf5N80hGDtAo4bu5BbaogsY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zDqLxoYlwVjgUAFNvnbMOjocAY9p1izeH2cO3nsfxA=; b=4B1MhfZOkljJTfUxhsoRDgZ6acg4TzhAtQb1e4Rt9N603XTdymMacf5RbJe6yzaUXEoOt+ IrcPx5XkCfaOCLBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 32/36] migration: Move URI parsing to channel.c Date: Fri, 23 Jan 2026 16:53:47 -0300 Message-ID: <20260123195352.12850-33-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 9BB6A33869 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198308336154100 Content-Type: text/plain; charset="utf-8" The migrate_uri_parse function is responsible for converting the URI string into a MigrationChannel for consumption by the rest of the code. Move it to channel.c and add a wrapper that calls both URI and channels parsing. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-22-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 82 +++++++++++++++++++++++++++++++++++-- migration/channel.h | 9 ++-- migration/migration.c | 95 ++----------------------------------------- 3 files changed, 86 insertions(+), 100 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 433d67fba0..1e4778455d 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -284,10 +284,10 @@ int migration_channel_read_peek(QIOChannel *ioc, return 0; } =20 -bool migrate_channels_parse(MigrationChannelList *channels, - MigrationChannel **main_channelp, - MigrationChannel **cpr_channelp, - Error **errp) +static bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) { MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; =20 @@ -329,3 +329,77 @@ bool migrate_channels_parse(MigrationChannelList *chan= nels, =20 return true; } + +bool migrate_uri_parse(const char *uri, MigrationChannel **channel, + Error **errp) +{ + g_autoptr(MigrationChannel) val =3D g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); + InetSocketAddress *isock =3D &addr->u.rdma; + strList **tail =3D &addr->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_EXEC; +#ifdef WIN32 + QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); + QAPI_LIST_APPEND(tail, g_strdup("/c")); +#else + QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); + QAPI_LIST_APPEND(tail, g_strdup("-c")); +#endif + QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); + } else if (strstart(uri, "rdma:", NULL)) { + if (inet_parse(isock, uri + strlen("rdma:"), errp)) { + qapi_free_InetSocketAddress(isock); + return false; + } + addr->transport =3D MIGRATION_ADDRESS_TYPE_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_SOCKET; + SocketAddress *saddr =3D socket_parse(uri, errp); + if (!saddr) { + return false; + } + addr->u.socket.type =3D saddr->type; + addr->u.socket.u =3D saddr->u; + /* Don't free the objects inside; their ownership moved to "addr" = */ + g_free(saddr); + } else if (strstart(uri, "file:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_FILE; + addr->u.file.filename =3D g_strdup(uri + strlen("file:")); + if (file_parse_offset(addr->u.file.filename, &addr->u.file.offset, + errp)) { + return false; + } + } else { + error_setg(errp, "unknown migration protocol: %s", uri); + return false; + } + + val->channel_type =3D MIGRATION_CHANNEL_TYPE_MAIN; + val->addr =3D g_steal_pointer(&addr); + *channel =3D g_steal_pointer(&val); + return true; +} + +bool migration_channel_parse_input(const char *uri, + MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) +{ + if (!uri =3D=3D !channels) { + error_setg(errp, "need either 'uri' or 'channels' argument"); + return false; + } + + if (channels) { + return migrate_channels_parse(channels, main_channelp, cpr_channel= p, + errp); + } else { + return migrate_uri_parse(uri, main_channelp, errp); + } +} diff --git a/migration/channel.h b/migration/channel.h index 5110fb45a4..a7d0d29058 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -43,8 +43,9 @@ void migration_connect_outgoing(MigrationState *s, Migrat= ionAddress *addr, Error **errp); void migration_connect_incoming(MigrationAddress *addr, Error **errp); =20 -bool migrate_channels_parse(MigrationChannelList *channels, - MigrationChannel **main_channelp, - MigrationChannel **cpr_channelp, - Error **errp); +bool migration_channel_parse_input(const char *uri, + MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index f823bf2584..336d5df3b2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -15,7 +15,6 @@ =20 #include "qemu/osdep.h" #include "qemu/ctype.h" -#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "migration/blocker.h" @@ -658,61 +657,6 @@ bool migrate_is_uri(const char *uri) return *uri =3D=3D ':'; } =20 -bool migrate_uri_parse(const char *uri, MigrationChannel **channel, - Error **errp) -{ - g_autoptr(MigrationChannel) val =3D g_new0(MigrationChannel, 1); - g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); - InetSocketAddress *isock =3D &addr->u.rdma; - strList **tail =3D &addr->u.exec.args; - - if (strstart(uri, "exec:", NULL)) { - addr->transport =3D MIGRATION_ADDRESS_TYPE_EXEC; -#ifdef WIN32 - QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); - QAPI_LIST_APPEND(tail, g_strdup("/c")); -#else - QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); - QAPI_LIST_APPEND(tail, g_strdup("-c")); -#endif - QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); - } else if (strstart(uri, "rdma:", NULL)) { - if (inet_parse(isock, uri + strlen("rdma:"), errp)) { - qapi_free_InetSocketAddress(isock); - return false; - } - addr->transport =3D MIGRATION_ADDRESS_TYPE_RDMA; - } else if (strstart(uri, "tcp:", NULL) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL) || - strstart(uri, "fd:", NULL)) { - addr->transport =3D MIGRATION_ADDRESS_TYPE_SOCKET; - SocketAddress *saddr =3D socket_parse(uri, errp); - if (!saddr) { - return false; - } - addr->u.socket.type =3D saddr->type; - addr->u.socket.u =3D saddr->u; - /* Don't free the objects inside; their ownership moved to "addr" = */ - g_free(saddr); - } else if (strstart(uri, "file:", NULL)) { - addr->transport =3D MIGRATION_ADDRESS_TYPE_FILE; - addr->u.file.filename =3D g_strdup(uri + strlen("file:")); - if (file_parse_offset(addr->u.file.filename, &addr->u.file.offset, - errp)) { - return false; - } - } else { - error_setg(errp, "unknown migration protocol: %s", uri); - return false; - } - - val->channel_type =3D MIGRATION_CHANNEL_TYPE_MAIN; - val->addr =3D g_steal_pointer(&addr); - *channel =3D g_steal_pointer(&val); - return true; -} - static bool migration_incoming_state_setup(MigrationIncomingState *mis, Error **errp) { @@ -743,27 +687,10 @@ static void qemu_setup_incoming_migration(const char = *uri, bool has_channels, g_autoptr(MigrationChannel) main_ch =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - /* - * Having preliminary checks for uri and channel - */ - if (!uri =3D=3D !channels) { - error_setg(errp, "need either 'uri' or 'channels' argument"); + if (!migration_channel_parse_input(uri, channels, &main_ch, NULL, errp= )) { return; } =20 - if (channels) { - if (!migrate_channels_parse(channels, &main_ch, NULL, errp)) { - return; - } - } - - if (uri) { - /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &main_ch, errp)) { - return; - } - } - /* transport mechanism not suitable for migration? */ if (!migration_transport_compatible(main_ch->addr, errp)) { return; @@ -2110,27 +2037,11 @@ void qmp_migrate(const char *uri, bool has_channels, g_autoptr(MigrationChannel) main_ch =3D NULL; g_autoptr(MigrationChannel) cpr_ch =3D NULL; =20 - /* - * Having preliminary checks for uri and channel - */ - if (!uri =3D=3D !channels) { - error_setg(errp, "need either 'uri' or 'channels' argument"); + if (!migration_channel_parse_input(uri, channels, &main_ch, &cpr_ch, + errp)) { return; } =20 - if (channels) { - if (!migrate_channels_parse(channels, &main_ch, &cpr_ch, errp)) { - return; - } - } - - if (uri) { - /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &main_ch, errp)) { - return; - } - } - /* transport mechanism not suitable for migration? */ if (!migration_transport_compatible(main_ch->addr, errp)) { return; --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198270; cv=none; d=zohomail.com; s=zohoarc; b=bqTM86Z1z+gLZUsL1wDD64usYQaAndW+4ObsfGKNqsOmMzTbMd7w2S7bb/jQp8Txxc299qJXl60lUvVMHJaMim4O90HKHUFWOKdaLCR/rIRI8CqZAKeH35WvEvFLlPmJK6AuMATdltydHgboKwOKnK2nNh76BKh7Uon/CbMkKO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198270; h=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=JGMsJuJkTUWBRnQ/Za12fkFwl/bcaFJO7KolONxWGS0=; b=M0E4zv9z+64SGJnCqv2g0LCMasgzXISsCDKVbc6yG9LZumilcjYT3/KOEHJO451DzUlkTyS+0F/kTyIWMOVYIoJMTovcXejvLIpe8lzY3WZ09F83mY/uBMWTfPmg7Brd/wQrXpBqPMjSbgTsmus6Z+t5RYTbkxC5lDOMaReC9uE= 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 1769198270611218.92299343871184; Fri, 23 Jan 2026 11:57:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNG2-0007LM-6a; Fri, 23 Jan 2026 14:55:50 -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 1vjNG0-0007AE-67 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:48 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFy-0003rv-FV for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:47 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id E80143386F; Fri, 23 Jan 2026 19:54:55 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 199561395E; Fri, 23 Jan 2026 19:54:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aDMVMQ3Sc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198096; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JGMsJuJkTUWBRnQ/Za12fkFwl/bcaFJO7KolONxWGS0=; b=jyuVrMCjLz327/Xh3KfYNNd/CBjJftUyfBWZFP84fwh0NdHO/TISlkIhv3BD7OfWdzohbc KMbJagqToXWz21ia38rdHgkAiNiJzgXod8mBEH0NCzBoJlCRR4JDDx2jj1fNJkNu3nu1GS 8/u6j1a6gyX5VLl+9a1HIY1cntRdtmI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198096; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JGMsJuJkTUWBRnQ/Za12fkFwl/bcaFJO7KolONxWGS0=; b=vEa2NLGamPkfEMcaokaaVTv3dcehsNJcg/V2c9CiZ6Nlhw3l0riFhDUCQhE9Gw3+aPkMhj fNQHcQ6oPELwF/Ag== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198095; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JGMsJuJkTUWBRnQ/Za12fkFwl/bcaFJO7KolONxWGS0=; b=i6XxuYYD52iU4+BSzkDa+C4kgilzrhBGOCPtybpUtcLorsuqKvlU2c1SUVp0rdY9xBrUhC BEZsWM/Ha02FcEk6Z0Af4s8EKBlQRigTcsN4jRyNMkvoKTqvImEECbnjP56rT+gc0CbmyQ +CYasGwltwwS+Kae/YPStAJv8OdhGHo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198095; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JGMsJuJkTUWBRnQ/Za12fkFwl/bcaFJO7KolONxWGS0=; b=BcmomRfgbRffnK9ag8x0rCg1vrI4x512qiLFkmL+ULjkxEgxlZg7bItjfWum9xzSURlZKD RjQEzkTYvVC9zWBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Mark Kanda , Ben Chaney , Prasad Pandit Subject: [PULL 33/36] migration: Free cpr-transfer MigrationAddress along with gsource Date: Fri, 23 Jan 2026 16:53:48 -0300 Message-ID: <20260123195352.12850-34-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[oracle.com:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769198271830154100 Content-Type: text/plain; charset="utf-8" When setting a callback on a Glib source and giving it a data pointer, it's natural to also provide the destructor for the data in question. Since migrate_hup_add() already needs to clone the MigrationAddress when setting the qmp_migrate_finish_cb callback, also pass the qapi_free_MigrationAddress as the GDestroyNotify callback. With this the address doesn't need to be freed at the callback body, making the management of that memory slightly simpler. Cc: Mark Kanda Cc: Ben Chaney Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-23-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 336d5df3b2..785e01c0f3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2004,9 +2004,11 @@ static void qmp_migrate_finish(MigrationAddress *add= r, Error **errp); static void migrate_hup_add(MigrationState *s, QIOChannel *ioc, GSourceFun= c cb, void *opaque) { - s->hup_source =3D qio_channel_create_watch(ioc, G_IO_HUP); - g_source_set_callback(s->hup_source, cb, opaque, NULL); - g_source_attach(s->hup_source, NULL); + s->hup_source =3D qio_channel_create_watch(ioc, G_IO_HUP); + g_source_set_callback(s->hup_source, cb, + QAPI_CLONE(MigrationAddress, opaque), + (GDestroyNotify)qapi_free_MigrationAddress); + g_source_attach(s->hup_source, NULL); } =20 static void migrate_hup_delete(MigrationState *s) @@ -2025,7 +2027,6 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, MigrationAddress *addr =3D opaque; =20 qmp_migrate_finish(addr, NULL); - qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } =20 @@ -2075,7 +2076,7 @@ void qmp_migrate(const char *uri, bool has_channels, */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, - QAPI_CLONE(MigrationAddress, main_ch->addr)); + main_ch->addr); =20 } else { qmp_migrate_finish(main_ch->addr, errp); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198190; cv=none; d=zohomail.com; s=zohoarc; b=KPS+ON3l/1I8N7UhcJhYx2uBbxt7yF5AWkMQIC8Oa93L/t6eHEc1bt22GY2bmY8tnIy2K4o1T8bcmSRuUpAMGCegjIoGCjr4RPWnyU7xpW6IELCyPXgOVvGBWIhAcMviSWoXxJaH3nORNl1Sy51a0453EhWgXI0G4mhQZ3r80eo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198190; h=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=5KRCrhQ0FF5p+zYPasvKUI3RT6y8WkP94QTf1EwbKF8=; b=GileYskC/PYqe8BBrkVzEJ9kIsfREWzNFtAROmliPz973MzNXn33JDSUsUrwCj1oYv4ApK1HLkmRR+xag+YMd273aDMypJfwMsNXwO0uiDhgIJLn+XHoC2zy4dWdXISf2pn55MFnWd9qYW2tAWEf/h2P1PIeEqRBD5QzAO8A2cs= 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 1769198190073842.0508059249058; Fri, 23 Jan 2026 11:56:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNFs-0006bQ-7C; Fri, 23 Jan 2026 14:55:40 -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 1vjNFp-0006Mc-Qu for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:37 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNFn-0003qr-RI for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:37 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id BA0105BCD0; Fri, 23 Jan 2026 19:54:57 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 609C91395E; Fri, 23 Jan 2026 19:54:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oI+LCBDSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5KRCrhQ0FF5p+zYPasvKUI3RT6y8WkP94QTf1EwbKF8=; b=EypdcVmdodUPbvAD4m731MbZASkFBEO6F5LI5+aBaVOoDFDoqSDayuvAMP0gsO6da+Z3ny 2r8yX3miPIlboAktydLCQgj/8aqw2KRdHaCEHv9b0Ulvw/N48fhxkcrEbSotgf7E0DBrWV 63hwUkNJdSgc5GneHlAjzY6B8JE2yMc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5KRCrhQ0FF5p+zYPasvKUI3RT6y8WkP94QTf1EwbKF8=; b=3zhr7KP2pj5uTxGtIFKed8DfaF7Oq8dtvjnjcLK4WUgpL4bRxcnZ2rXgaJH27d+EtoNubY uV4a0koc+k3D63AA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5KRCrhQ0FF5p+zYPasvKUI3RT6y8WkP94QTf1EwbKF8=; b=EypdcVmdodUPbvAD4m731MbZASkFBEO6F5LI5+aBaVOoDFDoqSDayuvAMP0gsO6da+Z3ny 2r8yX3miPIlboAktydLCQgj/8aqw2KRdHaCEHv9b0Ulvw/N48fhxkcrEbSotgf7E0DBrWV 63hwUkNJdSgc5GneHlAjzY6B8JE2yMc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5KRCrhQ0FF5p+zYPasvKUI3RT6y8WkP94QTf1EwbKF8=; b=3zhr7KP2pj5uTxGtIFKed8DfaF7Oq8dtvjnjcLK4WUgpL4bRxcnZ2rXgaJH27d+EtoNubY uV4a0koc+k3D63AA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 34/36] migration: Move CPR HUP watch to cpr-transfer.c Date: Fri, 23 Jan 2026 16:53:49 -0300 Message-ID: <20260123195352.12850-35-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198190480158500 Content-Type: text/plain; charset="utf-8" Move this CPR-specific code into a cpr file. While here, give the functions more significant names. This makes the new idea (after cpr-transfer) of having two parts to qmp_migrate slightly more obvious: either wait for the hangup or continue directly. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-24-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- include/migration/cpr.h | 5 +++++ migration/cpr-transfer.c | 23 +++++++++++++++++++++++ migration/migration.c | 27 +++------------------------ 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/include/migration/cpr.h b/include/migration/cpr.h index 027cb98073..5850fd1788 100644 --- a/include/migration/cpr.h +++ b/include/migration/cpr.h @@ -9,6 +9,7 @@ #define MIGRATION_CPR_H =20 #include "qapi/qapi-types-migration.h" +#include "io/channel.h" #include "qemu/queue.h" =20 #define MIG_MODE_NONE -1 @@ -53,6 +54,10 @@ int cpr_get_fd_param(const char *name, const char *fdnam= e, int index, QEMUFile *cpr_transfer_output(MigrationChannel *channel, Error **errp); QEMUFile *cpr_transfer_input(MigrationChannel *channel, Error **errp); =20 +void cpr_transfer_add_hup_watch(MigrationState *s, QIOChannelFunc func, + void *opaque); +void cpr_transfer_source_destroy(MigrationState *s); + void cpr_exec_init(void); QEMUFile *cpr_exec_output(Error **errp); QEMUFile *cpr_exec_input(Error **errp); diff --git a/migration/cpr-transfer.c b/migration/cpr-transfer.c index 00371d17c3..61d5c9dce2 100644 --- a/migration/cpr-transfer.c +++ b/migration/cpr-transfer.c @@ -6,7 +6,10 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/clone-visitor.h" #include "qapi/error.h" +#include "qapi/qapi-visit-migration.h" +#include "io/channel.h" #include "io/channel-file.h" #include "io/channel-socket.h" #include "io/net-listener.h" @@ -72,3 +75,23 @@ QEMUFile *cpr_transfer_input(MigrationChannel *channel, = Error **errp) return NULL; } } + +void cpr_transfer_add_hup_watch(MigrationState *s, QIOChannelFunc func, + void *opaque) +{ + s->hup_source =3D qio_channel_create_watch(cpr_state_ioc(), G_IO_HUP); + g_source_set_callback(s->hup_source, + (GSourceFunc)func, + QAPI_CLONE(MigrationAddress, opaque), + (GDestroyNotify)qapi_free_MigrationAddress); + g_source_attach(s->hup_source, NULL); +} + +void cpr_transfer_source_destroy(MigrationState *s) +{ + if (s->hup_source) { + g_source_destroy(s->hup_source); + g_source_unref(s->hup_source); + s->hup_source =3D NULL; + } +} diff --git a/migration/migration.c b/migration/migration.c index 785e01c0f3..5d64068389 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -99,7 +99,6 @@ static bool migration_object_check(MigrationState *ms, Er= ror **errp); static bool migration_switchover_start(MigrationState *s, Error **errp); static bool close_return_path_on_source(MigrationState *s); static void migration_completion_end(MigrationState *s); -static void migrate_hup_delete(MigrationState *s); =20 static void migration_downtime_start(MigrationState *s) { @@ -1296,7 +1295,7 @@ static void migration_cleanup(MigrationState *s) =20 qemu_savevm_state_cleanup(); cpr_state_close(); - migrate_hup_delete(s); + cpr_transfer_source_destroy(s); =20 close_return_path_on_source(s); =20 @@ -1477,7 +1476,7 @@ void migration_cancel(void) migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED); cpr_state_close(); - migrate_hup_delete(s); + cpr_transfer_source_destroy(s); } } =20 @@ -2001,25 +2000,6 @@ static bool migrate_prepare(MigrationState *s, bool = resume, Error **errp) =20 static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); =20 -static void migrate_hup_add(MigrationState *s, QIOChannel *ioc, GSourceFun= c cb, - void *opaque) -{ - s->hup_source =3D qio_channel_create_watch(ioc, G_IO_HUP); - g_source_set_callback(s->hup_source, cb, - QAPI_CLONE(MigrationAddress, opaque), - (GDestroyNotify)qapi_free_MigrationAddress); - g_source_attach(s->hup_source, NULL); -} - -static void migrate_hup_delete(MigrationState *s) -{ - if (s->hup_source) { - g_source_destroy(s->hup_source); - g_source_unref(s->hup_source); - s->hup_source =3D NULL; - } -} - static gboolean qmp_migrate_finish_cb(QIOChannel *channel, GIOCondition cond, void *opaque) @@ -2075,8 +2055,7 @@ void qmp_migrate(const char *uri, bool has_channels, * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { - migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, - main_ch->addr); + cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, main_ch->addr= ); =20 } else { qmp_migrate_finish(main_ch->addr, errp); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198322; cv=none; d=zohomail.com; s=zohoarc; b=gJTOubLVs77wPG24bEup392D7gskdbiJhtqlfZKSc4SwtnLHLeRWqJ5LbTSne78I8P8RddgOaJLobg/aqw7QTLTsxGo1qvyNXbC08hkenzy+KeOQBWyewBbpTnTNEsBRMecnT+nLJLHtowqp4Ey+YfichstD576Lt7A2p9YRrLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198322; h=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=zpGo0nMwG8A/Z2gfh4vpP4cU7uBRdhejmM493QQcTCw=; b=K1qLNcKVbxYSWML+bBu6iSvpINnQYpd9hwYGNJDrmNsKd7KdoV99Sh9QAiHNbMS1ldAIq3Rjz79gx4sx7VaDhSzRLOy+Wb3+9ttZ8SNSgjRZmqpJMtorRpXw2PXhXDEwYNVQLtmOMPjGMdymHBuLWn+k5TA9EzRL49wwdZcoB2Q= 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 1769198322509463.2743718600477; Fri, 23 Jan 2026 11:58:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNG7-0007xX-N4; Fri, 23 Jan 2026 14:55:55 -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 1vjNG5-0007jP-Rv for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:53 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNG4-0003sN-4Z for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:55:53 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 8825433863; Fri, 23 Jan 2026 19:54:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 347981395E; Fri, 23 Jan 2026 19:54:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0O45ORHSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zpGo0nMwG8A/Z2gfh4vpP4cU7uBRdhejmM493QQcTCw=; b=ILwr2KEo81KO7rskGZ/164VUKiIUtQWljTkFa4uNTtc+cCpQFWHz3LBemwKaqFAOZYBAzS fC7Bks4OyYdNZTWT+GHGm7bdeYC/XAIJLn0F83kJeYwduWqnZIAU9MnhBUiiw/NKY9gkng Te/RotojIA/cBdLvq94ojWku8wQkPUY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zpGo0nMwG8A/Z2gfh4vpP4cU7uBRdhejmM493QQcTCw=; b=UUq9+K6pGW7aTmsY/eF23a3LL39bC0BWr5OQd2F0qvKDrEvGbUjHI49az/Hi2C8Zoh02ks sOqddhoP9+479yBA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ILwr2KEo; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UUq9+K6p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zpGo0nMwG8A/Z2gfh4vpP4cU7uBRdhejmM493QQcTCw=; b=ILwr2KEo81KO7rskGZ/164VUKiIUtQWljTkFa4uNTtc+cCpQFWHz3LBemwKaqFAOZYBAzS fC7Bks4OyYdNZTWT+GHGm7bdeYC/XAIJLn0F83kJeYwduWqnZIAU9MnhBUiiw/NKY9gkng Te/RotojIA/cBdLvq94ojWku8wQkPUY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zpGo0nMwG8A/Z2gfh4vpP4cU7uBRdhejmM493QQcTCw=; b=UUq9+K6pGW7aTmsY/eF23a3LL39bC0BWr5OQd2F0qvKDrEvGbUjHI49az/Hi2C8Zoh02ks sOqddhoP9+479yBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 35/36] migration: Remove qmp_migrate_finish Date: Fri, 23 Jan 2026 16:53:50 -0300 Message-ID: <20260123195352.12850-36-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 8825433863 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198323037158500 Content-Type: text/plain; charset="utf-8" After cleanups, the qmp_migrate_finish function is now just a call to migration_connect_outgoing(). Remove qmp_migrate_finish() and rename the qmp_migrate_finish_cb callback. This also allows the function's error handling to be removed as it now receives &local_err like the rest of the callees of qmp_migrate(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-25-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/migration.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5d64068389..b103a82fc0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1998,15 +1998,18 @@ static bool migrate_prepare(MigrationState *s, bool= resume, Error **errp) return true; } =20 -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); - -static gboolean qmp_migrate_finish_cb(QIOChannel *channel, - GIOCondition cond, - void *opaque) +static gboolean migration_connect_outgoing_cb(QIOChannel *channel, + GIOCondition cond, void *opa= que) { - MigrationAddress *addr =3D opaque; + MigrationState *s =3D migrate_get_current(); + Error *local_err =3D NULL; + + migration_connect_outgoing(s, opaque, &local_err); + + if (local_err) { + migration_connect_error_propagate(s, local_err); + } =20 - qmp_migrate_finish(addr, NULL); return G_SOURCE_REMOVE; } =20 @@ -2055,10 +2058,11 @@ void qmp_migrate(const char *uri, bool has_channels, * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { - cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, main_ch->addr= ); + cpr_transfer_add_hup_watch(s, migration_connect_outgoing_cb, + main_ch->addr); =20 } else { - qmp_migrate_finish(main_ch->addr, errp); + migration_connect_outgoing(s, main_ch->addr, &local_err); } =20 out: @@ -2068,19 +2072,6 @@ out: } } =20 -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - Error *local_err =3D NULL; - - migration_connect_outgoing(s, addr, &local_err); - - if (local_err) { - migration_connect_error_propagate(s, error_copy(local_err)); - error_propagate(errp, local_err); - } -} - void qmp_migrate_cancel(Error **errp) { /* --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769198288; cv=none; d=zohomail.com; s=zohoarc; b=cbCH8SsmKOoBz0XVgjVOlClocu1toDFUrDDl+Yp2byheY3QVI3LU4O419nk0E7JT4mZuTliRaN8qyitoFnPHCTFTL5oEZcZTeGRstzA6iiZMrhe17d9nPNWpLUpLBlVtGCWSSrzUDD5GPJ2e4xztJikf/FEipEtDGkvp2cmj2ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769198288; h=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=Jr6hs6i6OgI8FCXr5v3qTDaF1tk1ruthkOmQk2z2uAo=; b=E6tRFKgSCZIdiJxabm+3CxB4MyqququZfgy+J7/7ME6nHzKOzEnbV0koKzUdUROxGjw3bHsZD428OHYde+UyVdBcLGV0uPjYOv9lGdOIIdIkjuBe7dJ0vEJlCJTmpvAEkeDpi1fzZem7obw5s3IZst9g50dZ+WssMs9zt1Abxsw= 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 1769198288103936.2961521339694; Fri, 23 Jan 2026 11:58:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjNGE-0000Df-R1; Fri, 23 Jan 2026 14:56:02 -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 1vjNGC-0008T1-Ga for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:56:00 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjNGA-0003t0-1L for qemu-devel@nongnu.org; Fri, 23 Jan 2026 14:56:00 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 565F233870; Fri, 23 Jan 2026 19:55:01 +0000 (UTC) Received: from imap1.dmz-prg2.suse.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0246E1395E; Fri, 23 Jan 2026 19:54:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iITuLBPSc2lFZQAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 19:54:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198101; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jr6hs6i6OgI8FCXr5v3qTDaF1tk1ruthkOmQk2z2uAo=; b=RGQd3fDgSuY/HQKPy7tqLsARTw1+HQQtTSesqz2wZG+cG0Nf+FUS8NiMz8ulXFfgH6c8ds tmlZDmNuSJX9yPAE+eSHg0Y1UX386ViNu4nrnub5/KL1UYaAdk3rN1OqIahBIaY5B1cdK/ O28PlJS0l20N9Gg5MV/XIfOMifLAvss= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198101; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jr6hs6i6OgI8FCXr5v3qTDaF1tk1ruthkOmQk2z2uAo=; b=DjMEyVPdnxmgEhH0J0pB1eM4UiDO2kQ1PzgCEyqBkamXxg7OJxfpAcfTCHuvIPXLtSaIuF rZU90/sinIoXhhBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769198101; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jr6hs6i6OgI8FCXr5v3qTDaF1tk1ruthkOmQk2z2uAo=; b=RGQd3fDgSuY/HQKPy7tqLsARTw1+HQQtTSesqz2wZG+cG0Nf+FUS8NiMz8ulXFfgH6c8ds tmlZDmNuSJX9yPAE+eSHg0Y1UX386ViNu4nrnub5/KL1UYaAdk3rN1OqIahBIaY5B1cdK/ O28PlJS0l20N9Gg5MV/XIfOMifLAvss= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769198101; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jr6hs6i6OgI8FCXr5v3qTDaF1tk1ruthkOmQk2z2uAo=; b=DjMEyVPdnxmgEhH0J0pB1eM4UiDO2kQ1PzgCEyqBkamXxg7OJxfpAcfTCHuvIPXLtSaIuF rZU90/sinIoXhhBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 36/36] migration/channel: Centralize calling migration_channel_connect_outgoing Date: Fri, 23 Jan 2026 16:53:51 -0300 Message-ID: <20260123195352.12850-37-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123195352.12850-1-farosas@suse.de> References: <20260123195352.12850-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: qemu development 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 @suse.de) X-ZM-MESSAGEID: 1769198288971158500 Content-Type: text/plain; charset="utf-8" Make the synchronous calls evident by not hiding the call to migration_channel_connect_outgoing() in the transport code. Have those functions return and call the function at the upper level. This helps with navigation: the transport code returns the ioc, there's no need to look into them when browsing the code. It also allows RDMA in the source side to use the same path as the rest of the transports. While here, document the async calls which are the exception. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-26-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/channel.c | 28 ++++++++++++++++++++++++---- migration/exec.c | 8 ++++---- migration/exec.h | 5 ++++- migration/fd.c | 15 ++++++++------- migration/fd.h | 7 +++++-- migration/file.c | 18 ++++++++++-------- migration/file.h | 5 +++-- migration/rdma.c | 11 +++++------ migration/rdma.h | 4 ++-- 9 files changed, 65 insertions(+), 36 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 1e4778455d..1e2935f926 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -37,26 +37,40 @@ void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, Error **errp) { + g_autoptr(QIOChannel) ioc =3D NULL; + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { SocketAddress *saddr =3D &addr->u.socket; if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { socket_connect_outgoing(s, saddr, errp); + /* + * async: after the socket is connected, calls + * migration_channel_connect_outgoing() directly. + */ + return; + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_connect_outgoing(s, saddr->u.fd.str, errp); + ioc =3D fd_connect_outgoing(s, saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_connect_outgoing(s, &addr->u.rdma, errp); + ioc =3D rdma_connect_outgoing(s, &addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_connect_outgoing(s, addr->u.exec.args, errp); + ioc =3D exec_connect_outgoing(s, addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_connect_outgoing(s, &addr->u.file, errp); + ioc =3D file_connect_outgoing(s, &addr->u.file, errp); } else { error_setg(errp, "uri is not a valid migration protocol"); } + + if (ioc) { + migration_channel_connect_outgoing(s, ioc); + } + + return; } =20 void migration_connect_incoming(MigrationAddress *addr, Error **errp) @@ -81,6 +95,12 @@ void migration_connect_incoming(MigrationAddress *addr, = Error **errp) } else { error_setg(errp, "unknown migration protocol"); } + + /* + * async: the above routines all wait for the incoming connection + * and call back to migration_channel_process_incoming() to start + * the migration. + */ } =20 bool migration_has_main_and_multifd_channels(void) diff --git a/migration/exec.c b/migration/exec.c index c3085e803e..a1a7ede3b4 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -40,7 +40,8 @@ const char *exec_get_cmd_path(void) } #endif =20 -void exec_connect_outgoing(MigrationState *s, strList *command, Error **er= rp) +QIOChannel *exec_connect_outgoing(MigrationState *s, strList *command, + Error **errp) { QIOChannel *ioc =3D NULL; g_auto(GStrv) argv =3D strv_from_str_list(command); @@ -50,12 +51,11 @@ void exec_connect_outgoing(MigrationState *s, strList *= command, Error **errp) trace_migration_exec_outgoing(new_command); ioc =3D QIO_CHANNEL(qio_channel_command_new_spawn(args, O_RDWR, errp)); if (!ioc) { - return; + return NULL; } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect_outgoing(s, ioc); - object_unref(OBJECT(ioc)); + return ioc; } =20 static gboolean exec_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/exec.h b/migration/exec.h index e7e8e475ac..3e39270dce 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -20,10 +20,13 @@ #ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H =20 +#include "io/channel.h" + #ifdef WIN32 const char *exec_get_cmd_path(void); #endif void exec_connect_incoming(strList *host_port, Error **errp); =20 -void exec_connect_outgoing(MigrationState *s, strList *host_port, Error **= errp); +QIOChannel *exec_connect_outgoing(MigrationState *s, strList *host_port, + Error **errp); #endif diff --git a/migration/fd.c b/migration/fd.c index 530aac1a5b..f05f95992f 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -50,30 +50,31 @@ static bool migration_fd_valid(int fd) return false; } =20 -void fd_connect_outgoing(MigrationState *s, const char *fdname, Error **er= rp) +QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname, + Error **errp) { - QIOChannel *ioc; + QIOChannel *ioc =3D NULL; int fd =3D monitor_get_fd(monitor_cur(), fdname, errp); if (fd =3D=3D -1) { - return; + goto out; } =20 if (!migration_fd_valid(fd)) { error_setg(errp, "fd: migration to a file is not supported." " Use file: instead."); - return; + goto out; } =20 trace_migration_fd_outgoing(fd); ioc =3D qio_channel_new_fd(fd, errp); if (!ioc) { close(fd); - return; + goto out; } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect_outgoing(s, ioc); - object_unref(OBJECT(ioc)); +out: + return ioc; } =20 static gboolean fd_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/fd.h b/migration/fd.h index 7211629270..ce0b751273 100644 --- a/migration/fd.h +++ b/migration/fd.h @@ -16,8 +16,11 @@ =20 #ifndef QEMU_MIGRATION_FD_H #define QEMU_MIGRATION_FD_H + +#include "io/channel.h" + void fd_connect_incoming(const char *fdname, Error **errp); =20 -void fd_connect_outgoing(MigrationState *s, const char *fdname, - Error **errp); +QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname, + Error **errp); #endif diff --git a/migration/file.c b/migration/file.c index b7b0fb5194..5618aced49 100644 --- a/migration/file.c +++ b/migration/file.c @@ -93,36 +93,38 @@ out: return ret; } =20 -void file_connect_outgoing(MigrationState *s, - FileMigrationArgs *file_args, Error **errp) +QIOChannel *file_connect_outgoing(MigrationState *s, + FileMigrationArgs *file_args, Error **er= rp) { - g_autoptr(QIOChannelFile) fioc =3D NULL; + QIOChannelFile *fioc =3D NULL; g_autofree char *filename =3D g_strdup(file_args->filename); uint64_t offset =3D file_args->offset; - QIOChannel *ioc; + QIOChannel *ioc =3D NULL; =20 trace_migration_file_outgoing(filename); =20 fioc =3D qio_channel_file_new_path(filename, O_CREAT | O_WRONLY, 0600,= errp); if (!fioc) { - return; + goto out; } =20 if (ftruncate(fioc->fd, offset)) { error_setg_errno(errp, errno, "failed to truncate migration file to offset %" P= RIx64, offset); - return; + goto out; } =20 outgoing_args.fname =3D g_strdup(filename); =20 ioc =3D QIO_CHANNEL(fioc); if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) { - return; + ioc =3D NULL; + goto out; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect_outgoing(s, ioc); +out: + return ioc; } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/file.h b/migration/file.h index 9b1e874bb7..5936c64fea 100644 --- a/migration/file.h +++ b/migration/file.h @@ -9,14 +9,15 @@ #define QEMU_MIGRATION_FILE_H =20 #include "qapi/qapi-types-migration.h" +#include "io/channel.h" #include "io/task.h" #include "channel.h" #include "multifd.h" =20 void file_connect_incoming(FileMigrationArgs *file_args, Error **errp); =20 -void file_connect_outgoing(MigrationState *s, - FileMigrationArgs *file_args, Error **errp); +QIOChannel *file_connect_outgoing(MigrationState *s, + FileMigrationArgs *file_args, Error **er= rp); int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp); void file_cleanup_outgoing_migration(void); bool file_send_channel_create(gpointer opaque, Error **errp); diff --git a/migration/rdma.c b/migration/rdma.c index e628a20aec..55ab85650a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3933,8 +3933,8 @@ err: g_free(rdma); } =20 -void rdma_connect_outgoing(void *opaque, - InetSocketAddress *host_port, Error **errp) +QIOChannel *rdma_connect_outgoing(void *opaque, + InetSocketAddress *host_port, Error **er= rp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; @@ -3944,7 +3944,7 @@ void rdma_connect_outgoing(void *opaque, /* Avoid ram_block_discard_disable(), cannot change during migration. = */ if (ram_block_discard_is_required()) { error_setg(errp, "RDMA: cannot disable RAM discard"); - return; + return NULL; } =20 rdma =3D qemu_rdma_data_init(host_port, errp); @@ -3994,12 +3994,11 @@ void rdma_connect_outgoing(void *opaque, trace_rdma_connect_outgoing_after_rdma_connect(); =20 s->rdma_migration =3D true; - migration_outgoing_setup(rdma_new_output(rdma)); - migration_start_outgoing(s); - return; + return rdma_new_output(rdma); return_path_err: qemu_rdma_cleanup(rdma); err: g_free(rdma); g_free(rdma_return_path); + return NULL; } diff --git a/migration/rdma.h b/migration/rdma.h index 170c25cf44..8a6515f130 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,8 +21,8 @@ =20 #include "system/memory.h" =20 -void rdma_connect_outgoing(void *opaque, InetSocketAddress *host_port, - Error **errp); +QIOChannel *rdma_connect_outgoing(void *opaque, InetSocketAddress *host_po= rt, + Error **errp); =20 void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 --=20 2.51.0