From nobody Fri Jan 9 09:53:04 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=1767640099; cv=none; d=zohomail.com; s=zohoarc; b=SrjVFSfCHwrL3QCa+VaUu6JrfYwGOCPfXi94Ok+UaanXnfjRnoWIGxcO/F+zzuXo36vGKbN57xx6TmnQjZZMB88S4/zBTIkL1m2GqDF+kqxuUK4KQwUESNUvXTdt/C1xnqOvg45NANu5w8xhSPrdd9PpK4i3H/gYh5WE7+r4Oow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640099; 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=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=LFx7NhBRGKBp1c4q6xR+M4FjTcm6tHHAQjcjGuQEpqu5GOmNdxxtKHbVq6vTnwGjkAP4cDMQzatJu0QtNcJ+eqM3SPoFsUc3krtxyN87n4mc2l1qTIopHcURXmPR4deVbEXaw0hRy75Q4NTSLRv5o4m2iYCi+IwhWMIfIss4zM8= 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 1767640099357429.11060348933404; Mon, 5 Jan 2026 11:08:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvd-0007qo-Rj; Mon, 05 Jan 2026 14:07:46 -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 1vcpuw-0007ba-NT for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:06 -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 1vcpuv-000578-7X for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:02 -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 253FE33764; Mon, 5 Jan 2026 19:06: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 D19D113964; Mon, 5 Jan 2026 19:06:49 +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 sMseJMkLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:06:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640011; 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=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=15aHQUVVqs0pFb3MOWZy7sjJkdTFX3sOr+LsM7wrb5Dw8QVqgkUOcR5vp/qrkfZoy5BE/K ZsAdzuE6z0jH0F4ropw3DQsGN+3cPsfI9YmWwEdG01DsAVsp27cGlvxO0qlQfcqVLt0O8T ea2AOOkE/Gm+2Rd0FUoePpsWaxzZgyY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640011; 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=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=YG4xTN1MiVZhFbODdSHg9i8sv2PYhCBj7N9ZUCOk28dxvtBXUElKvMCZ5gTbT7TNJ/8iwx /QRt7O5b5+raPsAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640011; 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=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=15aHQUVVqs0pFb3MOWZy7sjJkdTFX3sOr+LsM7wrb5Dw8QVqgkUOcR5vp/qrkfZoy5BE/K ZsAdzuE6z0jH0F4ropw3DQsGN+3cPsfI9YmWwEdG01DsAVsp27cGlvxO0qlQfcqVLt0O8T ea2AOOkE/Gm+2Rd0FUoePpsWaxzZgyY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640011; 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=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=YG4xTN1MiVZhFbODdSHg9i8sv2PYhCBj7N9ZUCOk28dxvtBXUElKvMCZ5gTbT7TNJ/8iwx /QRt7O5b5+raPsAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 01/25] migration: Remove redundant state change Date: Mon, 5 Jan 2026 16:06:18 -0300 Message-ID: <20260105190644.14072-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.983]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640101113158500 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 transtion from SETUP to FAILED. Reviewed-by: Peter Xu 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 9d1bf5d276..c45393f40e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2326,8 +2326,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 Fri Jan 9 09:53:04 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=1767640313; cv=none; d=zohomail.com; s=zohoarc; b=iq2wL0bV2MEZ8/EGMT35JuqR4bVy1j1nzAzEKqELI73hVznBAgqSs3DuN8jWCaZ8iUrYBpLewN9R9ZhrHf0GNKpqbtjSaRltyKDjr4iry5Ci53avsrClXwvpuw9qHp2PmZ1gzmXP8UkMqOQUzb/gZyUKZTUrWAGFHUrqMGGBEAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640313; 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=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=UZEqYoj7rdRtOnkW0MqEk/9p/HAi80wKc4eJ2wfDS7DANpcdTHZCpORJZ4eIUME8/7PL6qqPcSJLif5MglKmgJkIcxQsQm1fWwst/sRBguEplc6kpp7+1gSUjoa60qI14bgd36xnNRUS777Z/zy12n02EDyEE/i3FJdXZrnap3Q= 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 1767640313760844.5188202419281; Mon, 5 Jan 2026 11:11:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvj-0007tN-3u; Mon, 05 Jan 2026 14:07: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 1vcpv5-0007g5-Ra for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:18 -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 1vcpv1-000581-Sy for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:09 -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 F2E2C33767; Mon, 5 Jan 2026 19:06:52 +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 A9AA513964; Mon, 5 Jan 2026 19:06:51 +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 sENHGssLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:06:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640013; 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=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=C3IyIDNKTw4B5BiKKWu58nbQ8Fnir5lJ186lj14Makwkt09VjmEDRCMPs9GZIozlxPtGp2 7q0M9yEfMGekgbJXuxwQ0XK8cSkFB88bNLp/zU/qf6ixOlawDkBOvMCbNnPQcFIljPsrRF 5kgRyfHcRA0QesIZ/nwERm1qEkRGwx8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640013; 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=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=DW4RkojKvO3i+MMcWVWsQ1wxhvVnq7mI6TqLVKcMLOyNcQCxYAwahhg0KJEMA3tket3NLi ZZ8+fmZ1qmpcPxBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640012; 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=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=k2HHRkPZE+2DSd4zmEim+F+yzI3HBsjDGDz2khNl5eDWip0RONaEAn3tqj8blMSf5zq9VS uvlVoKxtXdxSmxY2smR6nagvcz+KxhSq533pRSeVW4wZLegcpIFlua7rqfvj1lcSdOf4Hb //HD0/3MKkmn+gjEdm74t1XzDMaKxrQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640013; 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=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=DW4RkojKvO3i+MMcWVWsQ1wxhvVnq7mI6TqLVKcMLOyNcQCxYAwahhg0KJEMA3tket3NLi ZZ8+fmZ1qmpcPxBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 02/25] migration: Fix state change at migration_channel_process_incoming Date: Mon, 5 Jan 2026 16:06:19 -0300 Message-ID: <20260105190644.14072-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.982]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640315806158500 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 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 Fri Jan 9 09:53:04 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=1767640084; cv=none; d=zohomail.com; s=zohoarc; b=FpS1a4cNgd1w6MsnQcW9JiDwMZPcL7xmdPb/QGFUd6hJiwbdZXe1U1JZlLQ2cqslHL6Ez1Xn/fvMvJKEViyNQY7M52M1R/ztsY/l3Ug5Oet4LG22HBZQZNwe4yg5IK2Vur1yADQVHe6O1HKHw4rHFj3rMMJ3DFIcW/Ci/tvsRFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640084; 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=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=gpvs/pdqLxFfaSdGU5tiSy7uGIknP08MxSXc1yilLz//1oZ1JsgSNxWSy0Q2V+P9FVf5oDRFTuHf3e63HjP0mOgRjrP1wjn7XsuM8l/RUkbhbbyUFWAaN9RPf9Qe2/qOtlomKMX+AxZhDmGVEljEUPY5AR7xX8RTzcJShfkyLrg= 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 1767640084748938.515486684955; Mon, 5 Jan 2026 11:08:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvW-0007mZ-NE; Mon, 05 Jan 2026 14:07: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 1vcpus-0007aC-C5 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:00 -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 1vcpuq-00056C-Js for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:06:57 -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 D00DA5BCC1; Mon, 5 Jan 2026 19:06:54 +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 89EB013964; Mon, 5 Jan 2026 19:06: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 0EpuEs0LXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:06:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640014; 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=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=oKe2GIRo8pu8Uhk011I1vu9Igi/0+yZKgY16RJ/3SSAthYWzsdPT3mcGYftPC+X+vxvyZd +6JLOpXw8LEP0YU+Ifw9cQnWitO0RNKm47lK/qTYrkRlNbUMOmkqAAikMG0NzlB6galLiJ 0ekBQLevKJ9i2S7jDkJOH/kKBvE5c8g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640014; 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=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=t4xapUWK2vkVfh+9od2WSYTstR+OQd1vhpuuDvkKOR52Qq/sitG00KJ2DM8DsdLhUBgkuI 3bnmEhzru6cQq0CQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=oKe2GIRo; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=t4xapUWK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640014; 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=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=oKe2GIRo8pu8Uhk011I1vu9Igi/0+yZKgY16RJ/3SSAthYWzsdPT3mcGYftPC+X+vxvyZd +6JLOpXw8LEP0YU+Ifw9cQnWitO0RNKm47lK/qTYrkRlNbUMOmkqAAikMG0NzlB6galLiJ 0ekBQLevKJ9i2S7jDkJOH/kKBvE5c8g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640014; 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=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=t4xapUWK2vkVfh+9od2WSYTstR+OQd1vhpuuDvkKOR52Qq/sitG00KJ2DM8DsdLhUBgkuI 3bnmEhzru6cQq0CQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 03/25] migration/tls: Remove unused parameter Date: Mon, 5 Jan 2026 16:06:20 -0300 Message-ID: <20260105190644.14072-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[]; TO_DN_NONE(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: D00DA5BCC1 X-Spam-Score: -3.01 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 (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: 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: 1767640087082158500 Content-Type: text/plain; charset="utf-8" MigrationState 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 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 Fri Jan 9 09:53:04 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=1767640309; cv=none; d=zohomail.com; s=zohoarc; b=UCEx85f4yq3/qmK2IO7S1bgF0sLs2J3Ru+ppbMQh4lj6rGoUlcxGo1ytfmh0nZLBczuSfSW+rQqx5vHgQSE//cbXPIuF2VKYMLafzs5tYil3w9XvK88Qj8nwGsy26O1yS4dhGd6q94WRnVY9zHO/4adXle2SokGIyEB84R7122s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640309; 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=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=bwn3N2FM1ebf0Rh7kEL1B0Xdipk86NqNALgm3gwOlOjnKGxa5y104hAVqqx0sBCwffmTbSYQFe+0VxVndh9ljEfXykYkzefHY6mtxj1L5Ha8Z+D+AVj81PLNsBk7varL9K9TygT5xN260FVxeS+lpz5XOT7MIXvVYytnNgwQEoA= 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 17676403094491013.884653826133; Mon, 5 Jan 2026 11:11:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvp-0007vV-Tf; Mon, 05 Jan 2026 14:07: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 1vcpuy-0007dl-M6 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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 1vcpuw-00057O-CS for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:04 -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 CDFA25BCC8; Mon, 5 Jan 2026 19:06:56 +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 8530613964; Mon, 5 Jan 2026 19:06:55 +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 uKyOEc8LXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:06:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640016; 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=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=AtpK/MwaZV9M31yFRBETWI6Y5IVk6h+a8cojJlDWd0FHo3MCva6S5Z4FC12pckK/aKY/+V vv47Nnhlh706RNFdO3q1NOM5ygyQX73LlWDwU0GkpYbWyUtbMXclnwFz2AM0PedtK5F98T ixooNTzQlw2BNhkCKaMQFlgB5PMPfIQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640016; 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=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=Tereky3okSbJ9SQbz1F2XzGKYElcGwg0nX1zledGR3Y0b7TBg748w/wAGuvo3+v5vczwph gbPexzc6Gxq8bKDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="AtpK/Mwa"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Tereky3o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640016; 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=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=AtpK/MwaZV9M31yFRBETWI6Y5IVk6h+a8cojJlDWd0FHo3MCva6S5Z4FC12pckK/aKY/+V vv47Nnhlh706RNFdO3q1NOM5ygyQX73LlWDwU0GkpYbWyUtbMXclnwFz2AM0PedtK5F98T ixooNTzQlw2BNhkCKaMQFlgB5PMPfIQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640016; 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=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=Tereky3okSbJ9SQbz1F2XzGKYElcGwg0nX1zledGR3Y0b7TBg748w/wAGuvo3+v5vczwph gbPexzc6Gxq8bKDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 04/25] migration: Cleanup TLS handshake hostname passing Date: Mon, 5 Jan 2026 16:06:21 -0300 Message-ID: <20260105190644.14072-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: CDFA25BCC8 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)[]; TO_DN_NONE(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640309957158500 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 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 9bf9be6acb..c956b260a4 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,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 bf6da85af8..3fb1a07ba9 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -814,12 +814,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; } @@ -829,7 +827,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); @@ -876,8 +874,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 9a5a39c886..881034c289 100644 --- a/migration/options.c +++ b/migration/options.c @@ -956,6 +956,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 98a98138be..7afb42bd27 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 Fri Jan 9 09:53:04 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=1767640326; cv=none; d=zohomail.com; s=zohoarc; b=Zb/IPasBzkb9sxvpHMzSmLtq2UndDDku7WJDBfS2IH33oYRSTjPt+uZEUBCGMAo+USzYFBBt/B24LAeZxHJ2aKlhCnu6RIFBQybxjdNNg9/vBNoER8WLedaWSfiMilPqVwBNo+vY+crM5U/SUisOBNIBjU4RE6jx2vcVd45mTN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640326; 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=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=RvOo7tW/kQp3oktJKQheY1KpBuL1fuGr2IY1+6QyKl2vZF52BVfKklRv8tQT3P9FZIPyWZekM8yX7r54vMInb3zEnGgxG5dh3liJEscJO3AOJerFdG8Cre8Lzhn/0ZdmQZu/kk/nF2JXRS/OhDuhtuaSNHz4z45DzIOy/BmEUQA= 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 1767640326785396.468575680904; Mon, 5 Jan 2026 11:12:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvp-0007vH-NP; Mon, 05 Jan 2026 14:07: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 1vcpvD-0007he-HE for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:22 -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 1vcpvA-00059u-Qp for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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-out1.suse.de (Postfix) with ESMTPS id A291C33750; Mon, 5 Jan 2026 19:06:58 +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 5C19613964; Mon, 5 Jan 2026 19:06: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 qPmNB9ELXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:06:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640018; 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=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=DwEYoFiCGemuRy10jF77UKBvd62hWJMoq6amhNsHGAT8ezL0Z25XDFVjK80dxzRXuNQpCr Z3MTEYfKJ4em0vy2FYO9QAsposp7HPjWlxS8Q/Xmez7J5yEx+88o17ilNmMuAU5PjrNgoS tNAfQko/Z/WIKet4oc9U4yQqAasyp3o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640018; 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=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=5bggc2pMMJkLPrZ4IHl/RAdQ2Z+lBst3rCiOM3LH3olMBuR8ra1CYdgKQ2UjocqgyHYdmx hcYQyVvy2ijl2eCw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=DwEYoFiC; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=5bggc2pM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640018; 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=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=DwEYoFiCGemuRy10jF77UKBvd62hWJMoq6amhNsHGAT8ezL0Z25XDFVjK80dxzRXuNQpCr Z3MTEYfKJ4em0vy2FYO9QAsposp7HPjWlxS8Q/Xmez7J5yEx+88o17ilNmMuAU5PjrNgoS tNAfQko/Z/WIKet4oc9U4yQqAasyp3o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640018; 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=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=5bggc2pMMJkLPrZ4IHl/RAdQ2Z+lBst3rCiOM3LH3olMBuR8ra1CYdgKQ2UjocqgyHYdmx hcYQyVvy2ijl2eCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 05/25] migration: Move postcopy_try_recover into migration_incoming_process Date: Mon, 5 Jan 2026 16:06:22 -0300 Message-ID: <20260105190644.14072-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[]; TO_DN_NONE(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: A291C33750 X-Spam-Score: -3.01 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 (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: 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: 1767640327878158500 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. (the diff is a bit strange because migration_incoming_process() was moved after postcopy_try_recover()) Reviewed-by: Peter Xu 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 c45393f40e..4af5baad59 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -943,12 +943,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) { @@ -982,12 +976,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 @@ -1087,10 +1088,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 Fri Jan 9 09:53:04 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=1767640331; cv=none; d=zohomail.com; s=zohoarc; b=jCwnq9bOloB2oNoUhw7yUcG+4W14YaeAowviTcwrBEGbebdisQqpU8yPDXSekukboSnAowFpgFIU7X486nfqfDvLweUxMoOsLEifG4+u4mWrK27JVI/x+BejJdAFyjKdDtcSZ6qUqoJ5JK6etDKUsydj7VEET6cRGh4uPdyXAuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640331; 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=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=hrQ7xkzkReBJCm1c1rsQbrmKZBOUYESoaa/WIgbP5QNvcMz2lPmS4NA0JBmNTWrzENvwsXTyOhVe7W+bivuaPX/eW3mkHzFERaE+ncbAdkPJBKntPFQJE/498Ln338V6abPJhfcx72hodu0sAo2kvCABf5CAI/XQjsrWBeyjgOE= 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 1767640331781572.3780008630307; Mon, 5 Jan 2026 11:12:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvi-0007sU-Cq; Mon, 05 Jan 2026 14:07: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 1vcpv5-0007g6-S2 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:18 -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 1vcpv2-00058E-NB for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:10 -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 087BD5BCC1; Mon, 5 Jan 2026 19:07: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 399B513964; Mon, 5 Jan 2026 19:06: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 CPOSOtILXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:06:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640021; 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=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=MKIcHpMQGiQu5CJO2mksfXMRZCwwV4vDErY5liflhpMELK/ha3z/iDnZeGoFVOtR/E8ScK awzMM38IO0nZU6cEk25tQ90LX84MhAOpU2nrLkxuOs3d3Cnkfcf4lUzy17xLYEePDU3vUu VXxA+F5/bXYZeMrdMEHX6vohjRsHK7A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640021; 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=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=EIkOn+cSks4fxkt6dOuDVpBiO2ovzsElGrpvaIKyOhyjuXz8R0G9iD2bGZgYC/dnaY5cl+ q3bIF/qwV7rStQCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=MKIcHpMQ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=EIkOn+cS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640021; 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=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=MKIcHpMQGiQu5CJO2mksfXMRZCwwV4vDErY5liflhpMELK/ha3z/iDnZeGoFVOtR/E8ScK awzMM38IO0nZU6cEk25tQ90LX84MhAOpU2nrLkxuOs3d3Cnkfcf4lUzy17xLYEePDU3vUu VXxA+F5/bXYZeMrdMEHX6vohjRsHK7A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640021; 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=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=EIkOn+cSks4fxkt6dOuDVpBiO2ovzsElGrpvaIKyOhyjuXz8R0G9iD2bGZgYC/dnaY5cl+ q3bIF/qwV7rStQCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Mark Kanda , Ben Chaney Subject: [PATCH v2 06/25] migration: Use migrate_mode() to query for cpr-transfer Date: Mon, 5 Jan 2026 16:06:23 -0300 Message-ID: <20260105190644.14072-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 087BD5BCC1 X-Spam-Score: -3.01 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 (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: 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: 1767640334039158500 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 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 4af5baad59..388e0be5a2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1534,7 +1534,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 @@ -1696,10 +1696,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; @@ -1780,9 +1779,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; @@ -2136,7 +2135,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()) { @@ -2252,7 +2251,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; } @@ -2277,7 +2276,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 @@ -2852,7 +2851,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 @@ -2901,7 +2900,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; } @@ -3003,7 +3002,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; @@ -4049,7 +4048,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; } } @@ -4085,7 +4084,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 Fri Jan 9 09:53:04 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=1767640119; cv=none; d=zohomail.com; s=zohoarc; b=PUCckx35MHaf1RbRLHhzkpsVLoXhnHGKcAzqlPD1UODImac3FlK8ifiIfgV/x56HsONcbgdqXnC01YxOsAhE5iA6ns9f7C83OIY7allpSviB9PP/L/x5MNXFJD7RHoIw671bPZCP10fOWf7NZ6w+ND86xQnAOUVyWGIXen+0KuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640119; 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=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=YdPEEty8mLoet6QB9FVG2ftMXUQKQo4SP7Tw2AEDN8fpO2iR1VT1y/2Medg+6n7of6CpqY+n6r8Jdt184Quf5+sygxjqHoR5uHJl15K6UIy/BDDCEUhzUIcKnbm63otcLTw9ENovzzoWSdrNUjJUNjwD/5jpFBQlhfIqRtX2O+M= 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 1767640119866797.2799426849444; Mon, 5 Jan 2026 11:08:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpw4-00080e-BJ; Mon, 05 Jan 2026 14:08:12 -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 1vcpvL-0007je-B1 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:29 -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 1vcpvI-0005C1-83 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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 D523D33754; Mon, 5 Jan 2026 19:07:02 +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 8D04A13964; Mon, 5 Jan 2026 19:07: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 iOxPE9ULXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640022; 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=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=Ei6FvEpGPYC+ph38WjRTfCuw9iwmRqK6q4D1feu9ll6G5yIlo/klix+5gTxTxd7ul2EO// 6OFb+AlwG73BgA4ta3Mq0tNVSDT05qGYQsT7Bvf2w0AuHxziI9DrSojXLBfLBCety1eNQD yruJSZJfITXLqrxW3TLXYlLd+BkcTfQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640022; 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=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=Xhqsl2hJoy1C08Cgr9Jecy5Li4cJ0sJ6OV+LLZBZ4qGrMgBh34wDGL/dC2NSGOZgJgvCOv ZmXAseqtiZREaaBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640022; 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=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=Ei6FvEpGPYC+ph38WjRTfCuw9iwmRqK6q4D1feu9ll6G5yIlo/klix+5gTxTxd7ul2EO// 6OFb+AlwG73BgA4ta3Mq0tNVSDT05qGYQsT7Bvf2w0AuHxziI9DrSojXLBfLBCety1eNQD yruJSZJfITXLqrxW3TLXYlLd+BkcTfQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640022; 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=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=Xhqsl2hJoy1C08Cgr9Jecy5Li4cJ0sJ6OV+LLZBZ4qGrMgBh34wDGL/dC2NSGOZgJgvCOv ZmXAseqtiZREaaBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 07/25] migration: Free the error earlier in the resume case Date: Mon, 5 Jan 2026 16:06:24 -0300 Message-ID: <20260105190644.14072-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.987]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640121030158500 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 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 388e0be5a2..9204029c88 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1811,8 +1811,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); @@ -2087,6 +2087,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; } @@ -4015,13 +4022,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 Fri Jan 9 09:53:04 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=1767640110; cv=none; d=zohomail.com; s=zohoarc; b=ctTAkCq4XeT5oZnBqP3CE+i9R970gOZsJdVwEOhbbipNmtkWI/4yTxnx2bF9+gx79TmPvxxvHfaAHg9Hfs0FmkWjjTBvCbVtdv/6zTWLjA3blT5yiSyV3MPq+HimqcYvTAmEciB/bAP6IcHX+rzhwKiXjzcIzDPC15TP9eWRMJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640110; 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=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=LxayYJDlUckg2zmlT8a//FcFthsPPke4VApRH7LFEHjNsGoxMbgCAmqAyJ0H6iA0sjRPHmTlDD9Pb1p2jhyiN1GPKjZuPe11p3so68g2acLjg1MH4p0kz77nF8U2jghQVvPGh/U+xbweeM7JGB0MMHaMgRtwtlzhp3NunDAQ02k= 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 1767640110115964.9211010594402; Mon, 5 Jan 2026 11:08:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvo-0007u6-OX; Mon, 05 Jan 2026 14:07: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 1vcpvR-0007l0-4d for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:35 -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 1vcpvP-0005Ko-LD for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:32 -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 AD40A33764; Mon, 5 Jan 2026 19:07:04 +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 6564E13964; Mon, 5 Jan 2026 19:07: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 OCe1CdcLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640024; 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=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=jaxRwYNoNjrPUlVAHooCPupvPsmKFk1GEVG9euyBr/KzqbwA6QAUld6e0yJonojB2KsCNA 4/zpFJOPsGnu0vctPEkgYhw2OnQT/1lkyvcgKNU1JhW6PNmcWJoHOPh5KMbk4HHCTRPgLq 0mFwRlNOMttNPduzow1ziL7jkbWQfbQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640024; 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=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=cvRTg2oqcw43Ax6MylFwowX8mfr9w3M1ZeLdWW1xskPArUgNjACcbZU4F0J6MiT+aWkyVp Ttr0+FHKo7WQdvAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640024; 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=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=jaxRwYNoNjrPUlVAHooCPupvPsmKFk1GEVG9euyBr/KzqbwA6QAUld6e0yJonojB2KsCNA 4/zpFJOPsGnu0vctPEkgYhw2OnQT/1lkyvcgKNU1JhW6PNmcWJoHOPh5KMbk4HHCTRPgLq 0mFwRlNOMttNPduzow1ziL7jkbWQfbQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640024; 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=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=cvRTg2oqcw43Ax6MylFwowX8mfr9w3M1ZeLdWW1xskPArUgNjACcbZU4F0J6MiT+aWkyVp Ttr0+FHKo7WQdvAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 08/25] migration: Move error reporting out of migration_cleanup Date: Mon, 5 Jan 2026 16:06:25 -0300 Message-ID: <20260105190644.14072-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.988]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640110922158500 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 duplicated messages. Reviewed-by: Peter Xu 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 9204029c88..7bef787f00 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1528,10 +1528,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); @@ -1540,7 +1536,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 /* @@ -4025,18 +4026,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 @@ -4115,8 +4110,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 Fri Jan 9 09:53:04 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=1767640141; cv=none; d=zohomail.com; s=zohoarc; b=KNE1+eBrPrzO/XGp0cG5gzobx+KFkg+8rSHuzJ14dLMYrcq3J8cnoZRvaaebU5p0uNX59JSNQEkBSikO1hN9AussMx6NoD74MlRu1saO7M5/EgAT7MaiqY2wgtEatGq4FCwsdkPAeCV92O9KDFK99OOIha9vVzZEga+4R1nUeCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640141; 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=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=kWgaOAtETTWjSlE598CmxOFd0WXz095TDelvUzKAwDx+w5h6N8fxeIlGRRkStE+m+GGi7oLDq4Z30PLieZgUMr4fZZEANswBz+u5zgtGr0KydFM2gLWc31a1TjVp7HXpVaXDL7GZ5isXG5YP/PNbs1DjHX1uQz2yHVRzs3MrcRk= 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 1767640141110970.4336656714546; Mon, 5 Jan 2026 11:09:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvz-0007wd-Iz; Mon, 05 Jan 2026 14:08: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 1vcpvY-0007ow-BU for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:41 -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 1vcpvU-0005Nx-UD for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:40 -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 84C6333768; Mon, 5 Jan 2026 19:07: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 3CC4813964; Mon, 5 Jan 2026 19:07:04 +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 ACkjO9gLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640026; 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=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=FK+YvQ2+vPLlm3NcYDl4c3/ZX7MCguxhGfweJPDdqMxUwjr2Hi1c9sZw9Rt93VWTe7G7KM ttdjHTTJNesu6ovmwccu5D7Afu7uoVGNgHC5YTkJWF3+rOH0vDDTHmJgD1i/2K75v++Zjh WmBy2r3eo6Ee482jJBJdnMsuhXC+myk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640026; 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=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=nl5lCJKWWQqMykLCrgxHHZtZ2UVh6+eecPD3zxHnQ00wJDATL6V9fFxpoT0VpQ4LuQ15J9 r2Bqv155XW3FpyDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640026; 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=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=FK+YvQ2+vPLlm3NcYDl4c3/ZX7MCguxhGfweJPDdqMxUwjr2Hi1c9sZw9Rt93VWTe7G7KM ttdjHTTJNesu6ovmwccu5D7Afu7uoVGNgHC5YTkJWF3+rOH0vDDTHmJgD1i/2K75v++Zjh WmBy2r3eo6Ee482jJBJdnMsuhXC+myk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640026; 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=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=nl5lCJKWWQqMykLCrgxHHZtZ2UVh6+eecPD3zxHnQ00wJDATL6V9fFxpoT0VpQ4LuQ15J9 r2Bqv155XW3FpyDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 09/25] migration: Expand migration_connect_error_propagate to cover cancelling Date: Mon, 5 Jan 2026 16:06:26 -0300 Message-ID: <20260105190644.14072-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.986]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640143118158500 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(). (add some line breaks for legibility) Reviewed-by: Peter Xu 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 7bef787f00..259b60af04 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1575,18 +1575,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 @@ -1597,7 +1604,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 @@ -4106,10 +4116,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 Fri Jan 9 09:53:04 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=1767640158; cv=none; d=zohomail.com; s=zohoarc; b=U5dlvEX66ZMwgCCRP0N77GRUmGY1tM+qgUoBi6AQwwWaXTlZj8I21uqWGiMCpNUx3N8CzNvzfG7p5yDwdnewF44Jws8/Ckw6lsGFmiWalQcqXcg8wbbIYeCznf0+SgDSI8nTOjB/O4G+92z6tEPfvwqnyxtyGgDprzF9n6xSf8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640158; 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=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=MA3i4EXvGicPL4NtmFD/onoXS4VbB5EERhLVvATmaf5ZHsXqiFe/E4wNUgi3Cn9lwEkJWU+Akv7ZKA+0BIemPi3VVpZN5QbGtsL1uDSpsoxJW3RBFtIbOdMztwkn1t3qEGOK1VoxwvorA4K4li9gG8qHIXF4L4fHI+s3P54oiY0= 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 1767640158071713.7875201317116; Mon, 5 Jan 2026 11:09:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpvm-0007u0-Ui; Mon, 05 Jan 2026 14:07:54 -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 1vcpvC-0007gy-EY for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:22 -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 1vcpvA-00059m-QN for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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 5EF7D5BCC8; Mon, 5 Jan 2026 19:07: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 153F713964; Mon, 5 Jan 2026 19:07:06 +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 gEajMdoLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640028; 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=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=XtRkZRPkqPoA0kGIxknZVSSyo24q2Em+ibWndn/XJnj4LlQJhzGuv6BUoeHlVU62SUcpdI q+MwTZNguvbuJF01w6StrMpkAOzxEy6dtxeuQZE/jQiHWVdxebewUI5dtZMoVCJMbxurn0 bttEFiqEmnfktfY1KuzNOUVLQjva0zw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640028; 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=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=DmbOvi5LmZWMLTh9uXs3nVYaDS6Z7zGDOys4yzZE7kWWfu422DvxS7zwb+rhDaYXVp8/cS 94WUnOzmRiWFV1Ag== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=XtRkZRPk; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=DmbOvi5L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640028; 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=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=XtRkZRPkqPoA0kGIxknZVSSyo24q2Em+ibWndn/XJnj4LlQJhzGuv6BUoeHlVU62SUcpdI q+MwTZNguvbuJF01w6StrMpkAOzxEy6dtxeuQZE/jQiHWVdxebewUI5dtZMoVCJMbxurn0 bttEFiqEmnfktfY1KuzNOUVLQjva0zw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640028; 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=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=DmbOvi5LmZWMLTh9uXs3nVYaDS6Z7zGDOys4yzZE7kWWfu422DvxS7zwb+rhDaYXVp8/cS 94WUnOzmRiWFV1Ag== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 10/25] migration: yank: Move register instance earlier Date: Mon, 5 Jan 2026 16:06:27 -0300 Message-ID: <20260105190644.14072-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 5EF7D5BCC8 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)[]; TO_DN_NONE(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640159309158500 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 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 259b60af04..164cb26c48 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2180,11 +2180,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) @@ -2209,7 +2210,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()); @@ -2221,7 +2222,6 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_detach, bool det= ach, 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; @@ -2274,8 +2274,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; } @@ -2299,28 +2298,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 || @@ -2343,9 +2336,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 Fri Jan 9 09:53:04 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=1767640140; cv=none; d=zohomail.com; s=zohoarc; b=iHWevS2r1uaq9OY/oXRxyTo/wTJ7jYI5G77+lknt2+1e4cg2gzexYpWE7pBtNVYOIbFTrhYr7vbDwBtHq8iy+0ZkAEhF4/AUm3gjOwv7VCnvYwzLgxfuzxMgwN9/SMlgJN2nif5A8vosWFRs48UwvTz5y5mJ/k7jWBmy6yeJTmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640140; 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=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=jKFqsfgeew38NmcrNxupiA5VrKrNQBw6xXcl+0veLHxBsjd8ngzqktyFnjU4Rm/FkwHxvy7qEiizK3n55lE7Uf9cMdRWguF1ghS8F/6VMB7Ug+obEl5JwFBRSLv3Z/Kha4wbzZ7AFWfh7hJQZ6wDuJuB/AXT5dJPxXPycZnhH3I= 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 1767640140839695.7012773613669; Mon, 5 Jan 2026 11:09:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwB-0008DH-I6; Mon, 05 Jan 2026 14:08:20 -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 1vcpvL-0007jd-At for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:29 -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 1vcpvI-0005Al-7q for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:26 -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 37ACA5BCC9; Mon, 5 Jan 2026 19:07: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 E2F7F13964; Mon, 5 Jan 2026 19:07: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 WClbKNwLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640030; 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=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=UbLpnG77r9HabaGxHcuW03u5vDmHWPmHz/tQku/2GZLbpQQF2NSjdKQNcvt4+AqDyo5TZF 66WxN1wiZyqC7IRq4ngKf6tOKG3788to54+1EcuypjP6fRmt1VRvtrR/cp2q/3oyiWClIY yw5++K8x3+xqxzWzOMzx2z7c+/mKyuU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640030; 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=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=ts/2o7Y6/Oh/BgLGx5vncCxzMe4z7xf3iI0eWiBbqC3PrOQIdkVXyAxDHnsAu5DnYXAnPO xKk7tBTlyxLPolBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=UbLpnG77; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="ts/2o7Y6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640030; 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=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=UbLpnG77r9HabaGxHcuW03u5vDmHWPmHz/tQku/2GZLbpQQF2NSjdKQNcvt4+AqDyo5TZF 66WxN1wiZyqC7IRq4ngKf6tOKG3788to54+1EcuypjP6fRmt1VRvtrR/cp2q/3oyiWClIY yw5++K8x3+xqxzWzOMzx2z7c+/mKyuU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640030; 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=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=ts/2o7Y6/Oh/BgLGx5vncCxzMe4z7xf3iI0eWiBbqC3PrOQIdkVXyAxDHnsAu5DnYXAnPO xKk7tBTlyxLPolBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 11/25] migration: Fold migration_cleanup() into migration_connect_error_propagate() Date: Mon, 5 Jan 2026 16:06:28 -0300 Message-ID: <20260105190644.14072-12-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 37ACA5BCC9 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)[]; TO_DN_NONE(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640143086158500 Content-Type: text/plain; charset="utf-8" Whenever an error occurs between migrate_init() and the start of migration_thread, do cleanup immediately after. 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 wither 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 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 164cb26c48..d57cc2dc3b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1576,15 +1576,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: @@ -1609,6 +1615,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) @@ -2211,9 +2221,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; } @@ -2222,7 +2229,6 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_detach, bool det= ach, 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; @@ -2279,6 +2285,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; } @@ -2303,7 +2316,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); } @@ -4026,9 +4038,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)); } @@ -4107,7 +4116,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 Fri Jan 9 09:53:04 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=1767640248; cv=none; d=zohomail.com; s=zohoarc; b=bhNTiYd61PQ8j/GwysRnuVFP9aBG+LwTpDyYlNVFjvwfF04D3NmOCARcqszdVUcX/eSttav1fdcQ8aThN5NB+TXcJUkGe+7X8qdbR2Q9GI0SgZtVabNk2ydcyopDRoS/Uo9MD7eNDPwsNzwRndqkP2Fq+R2zh2xLykk4BhQcBUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640248; 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=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=HlXQqeeuZStQIFlkiOeTe4TxFaDubl6dFkwh2k+0gKzC53Wn6o9Ad4p9YCobxNAH3bR4HjWeVSJA+h92S/q9fEb6v7BVnRojQy1lrrEs0F2vsbjeCD44keWzQ6lXGbPPUzCBRcy+yKhC+HG4oMo5ylZBiDC2n4/C59JWE/jpQIA= 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 1767640248333236.84495409664646; Mon, 5 Jan 2026 11:10:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpw5-00082T-6c; Mon, 05 Jan 2026 14:08: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 1vcpvf-0007ri-Hj for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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 1vcpvc-0005Wd-H3 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:46 -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 6CC7C33767; Mon, 5 Jan 2026 19:07: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 DC1D013964; Mon, 5 Jan 2026 19:07: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 YHG8Jt4LXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640032; 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=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=Lc12Kg8IpSYhMaClXnYGU4J6DtENah6BYKyGWjKNuvmwqE+y4pkIKaU48NApgQHLxBKWWM KGnpbej6/2TW7mBBYxB+zNFrSQp4+Kgcnxjg5v3DmtDzHnTkPmddlpUZjM13/ZqIOzGPDL bAQFCkOFYJYfFQzAWqOxhVfoLyWR+eM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640032; 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=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=YCwrqGuHGNSiYT0+R+g6muv8WeIPY6q8uQ3mUUUHALg+W4r/ZiJKdm73t3qrIFyezLwIbq rV4HKHGEXoRHhnDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640032; 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=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=Lc12Kg8IpSYhMaClXnYGU4J6DtENah6BYKyGWjKNuvmwqE+y4pkIKaU48NApgQHLxBKWWM KGnpbej6/2TW7mBBYxB+zNFrSQp4+Kgcnxjg5v3DmtDzHnTkPmddlpUZjM13/ZqIOzGPDL bAQFCkOFYJYfFQzAWqOxhVfoLyWR+eM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640032; 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=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=YCwrqGuHGNSiYT0+R+g6muv8WeIPY6q8uQ3mUUUHALg+W4r/ZiJKdm73t3qrIFyezLwIbq rV4HKHGEXoRHhnDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v2 12/25] migration: Handle error in the early async paths Date: Mon, 5 Jan 2026 16:06:29 -0300 Message-ID: <20260105190644.14072-13-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.989]; 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)[suse.de:mid,suse.de: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_THREE(0.00)[4]; 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 (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: 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: 1767640249580158500 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 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 c956b260a4..0144a70742 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,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 d57cc2dc3b..1ea6125454 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1572,7 +1572,7 @@ static void migrate_error_free(MigrationState *s) } } =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; @@ -4028,7 +4028,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; @@ -4036,13 +4036,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 337b415889..596a1aba0b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3997,7 +3997,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..298bac30cc 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 err; } =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 err; } =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; +err: + 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 Fri Jan 9 09:53:04 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=1767640309; cv=none; d=zohomail.com; s=zohoarc; b=ChxKgn6+CQVazuDEo1MbZZqHqC5FWJbEroSdK2Xk/PnO2kjwEMY8+E0Ee8oqswLShK4tr5nbmymcVy0BjRaoIZggScuCLGnb3L0YKXX2yUaFzCBxjEfkJAGVT9C98dYLgbtS9qdmyNZstZjnAswIig4uXnuFCX9JDYC0iLqmYLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640309; 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=TIdSVKkOhMeoe+3N1SHq1rMNlthaKrheMju2yClidvs=; b=Y/jLUkOJRBUwW5qjiX/dVb2T3cAjQF3Nnc0KqBfEmnok3XWGf11l949EMXiVTfJ9S2M9q0P1+GQ2m7YMDcrkHR6BUmndcagAfiG0M46EOkvxdFQ2B0nt/1abYf0ZcEHyFZWa+DfVvgnbpVA2LwAzwKBdmlpL7wCQxG0oycry/mE= 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 1767640309174891.7371761609754; Mon, 5 Jan 2026 11:11:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwG-0008Ov-Hx; Mon, 05 Jan 2026 14:08:24 -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 1vcpvR-0007lI-JN for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:35 -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 1vcpvP-0005Kp-LM for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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-out2.suse.de (Postfix) with ESMTPS id 5D5785BCC1; Mon, 5 Jan 2026 19:07: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 091B413964; Mon, 5 Jan 2026 19:07: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 UEfLLuALXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640034; 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=TIdSVKkOhMeoe+3N1SHq1rMNlthaKrheMju2yClidvs=; b=cSO3gVnroXsrmQsJW2fWyd59RB1EqgUxp4/jbjPf40e9ZRgv4+QWeO9bg6hI3P33oNhnPS 8dpd3qCFGOemgZzSLgTX6duab/kor/pTACrJwbiSULrSB0X+lrzBORgTtmeD1iqtqydUfJ ZKG8SFbkh34mnl1gQUF+oLlpfzWdZjc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640034; 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=TIdSVKkOhMeoe+3N1SHq1rMNlthaKrheMju2yClidvs=; b=+jlNqVn3g0IaVRP8QIunzumT+hJNVOPOgui4kVmc+1/FafO7AkRBl78x45TaPKFp9PpDYp WgxnriP9XRtVrJCA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=cSO3gVnr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=+jlNqVn3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640034; 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=TIdSVKkOhMeoe+3N1SHq1rMNlthaKrheMju2yClidvs=; b=cSO3gVnroXsrmQsJW2fWyd59RB1EqgUxp4/jbjPf40e9ZRgv4+QWeO9bg6hI3P33oNhnPS 8dpd3qCFGOemgZzSLgTX6duab/kor/pTACrJwbiSULrSB0X+lrzBORgTtmeD1iqtqydUfJ ZKG8SFbkh34mnl1gQUF+oLlpfzWdZjc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640034; 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=TIdSVKkOhMeoe+3N1SHq1rMNlthaKrheMju2yClidvs=; b=+jlNqVn3g0IaVRP8QIunzumT+hJNVOPOgui4kVmc+1/FafO7AkRBl78x45TaPKFp9PpDYp WgxnriP9XRtVrJCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 13/25] migration: Move setting of QEMUFile into migration_outgoing|incoming_setup Date: Mon, 5 Jan 2026 16:06:30 -0300 Message-ID: <20260105190644.14072-14-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 5D5785BCC1 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)[]; TO_DN_NONE(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640310167158500 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) Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 9 +---- migration/migration.c | 82 ++++++++++++++++++++++++++----------------- migration/migration.h | 2 ++ migration/multifd.c | 8 +++-- migration/multifd.h | 2 +- 5 files changed, 58 insertions(+), 45 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 1ea6125454..dc8fe80cf8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -930,17 +930,52 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -/** - * migration_incoming_setup: Setup incoming migration - * @f: file for main migration channel - */ -static void migration_incoming_setup(QEMUFile *f) +static bool migration_has_main_and_multifd_channels(void); + +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 */ @@ -988,7 +1023,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 @@ -1011,8 +1050,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; @@ -1066,28 +1103,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 3fb1a07ba9..4980ed4f04 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1521,7 +1521,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; @@ -1536,7 +1536,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 { @@ -1549,7 +1549,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)); @@ -1558,4 +1558,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 Fri Jan 9 09:53:04 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=1767640335; cv=none; d=zohomail.com; s=zohoarc; b=QoaCEQYN/RBVDByLj4eMzzG7uhK/EjJ7W3g8WWeDxYYuoSZZ/qTnUIMBBX3YbML+IcXYCqAeFjsaECFkvwqnTuKjCOQnlg0n5511fIo3GDFTFRbYf5yhg85jg5HdfvWMxk/AT0QcohiTKQKD0Ky12K6HzXAJRUb46eIa8uWmsDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640335; 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=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=aw7YkPaYB1GnyiRl+DJRG5jchmfgulHEoSxIuoNld77JYH633S0NxZWVLoqEaxhzPMHOS/iibSmlLWxS6QrFHLirQUF2e/0VRarHV5TuiEOGtQZ6jDJTO2G5r+6Hb8f5YdnSmwua01HiCcfNEo+z9zdevx2lM396hrAXyqFhzH8= 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 1767640335794312.3946525845944; Mon, 5 Jan 2026 11:12:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwI-00006F-HA; Mon, 05 Jan 2026 14:08:30 -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 1vcpvY-0007oy-Li for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:41 -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 1vcpvV-0005OO-Tn for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:40 -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 709F05BCD1; Mon, 5 Jan 2026 19:07:16 +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 DFF3213964; Mon, 5 Jan 2026 19:07: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 ECCjJ+ILXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640036; 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=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=qm9hERnbwb9a85iNo/gJrRmZMUtDn9TOrj3cJSUCUBNSqlQc5aQUaIb5EiEIQp25YpEZZv MAWMn+V3z70NLn3LvEX3eO0RMSQ+N/KQBbrqkQa7oCYStzoQ4B+YdcAS1hUgjmGC9u6cMB DrKwM22+OdFXoEuOmMQbzaVsB/G34P8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640036; 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=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=Cw41B6608FpWfUko4b3LEa6ACQy2jDmb0AyPvZBjHnXZin0sfHO9NNNFkUs3pOMNxLp2RP KUSCbg+lusaIYBBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640036; 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=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=qm9hERnbwb9a85iNo/gJrRmZMUtDn9TOrj3cJSUCUBNSqlQc5aQUaIb5EiEIQp25YpEZZv MAWMn+V3z70NLn3LvEX3eO0RMSQ+N/KQBbrqkQa7oCYStzoQ4B+YdcAS1hUgjmGC9u6cMB DrKwM22+OdFXoEuOmMQbzaVsB/G34P8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640036; 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=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=Cw41B6608FpWfUko4b3LEa6ACQy2jDmb0AyPvZBjHnXZin0sfHO9NNNFkUs3pOMNxLp2RP KUSCbg+lusaIYBBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v2 14/25] migration/rdma: Use common connection paths Date: Mon, 5 Jan 2026 16:06:31 -0300 Message-ID: <20260105190644.14072-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.987]; 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)[suse.de:mid,suse.de: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_THREE(0.00)[4]; 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 (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: 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: 1767640338013158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 dc8fe80cf8..906f0bdab3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -91,9 +91,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 */ @@ -1021,16 +1018,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 596a1aba0b..788ae183c1 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 @@ -3836,32 +3836,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) { @@ -3875,15 +3873,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, NULL); + migration_incoming_process(); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, @@ -3995,8 +3994,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 Fri Jan 9 09:53:04 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=1767640223; cv=none; d=zohomail.com; s=zohoarc; b=UmmOpDVWijYIPMFNLv/ZpciZX8y8tU+Xq/9CIvUpHHCbkRP55s438H8V9MFXugxdwZXbv0gK3/XCaxu4RSh8wWdkNtZWp7gzJbYoRM2DppfMvAuVSBEIXRzqYorLzC7ce10jkb1UpgWEXqrDh2ssMjiTDeigXgKCA7y63DzM+bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640223; 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=xy0VlZDCovq7Tw/+8E3QSPQzOFc6kwNTA3Hj0QcDGiQ=; b=CILifLaxOUmjO6k/Ec64SqE0zXrW+xcD/Iwl/0fz42x9+xiF6+CtrC5NzGxEK1oEVeg3bsHXUAVNXZSByobrG1aHtbOuGqJpvBIxnU4WE2PfpITmEkCQIzfuTJZHyo5xTWnvCbPuJcmO3xNpPBp3+p0415eIzqfKNHf3dMFfJ8E= 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 1767640223202379.72240351334744; Mon, 5 Jan 2026 11:10:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwg-0000lV-Ok; Mon, 05 Jan 2026 14:08:52 -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 1vcpvf-0007rh-HT for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:48 -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 1vcpvc-0005Wf-Iu for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:46 -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 4FA9C5BCC8; Mon, 5 Jan 2026 19:07:18 +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 0A0E213964; Mon, 5 Jan 2026 19:07: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 UEDhLuQLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640038; 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=xy0VlZDCovq7Tw/+8E3QSPQzOFc6kwNTA3Hj0QcDGiQ=; b=FsDgWuq0IkD7QdeYTj/M4p5NWjucFjzAdXuTOga8DtogUnbPFlzgcup18myUvV+nF9Z9UB t8wOol+llottjp/fNv0fZG519Kd7ZPsvPB9aT2M73ARbB5YVSWDCDMHWMvfGLuvbjAlbF3 usj0HuzKf3MQ8eSyabkfEaCq6U68UGA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640038; 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=xy0VlZDCovq7Tw/+8E3QSPQzOFc6kwNTA3Hj0QcDGiQ=; b=KY4ESWvpCw4r1qO6kE/GaxIwGcieN7qg2uHOmGsuhR+RzUhEiPiRiV/I6Ovw559Dfb2mxe CirZPpTcmOXm03AQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640038; 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=xy0VlZDCovq7Tw/+8E3QSPQzOFc6kwNTA3Hj0QcDGiQ=; b=FsDgWuq0IkD7QdeYTj/M4p5NWjucFjzAdXuTOga8DtogUnbPFlzgcup18myUvV+nF9Z9UB t8wOol+llottjp/fNv0fZG519Kd7ZPsvPB9aT2M73ARbB5YVSWDCDMHWMvfGLuvbjAlbF3 usj0HuzKf3MQ8eSyabkfEaCq6U68UGA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640038; 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=xy0VlZDCovq7Tw/+8E3QSPQzOFc6kwNTA3Hj0QcDGiQ=; b=KY4ESWvpCw4r1qO6kE/GaxIwGcieN7qg2uHOmGsuhR+RzUhEiPiRiV/I6Ovw559Dfb2mxe CirZPpTcmOXm03AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 15/25] migration: Start incoming from channel.c Date: Mon, 5 Jan 2026 16:06:32 -0300 Message-ID: <20260105190644.14072-16-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.988]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640223448158501 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 12 ++++++++++-- migration/channel.h | 1 + migration/migration.c | 13 +++++-------- migration/migration.h | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 6acce7b2a2..f1c1341a3e 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; + uint8_t 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..b45e909597 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -20,6 +20,7 @@ =20 /* Migration channel types */ enum { + CH_NONE, CH_MAIN, CH_MULTIFD, CH_POSTCOPY diff --git a/migration/migration.c b/migration/migration.c index 906f0bdab3..8117c74b52 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1034,10 +1034,10 @@ static bool migration_has_main_and_multifd_channels= (void) return true; } =20 -void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) +uint8_t migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); - uint8_t channel; + uint8_t channel =3D CH_NONE; uint32_t channel_magic =3D 0; int ret =3D 0; =20 @@ -1056,7 +1056,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); @@ -1071,7 +1071,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()) { /* @@ -1083,16 +1082,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..c760349b07 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -527,7 +527,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); +uint8_t 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 2.51.0 From nobody Fri Jan 9 09:53:04 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=1767640309; cv=none; d=zohomail.com; s=zohoarc; b=dCv2v7inEFB47JxmoyLwzja38tnQv17N9jffTjKMydlNsUikhdCF9m3WSxDJ44I5GHG5L0+5YJGMbk8C+QlBG83lFaiN41EIWbaX4zxDw8B6yqYE7QZxh/8P7FWd/AbLxWY3K3FMFHWWN8Mh6FQssPPNXko8E2rz7UsRfjrVrqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640309; 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=hLtXDI7GnrfzOzRlHIYSqjzBTx7GbuX/+8/Dgt7pp70=; b=GPBmTlOfpI/exKXgU93ybs+Embx3wlRdeHeeimpoznQD9MnX6ztw857AL31h8T8rQh++D4U3zOZEWlZHOhs+5zGOSduqnzUoUrQfXZdQdo35J9ojXpBDKvKc83QWF1uMHt+BG7o06JfpSpndRw6QMGDPdzgFL7Xwkly6VeeOijQ= 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 1767640309299798.2738300602231; Mon, 5 Jan 2026 11:11:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwA-00084X-1y; Mon, 05 Jan 2026 14:08: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 1vcpvn-0007u8-QG for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:56 -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 1vcpvj-0005ZB-7I for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:53 -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 387E35BCD2; Mon, 5 Jan 2026 19:07:20 +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 E87B213964; Mon, 5 Jan 2026 19:07:18 +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 YKVOKeYLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640040; 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=hLtXDI7GnrfzOzRlHIYSqjzBTx7GbuX/+8/Dgt7pp70=; b=f8j36FE11fNrh+hbeEfylHc5x8pyENNv2xSwjVGLhRt5I0F6hoN7/UYb9gnHzKc6E3dZtJ NAmVRLN2/H6/DO8S5Ypwjw1PzkULcVl/E7v58ECgyh7G9QIzOMfXjMep7bBvZxWE31koxJ oIvrU5M0Wt6T/kdK/gg8rqZlHOIIc2Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640040; 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=hLtXDI7GnrfzOzRlHIYSqjzBTx7GbuX/+8/Dgt7pp70=; b=DD4LeWSkRMvCnwsfkAYZoUiqjh4xoOPHZ5PqwfSpboEXcTzGKofOsGNv4g15JLB5iX9zJb vkqJd9RdyiPmVWDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640040; 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=hLtXDI7GnrfzOzRlHIYSqjzBTx7GbuX/+8/Dgt7pp70=; b=f8j36FE11fNrh+hbeEfylHc5x8pyENNv2xSwjVGLhRt5I0F6hoN7/UYb9gnHzKc6E3dZtJ NAmVRLN2/H6/DO8S5Ypwjw1PzkULcVl/E7v58ECgyh7G9QIzOMfXjMep7bBvZxWE31koxJ oIvrU5M0Wt6T/kdK/gg8rqZlHOIIc2Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640040; 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=hLtXDI7GnrfzOzRlHIYSqjzBTx7GbuX/+8/Dgt7pp70=; b=DD4LeWSkRMvCnwsfkAYZoUiqjh4xoOPHZ5PqwfSpboEXcTzGKofOsGNv4g15JLB5iX9zJb vkqJd9RdyiPmVWDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 16/25] migration/channel: Rename migration_channel_connect Date: Mon, 5 Jan 2026 16:06:33 -0300 Message-ID: <20260105190644.14072-17-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.984]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640309835158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 f1c1341a3e..94dea03812 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 b45e909597..0e189c4325 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -28,7 +28,7 @@ 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 0144a70742..150b236fbf 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,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 298bac30cc..611915f84d 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; err: 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 Fri Jan 9 09:53:04 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=1767640150; cv=none; d=zohomail.com; s=zohoarc; b=VjKbAINwkXm5FHRPiBJ1MRX55S03kC0bbb4g/WZ3s4KBtgQNMu+fWakGP+v29TGqkLlJCV2y7TlHESZRp+kBhPhBN6KaQbEJcAI5rKGjDxb18YCZQx9xZhx+6N83L7z+blQ8ieCIKRFjxOCRhcyTY0ZCCiKUKTw0dI/ROD3RWVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640150; 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=YmziOtypueCQmAd8eHRTEdVg5MNBrfuKjCAGKpDC4Yw=; b=Mqoh/Q5SbnyLOgSuFbQ9L2ToiumfPbsA8BYaztKshRXY6m5yrhfvW536g82alreLAxyUtkxBPjmIayYc3mAatyJFfiuWf96G/Qh8QpysJF2PYnW5ZWbHSIVNx46wUsNdY4yhyNmPZz3hfyje9ywc8n14w3dtlbRNl2GcasHYzKQ= 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 1767640150227296.0146326724007; Mon, 5 Jan 2026 11:09:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwE-0008N3-Qa; Mon, 05 Jan 2026 14:08: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 1vcpvq-0007vj-6j for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:58 -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 1vcpvk-0005ZY-Az for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07: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 78F0333750; Mon, 5 Jan 2026 19:07: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 E835813964; Mon, 5 Jan 2026 19:07:20 +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 aJQgKegLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640042; 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=YmziOtypueCQmAd8eHRTEdVg5MNBrfuKjCAGKpDC4Yw=; b=H5qprJ7AuSp13Q47zqhj+NLYqCb8jJ5dXKY6azPrn3Mlow6PTI0y0euvFX0YAuAdCP7tGH 0EThmzLbyvc2PATWjZzTOkpeWtm9RzEVHAJg94WZNTgo+Pz2U3V4zm5+pG6JsgR3umSJ3P 0ePEokWzhpfjpTTBZ8NvYfycJAhMf4w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640042; 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=YmziOtypueCQmAd8eHRTEdVg5MNBrfuKjCAGKpDC4Yw=; b=SfgGKTj7zYe6x96lHAh5d2dtEzGE0Cyl1utXG5t2yZQINngYmEcwPg0xh3J956CPdUsmnV oeAj4+XlEuRlmYCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640042; 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=YmziOtypueCQmAd8eHRTEdVg5MNBrfuKjCAGKpDC4Yw=; b=H5qprJ7AuSp13Q47zqhj+NLYqCb8jJ5dXKY6azPrn3Mlow6PTI0y0euvFX0YAuAdCP7tGH 0EThmzLbyvc2PATWjZzTOkpeWtm9RzEVHAJg94WZNTgo+Pz2U3V4zm5+pG6JsgR3umSJ3P 0ePEokWzhpfjpTTBZ8NvYfycJAhMf4w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640042; 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=YmziOtypueCQmAd8eHRTEdVg5MNBrfuKjCAGKpDC4Yw=; b=SfgGKTj7zYe6x96lHAh5d2dtEzGE0Cyl1utXG5t2yZQINngYmEcwPg0xh3J956CPdUsmnV oeAj4+XlEuRlmYCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v2 17/25] migration: Rename instances of start Date: Mon, 5 Jan 2026 16:06:34 -0300 Message-ID: <20260105190644.14072-18-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.989]; 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)[suse.de:email,suse.de:mid]; 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_THREE(0.00)[4]; 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 (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: 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: 1767640151335158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 94dea03812..8abcb54447 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 150b236fbf..b689426ad4 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -49,7 +49,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); @@ -83,7 +83,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 8117c74b52..5f444958ef 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -740,7 +740,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) { @@ -788,18 +788,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); } @@ -1008,7 +1008,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; @@ -1967,7 +1967,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); @@ -2014,7 +2014,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) @@ -2331,18 +2331,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"); } @@ -4028,7 +4028,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 c760349b07..b852464197 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -538,7 +538,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 788ae183c1..ef95ce440d 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3882,17 +3882,16 @@ static void rdma_accept_incoming_migration(void *op= aque) =20 rdma->migration_started_on_destination =3D 1; migration_incoming_setup(ioc, CH_MAIN, NULL); - 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()) { @@ -3910,7 +3909,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 @@ -3919,7 +3918,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); @@ -3934,8 +3933,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; @@ -3959,7 +3958,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) { @@ -3992,11 +3991,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 611915f84d..ac3183d5d5 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -80,9 +80,8 @@ err: 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 Fri Jan 9 09:53:04 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=1767640314; cv=none; d=zohomail.com; s=zohoarc; b=Py2GiJ1TriKtp2sIW9eRnEWwkS4VtIQF2+VFyR4ak826Jek7rewOqe8AOlZ3a3RYRn0OjJ3GuU/cwDh1W811nYrcDRT/qUUbVfhL+w+deRQFYuWBegH2Y4xYIxSDpouSrJJro82LPKqTmN/Cw766g6CaWgtW7i9wuHso6w2o6EU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640314; 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=G2b9JEsbabxQXPEjgwCwHEO0tBtofIMWlZReL6Obrk0=; b=KJhe2NFd8m2CF3xg37qC4afpVuf95JKPmZVldgassPImNSp78qY3CxdJJRgGfg5rjWEEXTlhXNa1pyGV9LSerbk0MnWS1sM6KJid7Fy3fxJHZtVVJhGcBYfpOsokTZUtwzDXie7LXXEZjef8psHahODkgFC92nG03JRwJHDDsNk= 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 1767640314170157.87674475004894; Mon, 5 Jan 2026 11:11:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpws-0001Er-49; Mon, 05 Jan 2026 14:09: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 1vcpvx-0007zv-Jr for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:07 -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 1vcpvv-0005bL-Ja for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:05 -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 9AF4133769; Mon, 5 Jan 2026 19:07: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 16A3813964; Mon, 5 Jan 2026 19:07:22 +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 mBgnMuoLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640044; 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=G2b9JEsbabxQXPEjgwCwHEO0tBtofIMWlZReL6Obrk0=; b=a3u1Xzu0BS4olpgedjUyt754IXAhhzdZ35W2I3Vgg5Uip5oLyeB8LVTJ63ZMGUJUCyAdnu 3Kx96g7IojYLzKje3WVmezh2i0/0qId6MU59IDXjAHeJhpChD+WB7PEab6QHQz5FUiNudD lSZMwkdwjC82OCwLkUGphsM/15eshVE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640044; 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=G2b9JEsbabxQXPEjgwCwHEO0tBtofIMWlZReL6Obrk0=; b=vk7mrxj9XuRqMbB08/SCgyQvmlBfis31Mp3i/XHHjn9yrj9Ov0m/rBRTAg9y2avosgbDSu YjyzQN2z8YEbljCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640044; 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=G2b9JEsbabxQXPEjgwCwHEO0tBtofIMWlZReL6Obrk0=; b=a3u1Xzu0BS4olpgedjUyt754IXAhhzdZ35W2I3Vgg5Uip5oLyeB8LVTJ63ZMGUJUCyAdnu 3Kx96g7IojYLzKje3WVmezh2i0/0qId6MU59IDXjAHeJhpChD+WB7PEab6QHQz5FUiNudD lSZMwkdwjC82OCwLkUGphsM/15eshVE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640044; 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=G2b9JEsbabxQXPEjgwCwHEO0tBtofIMWlZReL6Obrk0=; b=vk7mrxj9XuRqMbB08/SCgyQvmlBfis31Mp3i/XHHjn9yrj9Ov0m/rBRTAg9y2avosgbDSu YjyzQN2z8YEbljCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v2 18/25] migration: Move channel code to channel.c Date: Mon, 5 Jan 2026 16:06:35 -0300 Message-ID: <20260105190644.14072-19-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.991]; 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)[suse.de:mid,suse.de: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_THREE(0.00)[4]; 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 (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: 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: 1767640315937158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 99 ++++++++++++++++++++++++++++++++++++++++++- migration/channel.h | 4 ++ migration/migration.c | 96 ----------------------------------------- migration/migration.h | 2 - migration/rdma.c | 1 + 5 files changed, 103 insertions(+), 99 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 8abcb54447..a6608c5f08 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 int migration_channel_identify(MigrationIncomingState *mis, + QIOChannel *ioc, Error **errp) +{ + int 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 0e189c4325..59d169e095 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 5f444958ef..540b419cda 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -927,8 +927,6 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -static bool migration_has_main_and_multifd_channels(void); - bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -1018,100 +1016,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; -} - -uint8_t migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - uint8_t 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 b852464197..7689c97051 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -532,8 +532,6 @@ 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 ef95ce440d..582e0651d4 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 Fri Jan 9 09:53:04 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=1767640181; cv=none; d=zohomail.com; s=zohoarc; b=XF/R9gOLnko7n1ds+lzN1GVmR7e9dEgLije/SYGZcRtmidYeMQaFN03jdMcIjaHNIn0silfO7YdO/rQyG27UclK5J8LNqGlDE8KgLiw0Q0w2ZJqSdKHUWGLF42CJEPNBZ8AYod2shBRn8cfrEdX1cxsBDCVymZq2+S1d/g+m5uE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640181; 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=uoPU6TRM/mLO1xKHhI01CyaBN2OVcc81OyBADxz8Yl0=; b=GWK7Sq7ASzizAdAeDP5oPLjUmadMjgbD0WyA1Arq9AXu6B1VGE3FAwiWVqrQHoPDlRF5EaK95qOFg3W6oVz+9VWJ0oMP7YcHYVStvepjJ7D/xjWuTK7Eu0YCQOJjJfvnLKe/HS/0wu/IvXwt5h8zdwCg6MVbKOgsAxzRpF8HS84= 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 1767640181116404.4181302072103; Mon, 5 Jan 2026 11:09:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwX-0000VX-BF; Mon, 05 Jan 2026 14:08:43 -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 1vcpw3-00081a-Dr for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:12 -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 1vcpw1-0005cp-91 for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08: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 7895C3376A; Mon, 5 Jan 2026 19:07: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 32F4213964; Mon, 5 Jan 2026 19:07: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 eBcFOewLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640046; 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=uoPU6TRM/mLO1xKHhI01CyaBN2OVcc81OyBADxz8Yl0=; b=uQgbO4JXJQtL3p1Fu7YaFJGB+9X0AXVbUinra751u+yFgY4qRjTPhNAj9cPLJ/g9yGVyYD +KrlzBCJXZu0u7c1Y5ER53aUcpugFoPnIvGwLSOgQ0zoe+oeJv6iWJ8kGQ76miKAGanfz8 wjHtmOG1BxcWk3jR/RWhxoPrFuXlgyg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640046; 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=uoPU6TRM/mLO1xKHhI01CyaBN2OVcc81OyBADxz8Yl0=; b=p5q6pLy3judEHYFPmJJAoSsY+YA4hA6iMEvA/XQmdnKbcvoIz/xTVDcJUOcbyq3hEek9UX dafgwmiZ3LHlgRAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640046; 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=uoPU6TRM/mLO1xKHhI01CyaBN2OVcc81OyBADxz8Yl0=; b=uQgbO4JXJQtL3p1Fu7YaFJGB+9X0AXVbUinra751u+yFgY4qRjTPhNAj9cPLJ/g9yGVyYD +KrlzBCJXZu0u7c1Y5ER53aUcpugFoPnIvGwLSOgQ0zoe+oeJv6iWJ8kGQ76miKAGanfz8 wjHtmOG1BxcWk3jR/RWhxoPrFuXlgyg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640046; 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=uoPU6TRM/mLO1xKHhI01CyaBN2OVcc81OyBADxz8Yl0=; b=p5q6pLy3judEHYFPmJJAoSsY+YA4hA6iMEvA/XQmdnKbcvoIz/xTVDcJUOcbyq3hEek9UX dafgwmiZ3LHlgRAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 19/25] migration: Move transport connection code into channel.c Date: Mon, 5 Jan 2026 16:06:36 -0300 Message-ID: <20260105190644.14072-20-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.986]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640183317158500 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. (I sorted the includes) Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 a6608c5f08..1817f88aed 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 59d169e095..727eabf16c 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 */ 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 540b419cda..d9407a47ce 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" @@ -783,26 +780,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(); @@ -2230,31 +2208,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 Fri Jan 9 09:53:04 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=1767640164; cv=none; d=zohomail.com; s=zohoarc; b=Y7HNEeWeqyci1eXHJ0q/uMzX3NVzeSorUTb1FOGKpZ4i1MkGn9wjQonZ93LPQGWi/D4N4Kr+FZusIA6Oa1bZRtOly7w6cnofjcJh90FTsIE184AM/49n+WTcBv0+NQSC1yhHVotGjV8GxD+cOBzZ6HHvXMW8OhTninDez42CYZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640164; 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=nRUsmchovs2iUizchHjBH67PFg9x6ih5h2i24MRyOaM=; b=Xu106IyGuGsNRLUIY9g0h5aFGrPVtUXiMmLJvo6+pFAB74Kg1h0BncbY6dYt7RNkh5eXSwpgtEq+4tR+JsI1E3UMZHY6Y+ZET2xbQcDeGuJCBa9nyin8tOWmXGPpVn2TP9gYnaWzYSz+lBYGLVZQhhF1q6ZsYc37HeDYuMzLp4s= 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 1767640164737604.3233475048334; Mon, 5 Jan 2026 11:09:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwq-0000xy-2N; Mon, 05 Jan 2026 14:09:00 -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 1vcpvv-0007yF-Rs for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:05 -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 1vcpvr-0005af-4p for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08: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 5479D5BCD3; Mon, 5 Jan 2026 19:07: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 0FE7513964; Mon, 5 Jan 2026 19:07:26 +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 iCl9MO4LXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640048; 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=nRUsmchovs2iUizchHjBH67PFg9x6ih5h2i24MRyOaM=; b=VlKUNP7wB/9IGUA/npGskW5pQD1EEPq2qPnAK8d9KLnGnRH47E5Blqqbg8zSDc1f47C+ea ZvfKAnUS3rZ7E/Y7X8RuZjF0YwpJ/YEABtxim1GUiRJ2SbDifwYo8MnjCN/EqFbmD/W0Nf xzImVn+d7mNmRKEDKv9yP6uaZXWWpK8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640048; 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=nRUsmchovs2iUizchHjBH67PFg9x6ih5h2i24MRyOaM=; b=X8ITEp6pfCiNL7s0Q6eDg2Yr8xuFEttdgxKwGuOz4jN99lspDSLR8fqPwl+diFbKSDNSQZ aAt2rACVsF2vtrCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=VlKUNP7w; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=X8ITEp6p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640048; 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=nRUsmchovs2iUizchHjBH67PFg9x6ih5h2i24MRyOaM=; b=VlKUNP7wB/9IGUA/npGskW5pQD1EEPq2qPnAK8d9KLnGnRH47E5Blqqbg8zSDc1f47C+ea ZvfKAnUS3rZ7E/Y7X8RuZjF0YwpJ/YEABtxim1GUiRJ2SbDifwYo8MnjCN/EqFbmD/W0Nf xzImVn+d7mNmRKEDKv9yP6uaZXWWpK8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640048; 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=nRUsmchovs2iUizchHjBH67PFg9x6ih5h2i24MRyOaM=; b=X8ITEp6pfCiNL7s0Q6eDg2Yr8xuFEttdgxKwGuOz4jN99lspDSLR8fqPwl+diFbKSDNSQZ aAt2rACVsF2vtrCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 20/25] migration: Move channel parsing to channel.c Date: Mon, 5 Jan 2026 16:06:37 -0300 Message-ID: <20260105190644.14072-21-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 5479D5BCD3 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)[]; TO_DN_NONE(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640166602158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 45 ++++++++++++++++++++++++++++++++++++++ migration/channel.h | 5 +++++ migration/migration.c | 50 ++++++++++++------------------------------- 3 files changed, 64 insertions(+), 36 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 1817f88aed..b245870021 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,45 @@ 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 }; + bool single_channel =3D cpr_channelp ? false : true; + + if (single_channel && 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]); + } + + *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 727eabf16c..0c8ad9793b 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 d9407a47ce..3d07e5f44f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -741,8 +741,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 /* @@ -754,25 +753,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 @@ -780,7 +774,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(); @@ -2112,10 +2106,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 @@ -2126,38 +2118,24 @@ 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)) { + if (!migration_transport_compatible(main_ch->addr, errp)) { return; } =20 - if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_ch) { error_setg(errp, "missing 'cpr' migration channel"); return; } @@ -2174,7 +2152,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 @@ -2190,10 +2168,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 Fri Jan 9 09:53:04 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=1767640344; cv=none; d=zohomail.com; s=zohoarc; b=Gs3vkeXGQGS32HW7slYGXVj+qf9BfDzsbu7BPJaRD6KQmm2Zf38CYL140KZxQWZFZA4No4Z8Wm3vUYREJux14uQJQG+n/gkknpGWjo3XgR66srKM0nhcesOX03S19yUMJbtbW66Df+eeCsAbkExNvQYzrdJ24xx3Lclh06/K034= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640344; 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=5/ENXyVvYPVnyytbcYArFMV3gYAjyIiIRNFiGykEIrs=; b=PnyV7RdNQF0N4SBSQlYJXYUh6LSslcF9gCOcww4u6o6KOeADGN8aMS7C2o17XT8h2bcpVUg7IGAe2JeWQddE2h3qvUQ1Dtj7GBK5OBg+YNTbTbYWP5HYS3Lu2DbqyqVn3yr18ywuIXqyF87+2KAnaVyBVawzsouszdzltq3rFQU= 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 1767640344362525.9294544237827; Mon, 5 Jan 2026 11:12:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwo-0000ot-T2; Mon, 05 Jan 2026 14:08:58 -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 1vcpw9-0008CN-Sb for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:17 -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 1vcpw7-0005e9-As for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:17 -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 3DBCD33754; Mon, 5 Jan 2026 19:07: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 DFFCB13964; Mon, 5 Jan 2026 19:07: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 ULW5J/ALXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640050; 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=5/ENXyVvYPVnyytbcYArFMV3gYAjyIiIRNFiGykEIrs=; b=SpMvk8cfHwxwhptqJwg+OLVUzQVs6WNEozloQwsSw1+oaUmqWxbCp8Al1WZNNX63smqkTw irofX79EujZqSaXbZvKepX46EZGWtMagrdgthKhMvQlgis/GoPe362xZu9rhDXkOAXcD/z L8kS3wsMWtwb9ljcieA1n0hgWrTW49A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640050; 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=5/ENXyVvYPVnyytbcYArFMV3gYAjyIiIRNFiGykEIrs=; b=vzA48uEnTAs+XxNX/JgSNPqqEYhcKWR8ZbYNcEc0rLbqAY33J3BOstznd3JMHVFzn+347U YwGi1CGhRgCYGYDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=SpMvk8cf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=vzA48uEn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640050; 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=5/ENXyVvYPVnyytbcYArFMV3gYAjyIiIRNFiGykEIrs=; b=SpMvk8cfHwxwhptqJwg+OLVUzQVs6WNEozloQwsSw1+oaUmqWxbCp8Al1WZNNX63smqkTw irofX79EujZqSaXbZvKepX46EZGWtMagrdgthKhMvQlgis/GoPe362xZu9rhDXkOAXcD/z L8kS3wsMWtwb9ljcieA1n0hgWrTW49A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640050; 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=5/ENXyVvYPVnyytbcYArFMV3gYAjyIiIRNFiGykEIrs=; b=vzA48uEnTAs+XxNX/JgSNPqqEYhcKWR8ZbYNcEc0rLbqAY33J3BOstznd3JMHVFzn+347U YwGi1CGhRgCYGYDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 21/25] migration: Move URI parsing to channel.c Date: Mon, 5 Jan 2026 16:06:38 -0300 Message-ID: <20260105190644.14072-22-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[]; TO_DN_NONE(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 3DBCD33754 X-Spam-Score: -3.01 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 (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: 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: 1767640346064158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 b245870021..6bb2077274 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 }; bool single_channel =3D cpr_channelp ? false : true; @@ -325,3 +325,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 0c8ad9793b..016e0fb07e 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 3d07e5f44f..2789a0bd66 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" @@ -659,61 +658,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) { @@ -744,27 +688,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; @@ -2109,27 +2036,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 Fri Jan 9 09:53:04 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=1767640239; cv=none; d=zohomail.com; s=zohoarc; b=VkYIcV/mDljnHkjDNDkKae5OYzruwu66N9oBs2+N7m3NfSxeu319ga3b+P6mILxdpSvLSXvYb+PlT4t/jslkSWOyoG6eFN1l7UV3YRGqyT5opIsfDn93U2lY5gIffhq1HFzunLAPj/YcUCZq5Yd/Ck1/ftRY74cYDktFW41qhZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640239; 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=UjgbcOBfuRqLPGUFxQfqrs1GgBd269095HHC9pJSeLg=; b=k0UiDOjt1OiE64Hi4P+VH6w8yVuKxEy3k3dsNXp3bde1j4q2bwjgpGpM4F5aYoy7riqyAANBIOAw4RbDPk90VkU1zu42tHwvrYQ7/Inel4+4gBt2g0j8LqPA7pF7RzToPG2Cifwu5NosTYmDyKxzn6QEW/a0szTdDOx41l4/fXU= 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 1767640239276138.1260046506443; Mon, 5 Jan 2026 11:10:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpxO-0002Gq-5K; Mon, 05 Jan 2026 14:09: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 1vcpwF-0008RS-3o for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:24 -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 1vcpwD-0005fF-Id for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:22 -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 811FC3376B; Mon, 5 Jan 2026 19:07: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 B699A13964; Mon, 5 Jan 2026 19:07: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 ILaOHfILXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640052; 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=UjgbcOBfuRqLPGUFxQfqrs1GgBd269095HHC9pJSeLg=; b=TSdWNmxEQyWh6z8qjopZWc+JlsaLUaBPQM4ICEjU2aJWT719llJsfflpR+vYwjO1P4vvtc Q2syJlRKJEqwIfVUOFxieEx7jjCj1DJBLXuxWs/94tben5WWHLLbFNjg6YLbQqOyu6TJgV YEt6ViPuwXPvNSNvBizOdA7GW5+S2XM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640052; 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=UjgbcOBfuRqLPGUFxQfqrs1GgBd269095HHC9pJSeLg=; b=W6DsDZBWM618PHPIfkNAskgyeW+HouNG6cjaaFNdgHOljQy3d2w/TBI4InZzD5Y8pTAU3u rGCLFGsNGh9A3+Dw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640052; 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=UjgbcOBfuRqLPGUFxQfqrs1GgBd269095HHC9pJSeLg=; b=TSdWNmxEQyWh6z8qjopZWc+JlsaLUaBPQM4ICEjU2aJWT719llJsfflpR+vYwjO1P4vvtc Q2syJlRKJEqwIfVUOFxieEx7jjCj1DJBLXuxWs/94tben5WWHLLbFNjg6YLbQqOyu6TJgV YEt6ViPuwXPvNSNvBizOdA7GW5+S2XM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640052; 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=UjgbcOBfuRqLPGUFxQfqrs1GgBd269095HHC9pJSeLg=; b=W6DsDZBWM618PHPIfkNAskgyeW+HouNG6cjaaFNdgHOljQy3d2w/TBI4InZzD5Y8pTAU3u rGCLFGsNGh9A3+Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Mark Kanda , Ben Chaney Subject: [PATCH v2 22/25] migration: Free cpr-transfer MigrationAddress along with gsource Date: Mon, 5 Jan 2026 16:06:39 -0300 Message-ID: <20260105190644.14072-23-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; 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)[suse.de:email,suse.de:mid]; 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 (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: 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: 1767640239533158500 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 slight simpler. (also fix the indentation of migrate_hup_add) Cc: Mark Kanda Cc: Ben Chaney Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2789a0bd66..044ae2d7a7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2003,9 +2003,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) @@ -2024,7 +2026,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 @@ -2079,7 +2080,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 Fri Jan 9 09:53:04 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=1767640313; cv=none; d=zohomail.com; s=zohoarc; b=clb8p2ciuX6ctflQ0+jgps6OxrxZjm/9XVXhJQicjtNsrgpjEwj/1C+rWlTFhkt22Q74OTXfDxYrKSKJWGE7KaMo+Ml9fUepcgaLdjHvFfy+tgTH79QPinESF3sMg9PKiuylR6vhCyj+nw3QAU4zB//OxdKlxpT5eRksxTumCcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640313; 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=58NjvfAREMtoDAR5/SpvEBKFHr2TKWrtis84S21+KLE=; b=D+5yNwPn05OYqHyvzFniXd9jufgH96nBEx17Tm0KvKhWOw2OswhsYX2ERmD17Lm977sE1drSGJS+96w51kdJEAQWcuVxL32ME/JkHRDzkAw3bsR9VxaFpLuFhanvyeElShgx3bBuLrU3rV4nqRNpdEq/HJ2ZsQfAwDvHYpnxh+c= 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 1767640313881549.1522003008157; Mon, 5 Jan 2026 11:11:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpws-0001FR-H1; Mon, 05 Jan 2026 14:09: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 1vcpwL-0000Mm-5F for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:31 -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 1vcpwJ-0005g1-Bo for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:28 -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 DAE703376C; Mon, 5 Jan 2026 19:07: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 17BD613964; Mon, 5 Jan 2026 19:07: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 kNthMvQLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640054; 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=58NjvfAREMtoDAR5/SpvEBKFHr2TKWrtis84S21+KLE=; b=hBwthfx9mW4fpnc4cJcQq1AGpBPclbcAQ4ZBNCUkx2Xp0z9YuvZLSJlmzBDTbpmycey4or LpzKvK3asfzcffyI6T5e8QHGFzJZBwctKvyME/vXyDVuqZOB4ljYKiEsXEtDVrw4729dJi 0Nc5Ip0LVYrMcd7RsOWBG5a8KTu3ODk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640054; 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=58NjvfAREMtoDAR5/SpvEBKFHr2TKWrtis84S21+KLE=; b=GrA7YvLGhwC1cmVd8hQX0+UQVHFKUJ5FlSSJdiJtlCk5r9woydBs3N6krGGr3U+lnDYV+c k3BUFTwITx5vTLDQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hBwthfx9; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=GrA7YvLG DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640054; 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=58NjvfAREMtoDAR5/SpvEBKFHr2TKWrtis84S21+KLE=; b=hBwthfx9mW4fpnc4cJcQq1AGpBPclbcAQ4ZBNCUkx2Xp0z9YuvZLSJlmzBDTbpmycey4or LpzKvK3asfzcffyI6T5e8QHGFzJZBwctKvyME/vXyDVuqZOB4ljYKiEsXEtDVrw4729dJi 0Nc5Ip0LVYrMcd7RsOWBG5a8KTu3ODk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640054; 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=58NjvfAREMtoDAR5/SpvEBKFHr2TKWrtis84S21+KLE=; b=GrA7YvLGhwC1cmVd8hQX0+UQVHFKUJ5FlSSJdiJtlCk5r9woydBs3N6krGGr3U+lnDYV+c k3BUFTwITx5vTLDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Mark Kanda , Ben Chaney Subject: [PATCH v2 23/25] migration: Move CPR HUP watch to cpr-transfer.c Date: Mon, 5 Jan 2026 16:06:40 -0300 Message-ID: <20260105190644.14072-24-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: DAE703376C 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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; FROM_HAS_DN(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640315889158501 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 044ae2d7a7..a9d5f5880d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -100,7 +100,6 @@ static bool migration_object_check(MigrationState *ms, = Error **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) { @@ -1293,7 +1292,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 @@ -1476,7 +1475,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 @@ -2000,25 +1999,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) @@ -2079,8 +2059,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 Fri Jan 9 09:53:04 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=1767640351; cv=none; d=zohomail.com; s=zohoarc; b=AB/34NIT+14R+mx2mmge6uJz+IBzVlmF1glSnaMJPiXZP5Rig6tGKnQcL1eSFgExAZuzeKNwulDhp8opFA46PciQQ+WIqh3q7zziSixNCIfjTpmDkNCpwFhLO8ohGVTRMS2aXJoZN6lJkY0L5mXbuhfTZW8NOZ4imcd9vRMQtRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640351; 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=qTBQAjwuG9jBa81jGA/8m76UIROtEgrPinh8cNGJ0T0=; b=YItY0H1NRo3PEKzz/VacEtQtvCL7cvn+kd0LBKStbygEKofCJWh3d1oaCMm62yv62LCdsmmaLxSQfaHrpzZtiERiQvBCXle0gqJi9Ihg3wAGTGN4jinBwuq6Q98cg9NQWir1rb4/z9bmyyZjtUcK4gHUEB4NIK8Ntz+/eOEi+xA= 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 1767640351701384.47699386348313; Mon, 5 Jan 2026 11:12:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwp-0000vp-Gz; Mon, 05 Jan 2026 14:08: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 1vcpw3-00081C-0V for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:11 -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 1vcpw0-0005cV-LY for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:10 -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 B17025BCC1; Mon, 5 Jan 2026 19:07:36 +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 6CB683EA63; Mon, 5 Jan 2026 19:07:35 +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 iMNxC/cLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640056; 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=qTBQAjwuG9jBa81jGA/8m76UIROtEgrPinh8cNGJ0T0=; b=MnUNIDPtOXiyK/VemGEptpK6RApiCn3ShWEacO8SOKE1vsdO2fjL8x2ja46A8T2bUo2V0f dSxomoXksZSU1W8vxFWWRasdWT9fCOyZ7K5rZeoRzrfHLJzG2akwPNBL771WYtll+iC/l/ n6ZyF+DCucc04/BWDupB+NxhsDwwVls= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640056; 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=qTBQAjwuG9jBa81jGA/8m76UIROtEgrPinh8cNGJ0T0=; b=C7/hQktGqcxqOdlU6aez+D1BGlTveFR49uxo0++y4e+lv1456R6TwvpXT3Z6//i/vg16Vn NDjnEvY4J37NtwDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640056; 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=qTBQAjwuG9jBa81jGA/8m76UIROtEgrPinh8cNGJ0T0=; b=MnUNIDPtOXiyK/VemGEptpK6RApiCn3ShWEacO8SOKE1vsdO2fjL8x2ja46A8T2bUo2V0f dSxomoXksZSU1W8vxFWWRasdWT9fCOyZ7K5rZeoRzrfHLJzG2akwPNBL771WYtll+iC/l/ n6ZyF+DCucc04/BWDupB+NxhsDwwVls= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640056; 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=qTBQAjwuG9jBa81jGA/8m76UIROtEgrPinh8cNGJ0T0=; b=C7/hQktGqcxqOdlU6aez+D1BGlTveFR49uxo0++y4e+lv1456R6TwvpXT3Z6//i/vg16Vn NDjnEvY4J37NtwDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v2 24/25] migration: Remove qmp_migrate_finish Date: Mon, 5 Jan 2026 16:06:41 -0300 Message-ID: <20260105190644.14072-25-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-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)[-0.987]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; 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 (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: 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: 1767640352018158500 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 cleanup at qmp_migrate_finish() to move to the top level along with everyting else. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a9d5f5880d..2991e01d65 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1997,15 +1997,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 @@ -2059,10 +2062,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: @@ -2072,19 +2076,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 Fri Jan 9 09:53:04 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=1767640334; cv=none; d=zohomail.com; s=zohoarc; b=FEX6fu336LigferEE3MfKbVPFANOalwX0BBG5eUC7gxAv6wQUL4FV0nznylG7MLMiXXuy4px0LSdwfwC9CxZpP/lMmFJWBkbj5Ei0dhhQh6tk4pbo2J/alk38ImKsSDRLCfiq8/gsQ4dazYjhBSNo0QO5CSeqn9MlKMmEX69j8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640334; 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=Xg/R0+8Dxp8QVcoFMs1UgwVZPKpAKqEG4Dnk+Tv5UaU=; b=OBSZ4YjFClfVgFKuDF+knDhkHnuW8wWNbx0t8R6W3fGCAGDtvfwPjKog1P45+TtKsd30BhQlHYph5URBQOBQ0krHpS0jZ4WuvKbs54edz8/Fd7k+5G7Fxvp8z21bS6r1eUg1CJsTMKsjwcc4HpKlixC2h+OKgceuK7wzotBpHDM= 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 1767640334448448.7733618920637; Mon, 5 Jan 2026 11:12:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwu-0001Tm-7W; Mon, 05 Jan 2026 14:09: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 1vcpwR-0000Tf-Va for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08:38 -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 1vcpwP-0005h4-0n for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:08: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 1092433764; Mon, 5 Jan 2026 19:07: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 60DFC13964; Mon, 5 Jan 2026 19:07: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 +KdTB/kLXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640059; 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=Xg/R0+8Dxp8QVcoFMs1UgwVZPKpAKqEG4Dnk+Tv5UaU=; b=CDfuSlN4kuXH0YHuAOeNG8ZesupXr/D5JZMw4DALGZANvdCz8uay79/CSxmBd7wo2NqSPB SbnH9NGiuMxtDXJcsFJzA5u+wfmA0m5GNgJaVVpTqq5wROiCv/mQJpjYAN5j3V2vGYVVCq VaBombwgO/bpr8F5qCBOfjPwCq9nCww= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640059; 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=Xg/R0+8Dxp8QVcoFMs1UgwVZPKpAKqEG4Dnk+Tv5UaU=; b=IJeGsF4cNfx3EWkZATow2bXzpKz4YxIMenXc4+mp4IFoM7C8vsCdwu3b5tpMC6xruGOy6y tn/ArH/BeYS+5cCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=CDfuSlN4; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=IJeGsF4c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640059; 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=Xg/R0+8Dxp8QVcoFMs1UgwVZPKpAKqEG4Dnk+Tv5UaU=; b=CDfuSlN4kuXH0YHuAOeNG8ZesupXr/D5JZMw4DALGZANvdCz8uay79/CSxmBd7wo2NqSPB SbnH9NGiuMxtDXJcsFJzA5u+wfmA0m5GNgJaVVpTqq5wROiCv/mQJpjYAN5j3V2vGYVVCq VaBombwgO/bpr8F5qCBOfjPwCq9nCww= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640059; 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=Xg/R0+8Dxp8QVcoFMs1UgwVZPKpAKqEG4Dnk+Tv5UaU=; b=IJeGsF4cNfx3EWkZATow2bXzpKz4YxIMenXc4+mp4IFoM7C8vsCdwu3b5tpMC6xruGOy6y tn/ArH/BeYS+5cCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v2 25/25] migration/channel: Centralize calling migration_channel_connect_outgoing Date: Mon, 5 Jan 2026 16:06:42 -0300 Message-ID: <20260105190644.14072-26-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 1092433764 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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; FROM_HAS_DN(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action 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 (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: 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: 1767640336072158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 28 ++++++++++++++++++++++++---- migration/exec.c | 8 ++++---- migration/exec.h | 5 ++++- migration/fd.c | 13 +++++++------ migration/fd.h | 7 +++++-- migration/file.c | 18 ++++++++++-------- migration/file.h | 5 +++-- migration/rdma.c | 11 +++++------ migration/rdma.h | 4 ++-- 9 files changed, 64 insertions(+), 35 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 6bb2077274..a8516837cf 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 b689426ad4..bbf380d1a0 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -49,12 +49,13 @@ 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)) { @@ -66,12 +67,12 @@ void fd_connect_outgoing(MigrationState *s, const char = *fdname, Error **errp) 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 582e0651d4..66bc337b6b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3934,8 +3934,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; @@ -3945,7 +3945,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); @@ -3995,12 +3995,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