From nobody Wed Jan 7 09:26:21 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=1766784194; cv=none; d=zohomail.com; s=zohoarc; b=di01pzKrx2IHEGms8uXjhMwC/FNDFyD5YTc3ahtHZvRCksxK3wI7HcQbl9kDQFnN8SFsNoNrT9g1SByYIJG1z8vya+4FwGKG13qB/+xiSPntmHyIF9UWrcAy0WZ5aZR0OtqmRkRw4nqnSN2Tt41FVAg0vM1uX2tSC49AedLV6x8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784194; 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=7DLXrmR0DcTb+AyPu+Z8CXcP1bsbFS/3gaxCZcPZwxQ=; b=howzzJUKtaDiZMmmKhRoUt4CTpryAmOFGrQSyVIKHgm7MNPT46a46thmZnyUN0N1B6MzPKVP9PwrbuhpAqjKxwTu2gO/rq5/lUAIhUjUnx5SLfiyxOAcTtRm1smGM5/j8w3pw5h3RwF4lV5750iye7IY8SFRJa1yRmJY50LGx+U= 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 1766784194317298.6167826574957; Fri, 26 Dec 2025 13:23:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFE0-0001H5-Cw; Fri, 26 Dec 2025 16:19: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 1vZFDs-0001F2-Lt for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19: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 1vZFDr-0003Wz-1u for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:44 -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 AD0F5336A8; Fri, 26 Dec 2025 21:19:35 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 92AD23EA65; Fri, 26 Dec 2025 21:19:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 6AbAFOb7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783975; 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=7DLXrmR0DcTb+AyPu+Z8CXcP1bsbFS/3gaxCZcPZwxQ=; b=NySEOgVjhC70vHB72BSOnbQ1KMj5Gfbu1WjwHtfvIs2WDmXFCjz22JUM0Ik6ztm2jJ7lip Cp9ewmrvygyiFyIjGIOCdyNEzhRfdNYFDlR10AOF/GlNPO2fQocXcFEYQEsXPQd6c8B8oB bOGKVocII0jODuCW0CMrZcYGToa19UM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783975; 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=7DLXrmR0DcTb+AyPu+Z8CXcP1bsbFS/3gaxCZcPZwxQ=; b=7bxZxrCmbJc1wzW7Z/af5LyQ76mtqcxNzI/WwhUfAcWKtwpli+6fSvn+k9I34s+ozsGsj/ J1SoZ6NHUCF3M9Cg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783975; 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=7DLXrmR0DcTb+AyPu+Z8CXcP1bsbFS/3gaxCZcPZwxQ=; b=NySEOgVjhC70vHB72BSOnbQ1KMj5Gfbu1WjwHtfvIs2WDmXFCjz22JUM0Ik6ztm2jJ7lip Cp9ewmrvygyiFyIjGIOCdyNEzhRfdNYFDlR10AOF/GlNPO2fQocXcFEYQEsXPQd6c8B8oB bOGKVocII0jODuCW0CMrZcYGToa19UM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783975; 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=7DLXrmR0DcTb+AyPu+Z8CXcP1bsbFS/3gaxCZcPZwxQ=; b=7bxZxrCmbJc1wzW7Z/af5LyQ76mtqcxNzI/WwhUfAcWKtwpli+6fSvn+k9I34s+ozsGsj/ J1SoZ6NHUCF3M9Cg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 01/25] migration: Remove redundant state change Date: Fri, 26 Dec 2025 18:19:03 -0300 Message-ID: <20251226211930.27565-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.977]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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: 1766784194980158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 635851fe8c..71efe945f6 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 Wed Jan 7 09:26:21 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=1766784026; cv=none; d=zohomail.com; s=zohoarc; b=D3OlkIxEw5IVItNIK22C/ju1HLUZ4uCGOQH0zsudMcLu73+3ZWZPtQ/esc+5m/O4FTGkcOmlCyhU/PX0zOPfvcOQLaJ8Tg5TQ15oPSj3qLW3eR0nNDaJvztYBhZDu2IzACUDeBB3r+ngbSZHsP6O8NwWUEyhakWeUUCVxI0fDSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784026; 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=ws1VQpTNPQlwQt5+bAweu+kVb8iQHqA8cUAIMBvExFA=; b=d/hK8iOarzaPRIgevuTFdeFG1uBZ4CTCmfbdZiKYcz0OyfBJgyAY8hMvJrE5rVox7btq5sTiXOMGtJ1DgXPDWHf0VlCXmZrtQsbePY5VBfGKwCeXeePtsFri3qncDP3+D5X0pKVgXSkBTOaeLBbm6PEFYIGgA2a4xyBLMvnLrI4= 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 1766784026285352.00358549250086; Fri, 26 Dec 2025 13:20:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFDz-0001GE-Sg; Fri, 26 Dec 2025 16:19: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 1vZFDo-0001DJ-4k for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:44 -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 1vZFDm-0003Up-M1 for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:39 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 39FB45BCC4; Fri, 26 Dec 2025 21:19:37 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2FF143EA63; Fri, 26 Dec 2025 21:19: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 2F1QOOf7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783977; 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=ws1VQpTNPQlwQt5+bAweu+kVb8iQHqA8cUAIMBvExFA=; b=DFk4Z+0hRrkH9QghGsYJjkYLTqVZ+VTlKKpnqJvgNJ0vgaOaDhBXDl0mnJQy6tAv+5tTSC 5q8ciCCyUHRZAnbBfpF2/+eJ+6R7OKHf3sRat5HUyCCA8sjCsL6ZEuuJ+mjy0EeCc4No+q xlRO6oiLm2OYLiZg1WSRfkBk8UhcnZw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783977; 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=ws1VQpTNPQlwQt5+bAweu+kVb8iQHqA8cUAIMBvExFA=; b=OqcEYMYX7vK4KXyY9rtwrM+hAXoprjAozNuAl6CFoSUsvtAvU/1Bnl+CMW29BJ+BwKqKqV LhFJxM+qhVKue/DA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783977; 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=ws1VQpTNPQlwQt5+bAweu+kVb8iQHqA8cUAIMBvExFA=; b=DFk4Z+0hRrkH9QghGsYJjkYLTqVZ+VTlKKpnqJvgNJ0vgaOaDhBXDl0mnJQy6tAv+5tTSC 5q8ciCCyUHRZAnbBfpF2/+eJ+6R7OKHf3sRat5HUyCCA8sjCsL6ZEuuJ+mjy0EeCc4No+q xlRO6oiLm2OYLiZg1WSRfkBk8UhcnZw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783977; 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=ws1VQpTNPQlwQt5+bAweu+kVb8iQHqA8cUAIMBvExFA=; b=OqcEYMYX7vK4KXyY9rtwrM+hAXoprjAozNuAl6CFoSUsvtAvU/1Bnl+CMW29BJ+BwKqKqV LhFJxM+qhVKue/DA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 02/25] migration: Fix state change at migration_channel_process_incoming Date: Fri, 26 Dec 2025 18:19:04 -0300 Message-ID: <20251226211930.27565-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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.977]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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,imap1.dmz-prg2.suse.org:helo]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784028451158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 Wed Jan 7 09:26:21 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=1766784187; cv=none; d=zohomail.com; s=zohoarc; b=F4HbDBsToPIhN3aDb/sUd5kqXHXnQ64FwloMDKLKL+DDlJApxXMDJMPdJjKH+I5bSwGOWcqoGLensRRTymc+slgilHH+JQnIF6bmBgwfkuwxPcWRVxfykZXxGrPtc8G0PDnOV9D6E3GNadBYxfF4qC8VKfs7H6/tWVBfZI2dOKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784187; 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=4V5ewCNgJujiDbPtywT+kgNqorZmKMkIaCdHu6ewMs4=; b=ATPfjFAKSoKWAn/nIXwWpJJwUQkX0PnSvnLr6+28CPPGn9DvMhqJmv+N6f4+DsBTdjo3m/Ocy5gg+s+ueeEvbI7Js65OZTPrWut7g60YKP6QYu5cLuzJsFaEnB6EB/kmOLPLujKAshuSvAFWeZzLN1ZzV4ytDjaxKwLD/A0vEqY= 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 1766784187126387.93309806083323; Fri, 26 Dec 2025 13:23:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFE0-0001H8-Gz; Fri, 26 Dec 2025 16:19: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 1vZFDt-0001F6-Rm for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:48 -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 1vZFDs-0003ZQ-CA for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:45 -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 CFAA95BCCB; Fri, 26 Dec 2025 21:19:38 +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 C743D3EA63; Fri, 26 Dec 2025 21:19: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 yMiYIen7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783978; 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=4V5ewCNgJujiDbPtywT+kgNqorZmKMkIaCdHu6ewMs4=; b=z08urxJ57XAViVGEWOIGzSOnSn19v/BZ2tW18pDch9gPUTwN11p1sETSzIqZ4AC8j+TGLc yXwssbHwWgWXsxulXA0HgJDvs1a6iLLL6sDWp0KlcJypvUGo5+mX4amvh4Z5jilAemBgQD thdL2E1j4FhjF9ReI5nkplLHgG+a2b4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783978; 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=4V5ewCNgJujiDbPtywT+kgNqorZmKMkIaCdHu6ewMs4=; b=unXtKC5i/B+3daFDEPQ4coSvmbocv8sONgPnA4NjaGw08LmL55Gw1+qJBdD721gqx/gTgz yZnuLnCFVjwVFyAg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783978; 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=4V5ewCNgJujiDbPtywT+kgNqorZmKMkIaCdHu6ewMs4=; b=z08urxJ57XAViVGEWOIGzSOnSn19v/BZ2tW18pDch9gPUTwN11p1sETSzIqZ4AC8j+TGLc yXwssbHwWgWXsxulXA0HgJDvs1a6iLLL6sDWp0KlcJypvUGo5+mX4amvh4Z5jilAemBgQD thdL2E1j4FhjF9ReI5nkplLHgG+a2b4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783978; 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=4V5ewCNgJujiDbPtywT+kgNqorZmKMkIaCdHu6ewMs4=; b=unXtKC5i/B+3daFDEPQ4coSvmbocv8sONgPnA4NjaGw08LmL55Gw1+qJBdD721gqx/gTgz yZnuLnCFVjwVFyAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 03/25] migration/tls: Remove unused parameter Date: Fri, 26 Dec 2025 18:19:05 -0300 Message-ID: <20251226211930.27565-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.982]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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: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: 1766784189009158500 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()") Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 Wed Jan 7 09:26:21 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=1766784089; cv=none; d=zohomail.com; s=zohoarc; b=MliJZ7N55P4miZljIsDcyBHnb456xeFm0WAj0FaZRot8t+xYqAZn0wTIXCJgpZxf07r7DFPFLEAcC9OwQUPdpxjLm8v/dPLLPCvEHLYYxUbGQuZNe1SgsAqWkn+Fthdm4+Y64+5jrRb1ZxYeH4KZSIpe6tS+oNOC9i3RrKVHG0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784089; 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=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=; b=bCVTXVG0r7NKUsKqtjJMk9AEE3lCf96KElANPQKjJTEE7mYA5waTPPHf0xVZo5tOFfEmLnxzSzUseiloF2KMzEjMd/plec6AZVcv6ocNmLrTIpGR/xXzvCwaEBW49H3pTQAYmmfx9H9AZxjbnrLUGJMtYx7SER+WHVZZuOJSabo= 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 1766784089837781.7139539335504; Fri, 26 Dec 2025 13:21:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFE5-0001Ip-S2; Fri, 26 Dec 2025 16:19: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 1vZFDz-0001G4-LS for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:51 -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 1vZFDy-0003fg-7h for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:51 -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 68CEE5BCCD; Fri, 26 Dec 2025 21:19:40 +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 5FE193EA63; Fri, 26 Dec 2025 21:19:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cO1TCOv7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783981; 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=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=; b=IdqFcZr5+MPiPCj3VF4GetVymenoy3xda7zRqDSQinQp7V9TYtuKSFIrXoS1bP6GyVu/Mg WHIk9bR3RIx2WzhWm4WIhAZtJ5+Tzv0RRrHR+O1TqWyZrdvPigvTzh1YLt6G/w/Fcunc5r 5NBoJlacMBHKx+zmRLlsk1dxVlv36Ak= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783981; 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=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=; b=AgPrkurx0ai7MdeK7XX7jSJhBAXX+nIp4NK6jhTPz0ARmT/QgoFTop6puPCJurlcEyfX1V JmXa/o99I6KeMnCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=FSHdoXdW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=rYUldyIs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783980; 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=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=; b=FSHdoXdWE5tlwxyJeYbVKc3QhRYk1ZWNPKI1RF5YqiLpwpEAaURBGGoaO5llE3t/sRJD1r 5zp3WbUCRsKq5wF43k5O7RDKmmdqr+mskUYxGvyBqELJJTXvJzE8AeuhW/lppy0B92lHej 4YV+7DInzS7NiUni3YNWqHRbkoJlj2k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783980; 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=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=; b=rYUldyIslehrZlqLuVMqHA6hf0OOINny/BkwISjZeS4Pm3IXXOaxkYSIa+mGzHpHeUlcrm HC82OMoXyLFdQfDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 04/25] migration: Move multifd_recv_setup call Date: Fri, 26 Dec 2025 18:19:06 -0300 Message-ID: <20251226211930.27565-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 68CEE5BCCD X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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) (identity @suse.de) X-ZM-MESSAGEID: 1766784090632158500 Content-Type: text/plain; charset="utf-8" The multifd_recv_setup() call is currently in a place where it will be called for every channel that appears. That doesn't make much sense. It seems it was moved when the channel discovery mechanism was added back at commit 6720c2b327 (migration: check magic value for deciding the mapping of channels, 2022-12-20). The original place was migration_incoming_setup() which would run for just the main channel, but it was discovered that the main channel might arrive after a multifd channel. Move the call back to a place where it will be called only once. With respect to cleanup, this new location at qemu_start_incoming_migration() has the same issue as the previous callsite at migration_ioc_process_incoming(): no cleanup ever happens. The error message goes from being emitted via error_report_err(), to being returned to the qmp_migrate_incoming() incoming command, which is arguably better, since this is setup code. Signed-off-by: Fabiano Rosas --- migration/migration.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 71efe945f6..974313944c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -786,6 +786,10 @@ static void qemu_start_incoming_migration(const char *= uri, bool has_channels, return; } =20 + if (multifd_recv_setup(errp) !=3D 0) { + 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 || @@ -1065,10 +1069,6 @@ 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); --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784194; cv=none; d=zohomail.com; s=zohoarc; b=jgEsQ9W0c8se+nH14udxL7ozHjUbxvjoCAQ6oGM0Fhfp6/8uTwEo6epDgRK09Rfm3r/sjxKcMJVtzUF59AFzxyB2Sc4Twrx0y2LJfZYKinx+VocOnom+Sxc0SeyrGAg0NgMqn8YppNpLDmiROZgU6by0wAEwuXJbEQpoqHeHIgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784194; 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=2YgGzfWRlh8AzeKqv4K3JJnSw8VRFbkS7JbdISke0Po=; b=WZeHp+2cEh0j/6L0soLpGqQ3RsOBHs1jn6LgtSZf45LjxM9y/1OrlILSPup3tSDiikBd5LXW8b0VFlMvUGv7hfb7KxlWcyxrDtJjUS7PP/yxIVCYmtk0eGU1gn9iu7RkHt9yYJ+gI41ZoKgtZlG+yZ4tjoEbITCcmaPfNG0UIUE= 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 1766784194791439.14467471627177; Fri, 26 Dec 2025 13:23:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFE0-0001H9-Sv; Fri, 26 Dec 2025 16:19: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 1vZFDy-0001G3-Vp for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:51 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vZFDw-0003eI-RC for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:50 -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 2BB693368B; Fri, 26 Dec 2025 21:19:42 +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 1CF203EA65; Fri, 26 Dec 2025 21:19:40 +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 OCKfM+z7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783984; 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=2YgGzfWRlh8AzeKqv4K3JJnSw8VRFbkS7JbdISke0Po=; b=TV9GY/Xf/Q7j7PO4er8yPZZ4W8LbmYlDXJkBQsAketdM8t5T0Q/8gvz2K8zo1L04p3MOMs GyDxBHBDFFpEoyHFBNMVV66T/c49lrUuwz4ilFMpBwnUcaxqBglJfsluQvK7cMkdq5dnUq bnZbiPLDdzYAQPEgc7Ezc1eAzDrQk9c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783984; 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=2YgGzfWRlh8AzeKqv4K3JJnSw8VRFbkS7JbdISke0Po=; b=DEO96syhfPYoGB+zfseH173HlukwIGQkw1MFcY4FFRuewFxbbOVHNMWeTc7rYshTBuYScV 9ZwkWAEMm+/eN3Ag== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=JaugkQeI; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Zpuu4ZDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783982; 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=2YgGzfWRlh8AzeKqv4K3JJnSw8VRFbkS7JbdISke0Po=; b=JaugkQeICyCDLf6OpcfLaKZEJP0hPIID50i39N4cHl3YcNCuqYA/x1QVk9+ct/z0L/eKmX 7szJ/Cb7GhEz3d8P3QeJqNrKQ/m3o0qlZdM+Iz9V0UhDWeT3MrdqanldyCUiujW6Uek8Vu JRrZPdH6ZekXCObQyQ/TdOjcF9gISYA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783982; 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=2YgGzfWRlh8AzeKqv4K3JJnSw8VRFbkS7JbdISke0Po=; b=Zpuu4ZDBw+okHI+mLBsEpcUo0pw0Mdu6k3qgRGCr+TUeCF1mRGCwmzoZOKB1nSC7x5BGee wF2M4ezon/BCoECQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 05/25] migration: Cleanup TLS handshake hostname passing Date: Fri, 26 Dec 2025 18:19:07 -0300 Message-ID: <20251226211930.27565-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 2BB693368B 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) (identity @suse.de) X-ZM-MESSAGEID: 1766784195156158500 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()) Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- 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 3623ab9dab..03cb0d8d65 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 Wed Jan 7 09:26:21 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=1766784052; cv=none; d=zohomail.com; s=zohoarc; b=XS1KM3M7pWGFfErR48fgiCFSpkRW+iNe6Wmt5RvxmDMrrd3r/wFfiov5igykidv0rHLnmbnc2N9xf4XIcRux/mrIQ3jFpwxSPqmEIIbf4Hh2IlWIONdWktnYc7jMyEvA/T1p1qwYX48Mm/A0aC4fRjATCDbA/wABtEHLIAhaBQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784052; 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=BOcAqkAuhAmuQs4Pc4hz0xfBFtyvIAn0tePpQ1zREGg=; b=IgmIWnvhcbiiaJMMrreiTzR/nixw7z+bn4nDaOQ00Bl4WX3V+HDuDMxlYCH7Tb14rfSRghDNt/bN5aE73wJA5p0wOzkjMF/uBbunmeLmdyVb78s9kR7qlhL9iD5tQRQc7ZKSvA5pXeshmgYI6lELWC/OovuH79TVlx6Boddcfg8= 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 1766784052650868.7627420328736; Fri, 26 Dec 2025 13:20:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFE8-0001JO-Ig; Fri, 26 Dec 2025 16:20:01 -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 1vZFE5-0001IP-1c for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:57 -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 1vZFE3-0003iP-Cl for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:56 -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 B89475BCC4; Fri, 26 Dec 2025 21:19:43 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AD7163EA66; Fri, 26 Dec 2025 21:19:42 +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 4JW1Gu77TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783985; 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=BOcAqkAuhAmuQs4Pc4hz0xfBFtyvIAn0tePpQ1zREGg=; b=U+o5DfkNhi86okuiuv9CaefVBbXwb0UKmX4Fqs9EOVm5etpqbR0n5jdDoZXaraiAs5hPo/ aJF+6Kl8JCfeLZJZU5xZXY2/QWC4mCKQXgDoIGeFHolT2wvVXGH33IFScQmj4dJkT1BXQB x2degfJfURhNOEDy9glNy4zIDpsV9Fg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783985; 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=BOcAqkAuhAmuQs4Pc4hz0xfBFtyvIAn0tePpQ1zREGg=; b=j9Q4lugJpfLk0zP9KxvMQ/IhUAokGtdK2pvHP9JEO7kZn1wotoN+wpixEXVOX6XhOqotAf Py7BsuQTR556v+Cw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=CU5QfUiY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=gd601Ffq DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783983; 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=BOcAqkAuhAmuQs4Pc4hz0xfBFtyvIAn0tePpQ1zREGg=; b=CU5QfUiY5OxsAgyI6RQaM3gdS7gynqJrY4G63X9aZQ1175QIRgnZefserT0Rk96IxzEVT2 80uTDFv5otE5EnNUwBocXjhVrW0823ukyqjFZCUuaoVro0ZK3UoaiMDtP7n07G9L6OOGhD fcKUThWM/oPWNNtiYBMrSHoBRwzRA1k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783983; 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=BOcAqkAuhAmuQs4Pc4hz0xfBFtyvIAn0tePpQ1zREGg=; b=gd601FfqPZN4fgqiRa6ebA2WXt4grBiyvZOzZk+6y/fgkrPwjPH+CbTU0cPO0LL/2iZX+e 6gKlkzPs5VcywVAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 06/25] migration: Move postcopy_try_recover into migration_incoming_process Date: Fri, 26 Dec 2025 18:19:08 -0300 Message-ID: <20251226211930.27565-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: B89475BCC4 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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) (identity @suse.de) X-ZM-MESSAGEID: 1766784054566158500 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()) Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 974313944c..f2933f7789 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -947,12 +947,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) { @@ -986,12 +980,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 Wed Jan 7 09:26:21 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=1766784060; cv=none; d=zohomail.com; s=zohoarc; b=He4SzUusgHvgu54CWgfNoqqWiIK4Xl5TlFILOskfIEfYHsGg54s+s5Tr1rRHMiNVpTn5t+tslJWFcyfqmkR3B+I/jh7+yaV0HOa55zCn6J0IVwesnsBjvPQzKSFAd/q4mWO071T5vBuw/zqn4UdO31n+7EIRn14WCJCSHJUBzDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784060; 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=v8Q2rQICH1az6OWLPGfQWXBH6q1We2SfqSJbry/6fGM=; b=B+rC/Xf8S2jdKBTfzEx48afDdWw9uqmjKoAVwwIymmCnVjY3AClkvVN6mgHSkuy3QQdzy44FHWODWo55TZFtz91KqxPYc9WFXIedzSF78jL3q6a2h62bEVcq9uQa9LH1qpx3By8zFX26J5sd0eJfnJbbH+Qavn1rnrS5XF6MBmM= 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 1766784060641403.40947628355866; Fri, 26 Dec 2025 13:21:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEC-0001Nn-EU; Fri, 26 Dec 2025 16:20: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 1vZFEA-0001K0-LA for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:02 -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 1vZFE9-0003mp-5n for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20: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-out2.suse.de (Postfix) with ESMTPS id 516C05BCE1; Fri, 26 Dec 2025 21:19:45 +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 46E253EA63; Fri, 26 Dec 2025 21:19:44 +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 KCcdAvD7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783985; 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=v8Q2rQICH1az6OWLPGfQWXBH6q1We2SfqSJbry/6fGM=; b=pFd6Bya/oGxA/tl6RMzOnVsCv88Xcw2AVKb888rVNJPyZhHDBDXZiqX3r4Ix7oS9qx1V9R q7s7G5J5T4xRKDWBGPp1ZJeBuRxrhO7BHAcXAlKPjBwW/cbXkkat4K9/+cL+k6KaQTpiHz bwtiabn7hWwVfuvEd59JI2/4Yvs3hNk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783985; 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=v8Q2rQICH1az6OWLPGfQWXBH6q1We2SfqSJbry/6fGM=; b=VPW6IC56CzJucB1B3pTZUiKKHdhLPpLniFQg0SU8xYleTSmhDMqTZQposxZsuFLJ1Xb5e7 ZA2gicJj8dmiV4DQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783985; 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=v8Q2rQICH1az6OWLPGfQWXBH6q1We2SfqSJbry/6fGM=; b=pFd6Bya/oGxA/tl6RMzOnVsCv88Xcw2AVKb888rVNJPyZhHDBDXZiqX3r4Ix7oS9qx1V9R q7s7G5J5T4xRKDWBGPp1ZJeBuRxrhO7BHAcXAlKPjBwW/cbXkkat4K9/+cL+k6KaQTpiHz bwtiabn7hWwVfuvEd59JI2/4Yvs3hNk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783985; 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=v8Q2rQICH1az6OWLPGfQWXBH6q1We2SfqSJbry/6fGM=; b=VPW6IC56CzJucB1B3pTZUiKKHdhLPpLniFQg0SU8xYleTSmhDMqTZQposxZsuFLJ1Xb5e7 ZA2gicJj8dmiV4DQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 07/25] migration: Use migrate_mode() to query for cpr-transfer Date: Fri, 26 Dec 2025 18:19:09 -0300 Message-ID: <20251226211930.27565-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.981]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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: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: 1766784062634158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f2933f7789..4b1afcab24 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2252,7 +2252,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 +2277,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 --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784161; cv=none; d=zohomail.com; s=zohoarc; b=ceZa8xsrYG0EMlCH7axl6vGSLgll5rAo/DtL8/lQL8SOzZ8P+beYo/xKuNkI5giYcY+22Z2NJ4/qFl4wGrUXyFCu6mgeWRerKhqywFdbgsCO+J8B32EN6fZpWKPtC5c3NdHU3JSsNlDD9vjhEhnlL56Wszp7wEsiUgQUhdRYWKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784161; 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=tSahG4mmiJEfSqy0FxSwFr034hSj4sJZWVFPM3kd81o=; b=JBZkVsMNe99nAoPiqKeeySy3qvO/83GOc8qAcEFQTiYL0RApd0pUMJADDxVHZhhyHhcvPk0Pws2vG7LVSxPeB1iYVPJd6UTNPY6K5m8jUjNTNdeDKFiQMprOV+ogmOcTiCFX10rKsCxJujJeYOJEKpKsHPFtVWlDzCJP9XkUbkQ= 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 1766784161005882.3619194374824; Fri, 26 Dec 2025 13:22:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFE7-0001J8-Sp; Fri, 26 Dec 2025 16:19: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 1vZFE4-0001II-9s for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:56 -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 1vZFE2-0003ht-UE for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19: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 DC720336A8; Fri, 26 Dec 2025 21:19:46 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D46423EA63; Fri, 26 Dec 2025 21:19:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GMTRJPH7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783986; 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=tSahG4mmiJEfSqy0FxSwFr034hSj4sJZWVFPM3kd81o=; b=CyUlMLJ2sUZs+IAmRzQUibtpILB/bkXv2j9OxPraBnAQ+z5H9o/86SlsxbMVbYtXStbSF5 PMP6WotTIY0V2qEhQ6bXgWdgZTqxsb09bZEM4dMViUUDOl84pJsC/p5w9bPM/B94ioblbC EfiuvAB9xSfet+1PR2W0SxRnLByap/g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783986; 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=tSahG4mmiJEfSqy0FxSwFr034hSj4sJZWVFPM3kd81o=; b=Rf8yV/ZqAzalpXCLQQsm/5E8Veydp8cxJAcLGZonk9B6TvBWAtcHnokka84V7aybOdagWl 8Fv+8GAwptYlxACA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783986; 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=tSahG4mmiJEfSqy0FxSwFr034hSj4sJZWVFPM3kd81o=; b=CyUlMLJ2sUZs+IAmRzQUibtpILB/bkXv2j9OxPraBnAQ+z5H9o/86SlsxbMVbYtXStbSF5 PMP6WotTIY0V2qEhQ6bXgWdgZTqxsb09bZEM4dMViUUDOl84pJsC/p5w9bPM/B94ioblbC EfiuvAB9xSfet+1PR2W0SxRnLByap/g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783986; 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=tSahG4mmiJEfSqy0FxSwFr034hSj4sJZWVFPM3kd81o=; b=Rf8yV/ZqAzalpXCLQQsm/5E8Veydp8cxJAcLGZonk9B6TvBWAtcHnokka84V7aybOdagWl 8Fv+8GAwptYlxACA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 08/25] migration: Free the error earlier in the resume case Date: Fri, 26 Dec 2025 18:19:10 -0300 Message-ID: <20251226211930.27565-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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.982]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; URIBL_BLOCKED(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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: 1766784162888158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4b1afcab24..a56f8fb05e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2088,6 +2088,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; } @@ -4016,13 +4023,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 Wed Jan 7 09:26:21 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=1766784054; cv=none; d=zohomail.com; s=zohoarc; b=KjtrDmOw06U1yV0Zby8UIIgkyXcIPSibC3tD8dnl31hqHp+cXivjCR5dcwKrg8sMG7ioLRQV/AIFxEm8qlBCfmt+8KL5rlNQ4lmO83kWWzlEgE/1xjigJkZctWq58ruFX/qOfmS9IjAPw7bIzxUkQoDGPTyoqDEUWlxN26ca6IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784054; 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=iSfg6fj1BGzF/CndAbhCOMUK0MIKIg2sHcFH7KCBgIg=; b=HUJxEkpwcPsfhfdGzwxoZhzbqHyTaEmWC+i335acagjSU/rIZki1HeX7N0QmVj0ST7ITSkSXQryV/aA99M1wpugGy3AqM6f1xb64mTCQ6KHodzGSHa/nYqtYpMdahGi9TGJbgHWTanJ+eGEI+sHLc6irhclmjUfBZDm8rFVtTmc= 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 176678405445271.02423144306874; Fri, 26 Dec 2025 13:20:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEI-0001Qd-9E; Fri, 26 Dec 2025 16:20:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEF-0001Px-UA for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:07 -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 1vZFEE-00042F-Et for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:07 -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 769705BCCB; Fri, 26 Dec 2025 21:19:48 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6D28C3EA63; Fri, 26 Dec 2025 21:19:47 +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 kDGXC/P7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783989; 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=iSfg6fj1BGzF/CndAbhCOMUK0MIKIg2sHcFH7KCBgIg=; b=mikkdq5RQbd4TUNwoGwJK8kHqT/f+j5R9vS9qJsqlKsrgQAH+5QllpVljTrT851Y2+YOD6 R7BNyXE2+MCTP9C4af4mNWoc1eFYiUDB0HXPO3QJu13ic/vzx4XVBjirF43VEDXdEl5naC Ca1nRjMiddFE7m6LAjAW+Q1Hz3U2wAo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783989; 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=iSfg6fj1BGzF/CndAbhCOMUK0MIKIg2sHcFH7KCBgIg=; b=1WyFcX3uUGbDJtyI/i4qZpVuT5V77VjsTy/DpnWSfDY3yeJmdjgRGbdsHxPms6dN5y9up3 4G9XG/jit07MZSAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=TSFrzKig; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=6ea8dy1X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783988; 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=iSfg6fj1BGzF/CndAbhCOMUK0MIKIg2sHcFH7KCBgIg=; b=TSFrzKigWhIDlcFoEHmoYM0ODOQU48s9t0j6U+J3sHC5y1yv+1QeNeMkZqIAy41/Z/VODq SCANF44MObSeTx+vhhrmm7jb/EhDPJep1ugANp0VUpoydgMRYCgFgSf72Hc+HaR/m+zW31 B1sSAD7sV98mtk5FlOM8lmjsp/1aOZ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783988; 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=iSfg6fj1BGzF/CndAbhCOMUK0MIKIg2sHcFH7KCBgIg=; b=6ea8dy1XqjYZHRecAWEbzTxK0u69XPQYpxgWTkc7nYDbLib4pgIb+cU2ZE6GXN3LQyN428 oB4DUz0crnqGSuDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 09/25] migration: Move error reporting out of migration_cleanup Date: Fri, 26 Dec 2025 18:19:11 -0300 Message-ID: <20251226211930.27565-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 769705BCCB 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) (identity @suse.de) X-ZM-MESSAGEID: 1766784056587158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a56f8fb05e..83854d084a 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(s, 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 /* @@ -4026,18 +4027,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 @@ -4118,6 +4113,9 @@ fail: } 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 Wed Jan 7 09:26:21 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=1766784055; cv=none; d=zohomail.com; s=zohoarc; b=F0DFn2GxqR7QkW5VXJb5+qe2LZogCVX0wOqoqjmrBJo3JhygYQ3hefqsJUrbUKiUz/gIGGmKuM5w8nY3bHJi5aU8o369hmM2mF0+W0ewYt7w6yykVzMKp9LvVXd+J39+uMJZ2UjrO1HikfRYQqryYXvXaqTHub4IrVhRbHP2YDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784055; 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=r6feVrZedvuia2CRgWiWkzfS/88hHiX+QYNAlOrNJFI=; b=G2cLPBC+4ydE2QsKJ27j3yibiQcMWG/KJIs4C+y6ZfWm91/2xTOdxGY71GoUn0MIgUCKv7ydviosoVKUdM8eUv2qcPj4lRoDrBRlUMhJFR8zh2b0UXE6Gev0dkwBPc53QB+h5xDSstco+rrOJZsaOybMXyOzWIWLpTB2ORAjAkk= 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 1766784055535841.5482693813764; Fri, 26 Dec 2025 13:20:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFES-0001Ri-GV; Fri, 26 Dec 2025 16:20: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 1vZFEL-0001R7-Ko for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:14 -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 1vZFEK-00045c-4j for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:13 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 110225BCE4; Fri, 26 Dec 2025 21:19:50 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 071AD3EA65; Fri, 26 Dec 2025 21:19:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MAIOLvT7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783990; 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=r6feVrZedvuia2CRgWiWkzfS/88hHiX+QYNAlOrNJFI=; b=wPatnqmYU5wCBdvbTaAHQNPJDLryktjV1tYFLzgZoETG36uHh8lBKKfmPMWn3ZwbVJDT9P 9KMplYG6XZih68j4+v5EJQSxdi1c+IMBfNv2iJ5E5JwI5aMjxY8p+xn+fxZjr2X9oKnWCy 9YxTJlmgxTpMRC8ZgOqV6Tdcle+mhEk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783990; 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=r6feVrZedvuia2CRgWiWkzfS/88hHiX+QYNAlOrNJFI=; b=kZ8R3u0mEdU35Dnaj7MPyrmJhJXGADghGUn0o6kha66jMinfbCM1JFVfuAEv+kywwwYv5E vk6wgrVEO7fE2jDw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=wPatnqmY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=kZ8R3u0m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783990; 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=r6feVrZedvuia2CRgWiWkzfS/88hHiX+QYNAlOrNJFI=; b=wPatnqmYU5wCBdvbTaAHQNPJDLryktjV1tYFLzgZoETG36uHh8lBKKfmPMWn3ZwbVJDT9P 9KMplYG6XZih68j4+v5EJQSxdi1c+IMBfNv2iJ5E5JwI5aMjxY8p+xn+fxZjr2X9oKnWCy 9YxTJlmgxTpMRC8ZgOqV6Tdcle+mhEk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783990; 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=r6feVrZedvuia2CRgWiWkzfS/88hHiX+QYNAlOrNJFI=; b=kZ8R3u0mEdU35Dnaj7MPyrmJhJXGADghGUn0o6kha66jMinfbCM1JFVfuAEv+kywwwYv5E vk6wgrVEO7fE2jDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 10/25] migration: Expand migration_connect_error_propagate to cover cancelling Date: Fri, 26 Dec 2025 18:19:12 -0300 Message-ID: <20251226211930.27565-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 110225BCE4 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784056507158500 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) Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 83854d084a..e1c00867ab 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 @@ -4107,11 +4117,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); - } - error_report_err(local_err); + 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 Wed Jan 7 09:26:21 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=1766784097; cv=none; d=zohomail.com; s=zohoarc; b=FKRXO8O+zGuf+jbwBrvXhNvoBFvKePBfw0LZ4x1pSp9ulyyGgCulj0ZRh2+2EBS/VCWT/aRJdxj43MkU6G+rBek9mCQ8xbxGXMTyDGlQIhnySmjgmkkYKbbQGk6Re9JyRVovYV4gkhWhnLzdL1m6b0HZbUdJT/JP81cFECQgyhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784097; 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=7r6/NdIrXQWN/TYypsd1QV8a5Q9F/V/0J5HYKXLPdEY=; b=W1zvsSVlyRtpjKzEwZk3VnD/rv5H9IULRNsj+cAemJdkEPQ28Tn1De40zipi/mymyIoU0nBmrkdk0vP4U5VelvLjYkZx5Q74r4NateJaLWnyTMziStQVIbB4vvmdzjhw1DtA7frqbIkMBaUXukx8PuqaLkNLW0msVuWDCMbYDO8= 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 1766784097024108.25492648581803; Fri, 26 Dec 2025 13:21:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEY-0001WV-Ck; Fri, 26 Dec 2025 16:20:26 -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 1vZFES-0001SB-KU for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20: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 1vZFEQ-00047g-Ih for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:20 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A2E8C5BCCD; Fri, 26 Dec 2025 21:19: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 9556C3EA63; Fri, 26 Dec 2025 21:19:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yJpBFfb7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783991; 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=7r6/NdIrXQWN/TYypsd1QV8a5Q9F/V/0J5HYKXLPdEY=; b=isaXeDl8I5B/sZIWnSIHhoINp6OSH4UAhRinAODbsQYnkURoWeFFua564bLXIOwQB3Sp/j 4aWoVMNmEatVO5sCr5xfP8O8EgW5MfpvQn4wdENg5b6+32s8xsogLKWhxNGTNUjD8ceEIk 9LnRo3uvHM5hWQGp8Uxv55jhYTyjNoo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783991; 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=7r6/NdIrXQWN/TYypsd1QV8a5Q9F/V/0J5HYKXLPdEY=; b=aCtRPeRFnw8MubedDH0nLXTqHCkqd0u6AllxCDajHxPZ0kRm1jbLQ81tAi/4dtbMfP7kHr X4RYieYh9BUFbgAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=isaXeDl8; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=aCtRPeRF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783991; 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=7r6/NdIrXQWN/TYypsd1QV8a5Q9F/V/0J5HYKXLPdEY=; b=isaXeDl8I5B/sZIWnSIHhoINp6OSH4UAhRinAODbsQYnkURoWeFFua564bLXIOwQB3Sp/j 4aWoVMNmEatVO5sCr5xfP8O8EgW5MfpvQn4wdENg5b6+32s8xsogLKWhxNGTNUjD8ceEIk 9LnRo3uvHM5hWQGp8Uxv55jhYTyjNoo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783991; 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=7r6/NdIrXQWN/TYypsd1QV8a5Q9F/V/0J5HYKXLPdEY=; b=aCtRPeRFnw8MubedDH0nLXTqHCkqd0u6AllxCDajHxPZ0kRm1jbLQ81tAi/4dtbMfP7kHr X4RYieYh9BUFbgAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 11/25] migration: yank: Move register instance earlier Date: Fri, 26 Dec 2025 18:19:13 -0300 Message-ID: <20251226211930.27565-12-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: A2E8C5BCCD 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: 1766784098737158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index e1c00867ab..0f1644b276 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2181,11 +2181,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) @@ -2210,7 +2211,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()); @@ -2222,7 +2223,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; @@ -2275,8 +2275,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; } @@ -2300,28 +2299,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 || @@ -2344,9 +2337,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 Wed Jan 7 09:26:21 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=1766784101; cv=none; d=zohomail.com; s=zohoarc; b=mObGf1ETLhs8OZ2mi47RF38pBtPYbEqmSqPgwHDMmj9ArEI7CRa6bHkBgoFC4OdbKQZeEKgLej4RGuj/qSbID+CQbMurcjeDPSUrASXf2wmqZmQuMweFzG3oj5UUIKGpEplCY5eweoR2IGgsBB5IvPSio9KAGhVMTKJ9TIemkA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784101; 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=CpioNFBDFseAudiqE/+vF5sojicQMZ0mCcG2JfPLxZM=; b=mWGtML/qWe5LPg67YknQvy/R9p+ax8MCX/4ymX95tXemPsevQZOmm5nSTA6e2g9mV/sn+xb4Gl0Yp0AGx2M1hSv9BOaJmwX15LQYVj5ouGo6Z3b6v+qorlhk6R4bzQHTkHs2MVu6AUtqxEb7n3uEDc6uc/lQzMgSblTWVAcuMmQ= 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 1766784101602389.99288316834793; Fri, 26 Dec 2025 13:21:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEb-0001Zt-Bu; Fri, 26 Dec 2025 16:20:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEY-0001Wn-6V for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:26 -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 1vZFEW-00049C-HC for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:25 -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 3CDF55BCE5; Fri, 26 Dec 2025 21:19:53 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3403E3EA63; Fri, 26 Dec 2025 21:19: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 CIIZOff7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783993; 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=CpioNFBDFseAudiqE/+vF5sojicQMZ0mCcG2JfPLxZM=; b=MWoKprGX8cqXJ518tBywc/9qIEEWzUcWjvBEuTcKZGIVQXkwJ3oq+0ouw28B1scUK31FTR 0YlDVpeGgG8/zfJk51d+ZeZi0RA/A0gxl1peiV+gC7LpOuUZXWzyhpE5tRPIace4qGjfbk WF0jhYGRk+cCudO9Ka0lYunbv0HpslM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783993; 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=CpioNFBDFseAudiqE/+vF5sojicQMZ0mCcG2JfPLxZM=; b=bdLwD60T8DjKTOTRPswePsoQ5Y6u/Cc8uvCApbnLX1b1tXfjEwHC2NX7NfTrxLClm3SICx m0I/KPb81lnzw6Bg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783993; 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=CpioNFBDFseAudiqE/+vF5sojicQMZ0mCcG2JfPLxZM=; b=MWoKprGX8cqXJ518tBywc/9qIEEWzUcWjvBEuTcKZGIVQXkwJ3oq+0ouw28B1scUK31FTR 0YlDVpeGgG8/zfJk51d+ZeZi0RA/A0gxl1peiV+gC7LpOuUZXWzyhpE5tRPIace4qGjfbk WF0jhYGRk+cCudO9Ka0lYunbv0HpslM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783993; 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=CpioNFBDFseAudiqE/+vF5sojicQMZ0mCcG2JfPLxZM=; b=bdLwD60T8DjKTOTRPswePsoQ5Y6u/Cc8uvCApbnLX1b1tXfjEwHC2NX7NfTrxLClm3SICx m0I/KPb81lnzw6Bg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 12/25] migration: Fold migration_cleanup() into migration_connect_error_propagate() Date: Fri, 26 Dec 2025 18:19:14 -0300 Message-ID: <20251226211930.27565-13-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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.984]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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,imap1.dmz-prg2.suse.org:helo]; URIBL_BLOCKED(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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: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: 1766784102747158500 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0f1644b276..a66b2d7aaf 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) @@ -2209,12 +2219,19 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *c= hannel, GIOCondition cond, void *opaque) { + MigrationState *s =3D migrate_get_current(); MigrationAddress *addr =3D opaque; + Error *local_err =3D NULL; + + qmp_migrate_finish(addr, &local_err); + + if (local_err) { + migration_connect_error_propagate(s, local_err); + } =20 - qmp_migrate_finish(addr, NULL); =20 cpr_state_close(); - migrate_hup_delete(migrate_get_current()); + migrate_hup_delete(s); qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } @@ -2223,7 +2240,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; @@ -2280,6 +2296,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; } @@ -2299,12 +2322,11 @@ void qmp_migrate(const char *uri, bool has_channels, QAPI_CLONE(MigrationAddress, addr)); =20 } else { - qmp_migrate_finish(addr, errp); + qmp_migrate_finish(addr, &local_err); } =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); } @@ -2335,12 +2357,6 @@ static void qmp_migrate_finish(MigrationAddress *add= r, Error **errp) } else { error_setg(&local_err, "uri is not a valid migration protocol"); } - - if (local_err) { - migration_connect_error_propagate(s, error_copy(local_err)); - error_propagate(errp, local_err); - return; - } } =20 void qmp_migrate_cancel(Error **errp) @@ -4027,9 +4043,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)); } @@ -4108,7 +4121,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 Wed Jan 7 09:26:21 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=1766784025; cv=none; d=zohomail.com; s=zohoarc; b=DpNq3eSZZmPhEmejPw6vTAH4o1doThvXy4zRF9+1KUbImJ6BbSC8pblLQX1wsMKIN5GuxFB3JX9boU3DzEprpupVuet6NlUDlupaMi08fWChrB/3XqJk/EamF+C6djMijfEpFxTtY6k50nOh22vmAeFKo1o8HQ+GZvOFy3s7MFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784025; 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=4BzbGqFwFOK2ajQx/33sVvImDxmocIbV7q3s/xH1rJI=; b=Q2tQT0BYbAvygST8bCeqGPAzm+brJiLHXqN+tAHagTMzWtyALdRgm3rCebgZzGGXFdT2o+bLhSqq1S7hkmMWAADBfiN6ovCtE7/Yz8pcHhi9nvV+7tq0BiJfqU0AqWfdoLtMkOaa+FgjcwnAMWF1S01TYgeiXQJ/5WEZgIc2uX4= 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 1766784025772484.0918354272533; Fri, 26 Dec 2025 13:20:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEB-0001KU-8n; Fri, 26 Dec 2025 16:20:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEA-0001Jz-Jw for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:02 -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 1vZFE8-0003mV-Fa for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20: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 3A2D7336AB; Fri, 26 Dec 2025 21:19:55 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E71F73EA63; Fri, 26 Dec 2025 21:19: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 WFlNKfn7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783995; 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=4BzbGqFwFOK2ajQx/33sVvImDxmocIbV7q3s/xH1rJI=; b=LMzODdlNg0VfOcP2/TRu6FSYIZNSHB6bZlvZ07Kz9CZkjIOZkFGnwtqtI22OzYAGHNJdB2 U+zBCpSCLtYJ/5hMDuZIbVzm3AQVbC7+QALj4cL5Jb7cK7RxllTBNJ1STgxGpxWEgNa+CA XTZvgVe5XLyhR/sdc3PuTCZ98W0qTY0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783995; 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=4BzbGqFwFOK2ajQx/33sVvImDxmocIbV7q3s/xH1rJI=; b=ECkITQoABLbGdPtl93YjSe3s4dg/CYXJzbaul4+VUs+4TsanumN5jD21L/bmUx5Rgj0YSx FLLHAa8+PSk/kADg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783995; 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=4BzbGqFwFOK2ajQx/33sVvImDxmocIbV7q3s/xH1rJI=; b=LMzODdlNg0VfOcP2/TRu6FSYIZNSHB6bZlvZ07Kz9CZkjIOZkFGnwtqtI22OzYAGHNJdB2 U+zBCpSCLtYJ/5hMDuZIbVzm3AQVbC7+QALj4cL5Jb7cK7RxllTBNJ1STgxGpxWEgNa+CA XTZvgVe5XLyhR/sdc3PuTCZ98W0qTY0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783995; 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=4BzbGqFwFOK2ajQx/33sVvImDxmocIbV7q3s/xH1rJI=; b=ECkITQoABLbGdPtl93YjSe3s4dg/CYXJzbaul4+VUs+4TsanumN5jD21L/bmUx5Rgj0YSx FLLHAa8+PSk/kADg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Li Zhijian Subject: [RFC PATCH 13/25] migration: Handle error in the early async paths Date: Fri, 26 Dec 2025 18:19:15 -0300 Message-ID: <20251226211930.27565-14-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[imap1.dmz-prg2.suse.org:helo,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)[3]; 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: 1766784027587158500 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 achive 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 46 +++++++++++++++++------------------------- 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 | 19 ++++++++--------- migration/tls.h | 4 +--- migration/trace-events | 2 +- 12 files changed, 49 insertions(+), 65 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index ba14f66d85..7243b99108 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,38 +60,30 @@ 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)) { + migration_tls_channel_connect(s, ioc); =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); - } + /* + * 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 a66b2d7aaf..5c6c76f110 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; @@ -4033,7 +4033,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; @@ -4041,13 +4041,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 4d42e8f9a7..f340cd518d 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -532,10 +532,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(MigrationState *s, MigrationEventType type, Error **errp); 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..a54e8e6e14 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,14 +130,14 @@ 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, - Error **errp) +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc) { QIOChannelTLS *tioc; + Error *local_err =3D NULL; =20 - tioc =3D migration_tls_client_create(ioc, errp); + tioc =3D migration_tls_client_create(ioc, &local_err); if (!tioc) { + migration_connect_error_propagate(s, local_err); return; } =20 diff --git a/migration/tls.h b/migration/tls.h index 7cd9c76013..7399c42edf 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -29,9 +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, - Error **errp); +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc); 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 Wed Jan 7 09:26:21 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=1766784080; cv=none; d=zohomail.com; s=zohoarc; b=CrEi8i6d1K+ZhmoIx1C3zG1CmLEJLl5+qMSZNL64qWM7D3z4PGuo1/sTOc63MRg6r+8cqct0bAzF5yB3ZpCGcdac+yULx9q6y6w5D+z7H3HOZ+tTz5aCVO4TBh3H/wyC5DrKwYddw31B1x4JrDS9uGR9x79m9t3bGK4nob+KHHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784080; 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=7EjOJVRn+KNW3Hro0z0DceSzxWOMd1iQUeK8vxjomCk=; b=Q5p0olNIceiOySNGLba1tW85ctK+ZBS8cvkv8bzTPBvMtU+FW2yhMVt2mSNpBxsU3dqWc9vhJ6huGhla394Q9A7gTpzebwcWssM1Vr/GhrbWLI7J9xW6Oed4SqjwpnLwuNSCtJ2sP0E8GgoCrgFH1YH4NJ/hJLqLisqlSy6UGow= 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 1766784080831557.3508559199042; Fri, 26 Dec 2025 13:21:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEJ-0001Qh-0x; Fri, 26 Dec 2025 16:20:11 -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 1vZFEH-0001QE-Ff for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:09 -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 1vZFEF-00042s-5W for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20: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 2725D336A8; Fri, 26 Dec 2025 21:19:57 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CF65E3EA63; Fri, 26 Dec 2025 21:19: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 ANiBI/v7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783997; 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=7EjOJVRn+KNW3Hro0z0DceSzxWOMd1iQUeK8vxjomCk=; b=w25SP+2nOZyMHsKD47XbFNPraeNf8guPbC8u125Yc/xQWsOs2/VmCRSpoPwDBYEBPTnNoc DMuBq29KHhj2cm15h9esmM6S2fEoUEu0hKvUdXkTrMFuNImpCFMUdZdUweP0J23iKy+oxr Hr3Ogt06fk/RxedhzuGAwnIHUb/1QVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783997; 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=7EjOJVRn+KNW3Hro0z0DceSzxWOMd1iQUeK8vxjomCk=; b=OD1xqjTLDhIUALKyciGW2L2sJ1zauzUtn10NQVlZ+GH4JgTjWIDkvWUNYXlAFP6ThcwtpR 882T+Br4lvqrEsDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783997; 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=7EjOJVRn+KNW3Hro0z0DceSzxWOMd1iQUeK8vxjomCk=; b=w25SP+2nOZyMHsKD47XbFNPraeNf8guPbC8u125Yc/xQWsOs2/VmCRSpoPwDBYEBPTnNoc DMuBq29KHhj2cm15h9esmM6S2fEoUEu0hKvUdXkTrMFuNImpCFMUdZdUweP0J23iKy+oxr Hr3Ogt06fk/RxedhzuGAwnIHUb/1QVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783997; 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=7EjOJVRn+KNW3Hro0z0DceSzxWOMd1iQUeK8vxjomCk=; b=OD1xqjTLDhIUALKyciGW2L2sJ1zauzUtn10NQVlZ+GH4JgTjWIDkvWUNYXlAFP6ThcwtpR 882T+Br4lvqrEsDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Li Zhijian Subject: [RFC PATCH 14/25] migration: Remove QEMUFile from channel.c Date: Fri, 26 Dec 2025 18:19:16 -0300 Message-ID: <20251226211930.27565-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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.988]; 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,imap1.dmz-prg2.suse.org:helo]; 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)[3]; 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.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784082623158500 Content-Type: text/plain; charset="utf-8" Make channel.c deal only with QIOChannel objects. Move any handling of QEMUFile into migration.c. To achieve this in a clean way: 1) Define a migration_outgoing_setup, analogous to migration_incoming_setup, responsible for creating the QEMUFile from the QIOChannel. 2) Increase the scope of migration_incoming_setup to create not only the main channel, but all the others as well. That is currently being done at migration_ioc_process, so move the code. 3) Adjust RDMA code to pass in the QIOChannel and remove some of the usage of QEMUFile. Signed-off-by: Fabiano Rosas --- migration/channel.c | 21 ++++++----- migration/migration.c | 88 ++++++++++++++++++++++--------------------- migration/migration.h | 6 ++- migration/multifd.c | 7 ++-- migration/multifd.h | 2 +- migration/rdma.c | 28 ++++---------- 6 files changed, 73 insertions(+), 79 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 7243b99108..af6c2cc76e 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" @@ -34,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))); @@ -42,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= ); @@ -75,14 +82,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 5c6c76f110..677581b5a5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -92,7 +92,7 @@ enum mig_rp_message_type { }; =20 /* Migration channel types */ -enum { CH_MAIN, CH_MULTIFD, CH_POSTCOPY }; +enum { CH_NONE, CH_MAIN, CH_MULTIFD, CH_POSTCOPY }; =20 /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add @@ -934,17 +934,48 @@ 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); + 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 */ @@ -990,12 +1021,6 @@ void migration_incoming_process(void) qemu_coroutine_enter(co); } =20 -void migration_fd_process_incoming(QEMUFile *f) -{ - migration_incoming_setup(f); - migration_incoming_process(); -} - static bool migration_has_main_and_multifd_channels(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -1012,12 +1037,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(); - Error *local_err =3D NULL; - QEMUFile *f; - uint8_t channel; + uint8_t channel =3D CH_NONE; uint32_t channel_magic =3D 0; int ret =3D 0; =20 @@ -1036,7 +1059,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, = Error **errp) ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, sizeof(channel_magic), errp); if (ret !=3D 0) { - return; + goto out; } =20 channel_magic =3D be32_to_cpu(channel_magic); @@ -1051,7 +1074,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, = Error **errp) channel =3D CH_MAIN; } else { error_setg(errp, "unknown channel magic: %u", channel_magi= c); - return; } } else if (mis->from_src_file && migrate_multifd()) { /* @@ -1063,33 +1085,13 @@ 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; } - - 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()) { - migration_incoming_process(); - } +out: + return channel; } =20 /** diff --git a/migration/migration.h b/migration/migration.h index f340cd518d..d2b82cf54f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -526,8 +526,10 @@ 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_outgoing_setup(QIOChannel *ioc); +bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); + +uint8_t migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); =20 bool migration_has_all_channels(void); diff --git a/migration/multifd.c b/migration/multifd.c index 3fb1a07ba9..c6639dbab5 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,5 @@ 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); diff --git a/migration/rdma.c b/migration/rdma.c index 596a1aba0b..7bee871e2b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -384,7 +384,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdmain; RDMAContext *rdmaout; - QEMUFile *file; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -3836,32 +3835,20 @@ 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_ioc(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; - - return rioc->file; -} - -static QEMUFile *rdma_new_output(RDMAContext *rdma) -{ - QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); - - 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 +3862,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_ioc(rdma); + if (!ioc) { 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, 0, NULL); + migration_incoming_process(); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, @@ -3995,8 +3983,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_ioc(rdma)); migration_connect(s); return; return_path_err: --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784155; cv=none; d=zohomail.com; s=zohoarc; b=Pc3XxgGFRDyVEvGAmNGMramLtD//LjStd1/Z6N/fxaaqLphyV62tD9CjoyrAezySLftcU8JS7gYeUt3Tk6GaHiRri0KWN42qBspolBMP2nPINBI5tS64yQbt4YRmnoYyCjjltoN7DUdaqiCy48bCmoHFZNyez8phlobeTbBH+EE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784155; 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=QhGRNPkF1+egiR0KOqIYosDJslHerNW+xet+FuzqMfM=; b=mL/GK540C3KxJlI8U/MfTUCgSduWyOkxdo1a5YhvOLnocRt7nNocrU2SZ3V4oSIjM+XHp8CAj10DUKHn9rbGLqcNomWHnvhFxOcwNuiwO961qRThwqyqyWqDTKBsnqTNcMWBBAo20u39XeS/Xsf5cav0QIyhuYhsopxAPXyLU9o= 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 1766784155454559.6412047440839; Fri, 26 Dec 2025 13:22:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEe-0001az-W9; Fri, 26 Dec 2025 16:20:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEe-0001ad-2B for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:32 -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 1vZFEc-0004Cs-Ef for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:31 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C82095BCC4; Fri, 26 Dec 2025 21:19: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 C039F3EA63; Fri, 26 Dec 2025 21:19: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 YJ6gH/37TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783998; 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=QhGRNPkF1+egiR0KOqIYosDJslHerNW+xet+FuzqMfM=; b=bISc1R0SLGKLAfN4uuKy0pjiQ17MY0r0DMZV9XmgzzsvQAD/9PK0ZNdmRw9V31rIgY3kw4 MKdKvjojfbrJ5cb/FNxBJJFAMiZJAuQSLkZH+faItHxv9bjqltmdgaWCaH6/tKhMtPzfMU HyUrAWXMzJkdCtCaAqvAmZkfDiuCwfA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783998; 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=QhGRNPkF1+egiR0KOqIYosDJslHerNW+xet+FuzqMfM=; b=tINoYoIkpFvHJRa9EUUeS7uuCDsenQe2bGVKBHMcy5mN5tURE2JEblFQTDToOxFr8Uq9gu 5SLURP6Zw1SZ8yAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766783998; 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=QhGRNPkF1+egiR0KOqIYosDJslHerNW+xet+FuzqMfM=; b=bISc1R0SLGKLAfN4uuKy0pjiQ17MY0r0DMZV9XmgzzsvQAD/9PK0ZNdmRw9V31rIgY3kw4 MKdKvjojfbrJ5cb/FNxBJJFAMiZJAuQSLkZH+faItHxv9bjqltmdgaWCaH6/tKhMtPzfMU HyUrAWXMzJkdCtCaAqvAmZkfDiuCwfA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766783998; 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=QhGRNPkF1+egiR0KOqIYosDJslHerNW+xet+FuzqMfM=; b=tINoYoIkpFvHJRa9EUUeS7uuCDsenQe2bGVKBHMcy5mN5tURE2JEblFQTDToOxFr8Uq9gu 5SLURP6Zw1SZ8yAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 15/25] migration/channel: Rename migration_channel_connect Date: Fri, 26 Dec 2025 18:19:17 -0300 Message-ID: <20251226211930.27565-16-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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.978]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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,imap1.dmz-prg2.suse.org:helo]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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: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: 1766784156852158500 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 af6c2cc76e..a8a5f26dfd 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 ccfeaaef18..7d3457271d 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -20,7 +20,7 @@ =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 a54e8e6e14..f68e6a533b 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 Wed Jan 7 09:26:21 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=1766784086; cv=none; d=zohomail.com; s=zohoarc; b=SFT9Wju9xaKJ3ZnozBr5aD/IsrQ0af7uCk8bL7P9bit2paTzO24JzUVez9o2FF2mvCtOhpGaa+JpI34ghuOf/cIAcDe18kpolg+hdmBluBqnh4LWvRKXNawYDWkxV/GeqooaUhIMGL+XU1zHCg1htL1yh3+/RmGKD0TPyhmZu7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784086; 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=r+glmBz45/FMvz4YCDjkir+ba9qWnBiUKPl3F+smdj4=; b=E5qVv/MMObMO1dQGmU+LX5RU7m9P4IWr3UDrwnELjPYw3U/7MV5e5AxML3lOXE2b947gr5EEhIoKRrXpewzY/xk6OQArL60UV2fWBFF0zXo4ZIO/qJBoItKGnfoQeEkQO0B1PKTGg6kan0inPmG+VkCNFcr3FML+thvE5271vI0= 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 1766784086257494.32988970088365; Fri, 26 Dec 2025 13:21:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEm-0001c9-CE; Fri, 26 Dec 2025 16:20:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEk-0001bu-Gg for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:38 -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 1vZFEi-0004F3-0h for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:38 -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 CEDAE5BCE8; Fri, 26 Dec 2025 21:20:00 +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 8518B3EA63; Fri, 26 Dec 2025 21:19:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wPplEf/7TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:19:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784000; 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=r+glmBz45/FMvz4YCDjkir+ba9qWnBiUKPl3F+smdj4=; b=p9Hvtszm0iRKdOLMrFqAVxisXIaemzvpzKouCB7uktoT2G9DzFgtkZiB/eXsvZm+5q4LF0 M16N1x/YtaI+IG3Kf9usir2V4F9hDsrNtkDb4Jro86xP2jpksvSWYDo5cZeTmmDugljkNt GH06RPVRsgbLzchzvMcaLfwq/shyFA8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784000; 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=r+glmBz45/FMvz4YCDjkir+ba9qWnBiUKPl3F+smdj4=; b=tLPU56aOIiaYRYf98bZ/21iJNorOgN60XNclqVlvOPPUnQgn2Y4om2iZWpvlDWtfYCPIY6 CYLgS28RAIUkDsDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784000; 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=r+glmBz45/FMvz4YCDjkir+ba9qWnBiUKPl3F+smdj4=; b=p9Hvtszm0iRKdOLMrFqAVxisXIaemzvpzKouCB7uktoT2G9DzFgtkZiB/eXsvZm+5q4LF0 M16N1x/YtaI+IG3Kf9usir2V4F9hDsrNtkDb4Jro86xP2jpksvSWYDo5cZeTmmDugljkNt GH06RPVRsgbLzchzvMcaLfwq/shyFA8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784000; 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=r+glmBz45/FMvz4YCDjkir+ba9qWnBiUKPl3F+smdj4=; b=tLPU56aOIiaYRYf98bZ/21iJNorOgN60XNclqVlvOPPUnQgn2Y4om2iZWpvlDWtfYCPIY6 CYLgS28RAIUkDsDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Li Zhijian Subject: [RFC PATCH 16/25] migration: Rename instances of start Date: Fri, 26 Dec 2025 18:19:18 -0300 Message-ID: <20251226211930.27565-17-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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,imap1.dmz-prg2.suse.org:helo]; 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)[3]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784086804158500 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 --- 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 | 5 +---- migration/rdma.c | 21 ++++++++++----------- migration/rdma.h | 6 +++--- migration/socket.c | 8 +++----- migration/socket.h | 6 +++--- migration/trace-events | 10 +++++----- 14 files changed, 57 insertions(+), 65 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index a8a5f26dfd..c5bd89576a 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: @@ -77,7 +77,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 677581b5a5..42adee5695 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -743,7 +743,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) { @@ -795,18 +795,18 @@ static void qemu_start_incoming_migration(const char = *uri, bool has_channels, if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_start_incoming_migration(saddr, errp); + socket_connect_incoming(saddr, errp); } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_start_incoming_migration(saddr->u.fd.str, errp); + fd_connect_incoming(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_incoming_migration(&addr->u.rdma, errp); + rdma_connect_incoming(&addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_incoming_migration(addr->u.exec.args, errp); + exec_connect_incoming(addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_start_incoming_migration(&addr->u.file, errp); + file_connect_incoming(&addr->u.file, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1011,7 +1011,7 @@ static bool postcopy_try_recover(void) return false; } =20 -void migration_incoming_process(void) +void migration_start_incoming(void) { if (postcopy_try_recover()) { return; @@ -1970,7 +1970,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); @@ -2017,7 +2017,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) @@ -2344,18 +2344,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"); } @@ -4035,7 +4035,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 d2b82cf54f..cbe90471c2 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -529,16 +529,13 @@ void migrate_set_state(MigrationStatus *state, Migrat= ionStatus old_state, void migration_outgoing_setup(QIOChannel *ioc); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); =20 -uint8_t migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); -void migration_incoming_process(void); - 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); +void migration_start_outgoing(MigrationState *s, QEMUFile *file); =20 int migration_call_notifiers(MigrationState *s, MigrationEventType type, Error **errp); diff --git a/migration/rdma.c b/migration/rdma.c index 7bee871e2b..788120a0b1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3871,17 +3871,16 @@ static void rdma_accept_incoming_migration(void *op= aque) =20 rdma->migration_started_on_destination =3D 1; migration_incoming_setup(ioc, 0, 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()) { @@ -3899,7 +3898,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 @@ -3908,7 +3907,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); @@ -3923,8 +3922,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; @@ -3948,7 +3947,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) { @@ -3981,11 +3980,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_ioc(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 Wed Jan 7 09:26:21 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=1766784071; cv=none; d=zohomail.com; s=zohoarc; b=JCo3ol88oeY/Q8sQ832e/5kRdbkMbETuLPsZW927JCXT8byjAUXLZD+RAiAZNe3Ti4P86yO6qB9GQR9K1X5vBGypAZrLpBgVJAl7XGaMag4n3yvVICmeMtVgpRj/tDUtiv/qSKdLVKxwRvk6qWVOOSVMS8see/l9J2P1bIAeQWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784071; 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=9ZJOtMOEZAVo7vbMwFj3ucTsVaUW3dpHV0sKC1MhhQI=; b=FHAQnFrvn/vfxnsZMSsXClG5SFOA61dGrB4UzIM+6b70YYLiWnzJ0M60p0AsTb09t/BlnlxOjwvhctWGBmd9UiPSt5XCgdunBcJTwxYy3f5zWH+n2+hJ7reeh4ouqoujAcaJWa3k2nCuyznnBP+Uz1NCIc9kfcgtwKZA+W9GJEw= 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 1766784071477542.9753098007787; Fri, 26 Dec 2025 13:21:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEt-0001lk-Db; Fri, 26 Dec 2025 16:20:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEq-0001ch-Or for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:44 -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 1vZFEo-0004I1-KC for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:44 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B1FF35BCE1; Fri, 26 Dec 2025 21:20: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 6C0023EA63; Fri, 26 Dec 2025 21:20: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 SGpRCwH8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784003; 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=9ZJOtMOEZAVo7vbMwFj3ucTsVaUW3dpHV0sKC1MhhQI=; b=zciHotFpdrmLqF+38DwGCXcx+CEmIrFQ+4cRVi5Qg5QfN1bV8sVeDnglmKuO/jbUmgrpRr cXAJtP1TTUpzetvz66UyheJOw8gmtr57HFzbne5v5nbSUMIVTGDy+5OPECb6HyNHMCF/Jf 5GDWQJm1AN28IAGm0GSJJwsbOCmOdAo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784003; 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=9ZJOtMOEZAVo7vbMwFj3ucTsVaUW3dpHV0sKC1MhhQI=; b=P79Zuds//NMxrOIrhiM1FGkDQs4zk5keWab9dvBB6INhMRaxn0yzAN2OaMCCzrET8BMbXR FqLVYq/hN2c3OzDw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=cq6JbR+b; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=GOP6ckQZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784002; 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=9ZJOtMOEZAVo7vbMwFj3ucTsVaUW3dpHV0sKC1MhhQI=; b=cq6JbR+bu6nrexpHv65Yr6XWYR9pEONa59Vekqw7m8S/c/TcMB3yvjHheogvYky//veNqH FPrXoDNYdSUntOk23DEemCq6LQJ3Fo0qlz+CNsAy/h4U5tWCW7deeDFr8quTMW3BGcxOuz NieGrjLx/mV0Gvxvz39E3mDBxgr4F+U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784002; 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=9ZJOtMOEZAVo7vbMwFj3ucTsVaUW3dpHV0sKC1MhhQI=; b=GOP6ckQZO+0nemFs+hdHFjhMiwA3qBeJWU/sRX4t1nvGS09+qvztHvVN9hbYWtIuwOB3zJ LxTJCmrLtXx9uvAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Li Zhijian Subject: [RFC PATCH 17/25] migration: Move channel code to channel.c Date: Fri, 26 Dec 2025 18:19:19 -0300 Message-ID: <20251226211930.27565-18-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; 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)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: B1FF35BCE1 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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) (identity @suse.de) X-ZM-MESSAGEID: 1766784072771158500 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 --- migration/channel.c | 99 ++++++++++++++++++++++++++++++++++++++++++- migration/channel.h | 12 ++++++ migration/migration.c | 98 ------------------------------------------ migration/migration.h | 5 +-- migration/rdma.c | 1 + 5 files changed, 113 insertions(+), 102 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index c5bd89576a..a9ac3711b5 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 7d3457271d..59d169e095 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -18,6 +18,14 @@ =20 #include "io/channel.h" =20 +/* Migration channel types */ +enum { + CH_NONE, + CH_MAIN, + CH_MULTIFD, + CH_POSTCOPY +}; + void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc= ); @@ -26,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 42adee5695..e0aee17317 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_NONE, 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 */ @@ -934,8 +931,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(); @@ -1021,99 +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 cbe90471c2..138831d7d9 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -529,13 +529,12 @@ void migrate_set_state(MigrationStatus *state, Migrat= ionStatus old_state, void migration_outgoing_setup(QIOChannel *ioc); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); =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); =20 -void migration_start_outgoing(MigrationState *s, QEMUFile *file); +void migration_start_outgoing(MigrationState *s); +void migration_start_incoming(void); =20 int migration_call_notifiers(MigrationState *s, MigrationEventType type, Error **errp); diff --git a/migration/rdma.c b/migration/rdma.c index 788120a0b1..6e9ca5f5f6 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -17,6 +17,7 @@ #include "qemu/osdep.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 Wed Jan 7 09:26:21 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=1766784160; cv=none; d=zohomail.com; s=zohoarc; b=hzlH1WNY3gWrDMlnq1a13RPanMIyoV4npT+L38gnVnDZA++aRiZjTQuB/BjbszTAkMZf8tR4KTJsdakV/1rfxi3Q+8V4HLlC5Vg3Qdx9CmA2bHjjFhPVyeHoEZdBtzhNGHXv7lq5HZ2ZQSMumu09qh5GXuxvvkkaWGvYqz9WMMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784160; 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=NwBWQAOlWWAwfAr8E79zLNObl5hWx2bTa1SjZ/6nAOU=; b=Khub4f9DxXodZfjJs+7iNRBJrXvsDWdaubcDaFQa6lnlTiJ+QTjuotnowvSJouC3QdXOQCYn0V4vAaa3N8qtdT2DKS+X47SPOujWFywTExYDwpl3AK63dK5aQWLroima/4nE4fLH5zb61P8sd3BE8Bd2YbX6WMZmKSDiVbtu4Mg= 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 1766784160728221.89217550024114; Fri, 26 Dec 2025 13:22:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEy-0002MQ-0J; Fri, 26 Dec 2025 16:20: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 1vZFEw-00026q-8b for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:50 -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 1vZFEu-0004Jb-BG for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:49 -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 5106B5BCED; Fri, 26 Dec 2025 21:20: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 487CF3EA65; Fri, 26 Dec 2025 21:20: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 QF+QAgP8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784004; 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=NwBWQAOlWWAwfAr8E79zLNObl5hWx2bTa1SjZ/6nAOU=; b=zQzYxS9N8RAxDs2g5dCl79q79fJ51Eckd7IL3kowCRjhkOKJnbt1cSKzdtlL5ehEOUmfe1 v1N/YF/PNgnAgzcdvOxNuz7Lh8XpOsOpcxQl5D5hrdVZ4kkGAyyQpK2r2vEQ0eaH5XPiTY oo3SpVK6qLqEYKcPyPuBkre9BhUyzkQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784004; 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=NwBWQAOlWWAwfAr8E79zLNObl5hWx2bTa1SjZ/6nAOU=; b=26SSICtPj2mOOHZ37MKuRoCV7O6qhdYMa7f/0VgwcJee/eygdSmo1hoHQv7cDLj5KLoD2N t/HRIZ0l+RxnoPDQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=zQzYxS9N; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=26SSICtP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784004; 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=NwBWQAOlWWAwfAr8E79zLNObl5hWx2bTa1SjZ/6nAOU=; b=zQzYxS9N8RAxDs2g5dCl79q79fJ51Eckd7IL3kowCRjhkOKJnbt1cSKzdtlL5ehEOUmfe1 v1N/YF/PNgnAgzcdvOxNuz7Lh8XpOsOpcxQl5D5hrdVZ4kkGAyyQpK2r2vEQ0eaH5XPiTY oo3SpVK6qLqEYKcPyPuBkre9BhUyzkQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784004; 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=NwBWQAOlWWAwfAr8E79zLNObl5hWx2bTa1SjZ/6nAOU=; b=26SSICtPj2mOOHZ37MKuRoCV7O6qhdYMa7f/0VgwcJee/eygdSmo1hoHQv7cDLj5KLoD2N t/HRIZ0l+RxnoPDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 18/25] migration: Move transport connection code into channel.c Date: Fri, 26 Dec 2025 18:19:20 -0300 Message-ID: <20251226211930.27565-19-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 5106B5BCED 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784160969158500 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 --- migration/channel.c | 66 +++++++++++++++++++++++++++++++++++++++---- migration/channel.h | 4 +++ migration/migration.c | 45 ++--------------------------- 3 files changed, 67 insertions(+), 48 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index a9ac3711b5..a06aa8189c 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 e0aee17317..9e69141e86 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" @@ -787,26 +784,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(); @@ -2241,26 +2219,7 @@ static void qmp_migrate_finish(MigrationAddress *add= r, 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 void qmp_migrate_cancel(Error **errp) --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784126; cv=none; d=zohomail.com; s=zohoarc; b=j2dJY9AuhEuNlbZIOySrf1VAepWzH0zRyeOVFKT9S5/Ot8mHhMvn4I94DWRmFS4C2FPeIIU4TrB5MAGwKhA1d+YVf6IcKkZID0kQT0mMkJSKL7iS90X9n9KhtbyiUtlruN5WcyrcO1abh6+lG5w/xgMYbb7nkRg85jzNJBM5IIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784126; 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=+i/DLae2OO2ZVdC7i6O7sLm4eKDHTytV8OmukLC/6es=; b=Gn0YDSphDwgYDJhBjVU+ajlsd4yVoGSmBrOiHu8AgyqdDZkl4+6+Mkb54T/ZTgR0zr7CgurqM2KSsFrBhOuG6Pl/AUo9ryW3ocqzBeVwgegGXO6Pz6nVdV5jpTZjCnbabzdyEVLk8LdWd4SAKZy8A0g50hnRWoXDaHry5YGt+HU= 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 17667841263171013.1429601893711; Fri, 26 Dec 2025 13:22:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEU-0001Sf-Qw; Fri, 26 Dec 2025 16:20:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEO-0001RU-SP for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:18 -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 1vZFEL-00047E-P0 for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:16 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 583163368B; Fri, 26 Dec 2025 21:20: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 067583EA63; Fri, 26 Dec 2025 21:20: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 6Lv3LAT8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784006; 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=+i/DLae2OO2ZVdC7i6O7sLm4eKDHTytV8OmukLC/6es=; b=Rp9O1F40umf/taLwpX775TNvuXgfQhKViJODeCyZWL6VVDzmbImfUtlj0Bu3VeEqZnETY1 gLnn6u/aBfFtUB0vnumytSl1ayyC5Npag/p93A1GGXQGc71HnUBH49BOnF+UqfluZRbLIW wz0aMgtVIhmqmGCCQvVKqc0R31UCqBQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784006; 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=+i/DLae2OO2ZVdC7i6O7sLm4eKDHTytV8OmukLC/6es=; b=4BLrPMqcJDGlxK8hu9e0ypCvORqSKdz/bfZ7FTAEsPwa549qAET7QXtKATi2M3VyrZHBX9 lpALMmtEIrmWUHCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784006; 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=+i/DLae2OO2ZVdC7i6O7sLm4eKDHTytV8OmukLC/6es=; b=Rp9O1F40umf/taLwpX775TNvuXgfQhKViJODeCyZWL6VVDzmbImfUtlj0Bu3VeEqZnETY1 gLnn6u/aBfFtUB0vnumytSl1ayyC5Npag/p93A1GGXQGc71HnUBH49BOnF+UqfluZRbLIW wz0aMgtVIhmqmGCCQvVKqc0R31UCqBQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784006; 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=+i/DLae2OO2ZVdC7i6O7sLm4eKDHTytV8OmukLC/6es=; b=4BLrPMqcJDGlxK8hu9e0ypCvORqSKdz/bfZ7FTAEsPwa549qAET7QXtKATi2M3VyrZHBX9 lpALMmtEIrmWUHCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Li Zhijian Subject: [RFC PATCH 19/25] migration/channel: Make synchronous calls evident Date: Fri, 26 Dec 2025 18:19:21 -0300 Message-ID: <20251226211930.27565-20-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; 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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784126918158500 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 migration_connect_outgoing() 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 --- migration/channel.c | 30 +++++++++++++++++++++++++----- migration/channel.h | 2 +- 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/migration.c | 3 +-- migration/rdma.c | 11 +++++------ migration/rdma.h | 4 ++-- 11 files changed, 67 insertions(+), 39 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index a06aa8189c..205f8a26d1 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -31,29 +31,43 @@ #include "trace.h" #include "yank_functions.h" =20 -void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, +bool 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 true; } 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) { + return false; + } + + migration_channel_connect_outgoing(s, ioc); + return true; } =20 void migration_connect_incoming(MigrationAddress *addr, Error **errp) @@ -78,6 +92,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/channel.h b/migration/channel.h index 727eabf16c..4851179ae6 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -39,7 +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, +bool migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, Error **errp); void migration_connect_incoming(MigrationAddress *addr, Error **errp); #endif 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/migration.c b/migration/migration.c index 9e69141e86..c75c2c7e52 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2217,9 +2217,8 @@ out: static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) { MigrationState *s =3D migrate_get_current(); - Error *local_err =3D NULL; =20 - migration_connect_outgoing(s, addr, &local_err); + migration_connect_outgoing(s, addr, errp); } =20 void qmp_migrate_cancel(Error **errp) diff --git a/migration/rdma.c b/migration/rdma.c index 6e9ca5f5f6..3db3a89bdb 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3923,8 +3923,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; @@ -3934,7 +3934,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); @@ -3984,12 +3984,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_ioc(rdma)); - migration_start_outgoing(s); - return; + return rdma_new_ioc(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 From nobody Wed Jan 7 09:26:21 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=1766784105; cv=none; d=zohomail.com; s=zohoarc; b=L9OivLtdhuX/UcpxuH+w/mh3nfQqDl68Flqc3WplTm1zN6XYxwJIXp9vXzEIf1G8HKBGjmht6p95ZJTl8r3wMuIPuCrbpBuxnlrCcXyymBcMDz5a3wQGT90l7YEIl6EBAzNXqZC6SDLsFiFkgv5BKsN8t1Rg0Q2LWeMAPTVo/ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784105; 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=75a4TyoA3rRR37hGhXR6deLXcglP7r0pSbFa+frOItI=; b=WMiMXE3A1zRxoLeui9hAVtukurpRMOyJht/tCo7xZaUDc5ZL0PjZ1U0JrWP5Upao0LaxmHynEFipff4z6NfoIY0IAzBm1+xU8IVq1C2p2FL/ZRPRprGoNQkgX58H/Vu/VtddYaCbU4ooyFge39AjvTrTdX3nIKq66xesjRTjYns= 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 1766784105047610.1079449326814; Fri, 26 Dec 2025 13:21:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFF3-0002kO-7f; Fri, 26 Dec 2025 16:20: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 1vZFF1-0002cw-Nw for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:55 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vZFF0-0004Jz-3z for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:55 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DD3875BCCB; Fri, 26 Dec 2025 21:20:07 +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 D1E953EA63; Fri, 26 Dec 2025 21:20: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 qFwOJAb8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784007; 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=75a4TyoA3rRR37hGhXR6deLXcglP7r0pSbFa+frOItI=; b=VOWiZMJRTJ/QQD4lTTUtLEKhDFQ+1w5Tv233R9wxldOhiE5Z/jk8f88ytchc2EUaLqHzjp xXnolaCYNRxhBBV43/ahUowmiOSTNdAt43IvzIRupbjoDA+EkAnqFTw93BXtwyB6VCWgN2 r+88aj7TGmvfFbiqZ7U4tHjf9+v+tB0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784007; 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=75a4TyoA3rRR37hGhXR6deLXcglP7r0pSbFa+frOItI=; b=TL2uwRy+6yBxNyBF88aiPF37aGage8FhTOjnDJgT5JqAuu2voEgHD3pAN3uRJcCZkG7T7P gelAMHkFUkTX/bDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=VOWiZMJR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=TL2uwRy+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784007; 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=75a4TyoA3rRR37hGhXR6deLXcglP7r0pSbFa+frOItI=; b=VOWiZMJRTJ/QQD4lTTUtLEKhDFQ+1w5Tv233R9wxldOhiE5Z/jk8f88ytchc2EUaLqHzjp xXnolaCYNRxhBBV43/ahUowmiOSTNdAt43IvzIRupbjoDA+EkAnqFTw93BXtwyB6VCWgN2 r+88aj7TGmvfFbiqZ7U4tHjf9+v+tB0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784007; 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=75a4TyoA3rRR37hGhXR6deLXcglP7r0pSbFa+frOItI=; b=TL2uwRy+6yBxNyBF88aiPF37aGage8FhTOjnDJgT5JqAuu2voEgHD3pAN3uRJcCZkG7T7P gelAMHkFUkTX/bDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 20/25] migration/channel: Use switch statements in outgoing code Date: Fri, 26 Dec 2025 18:19:22 -0300 Message-ID: <20251226211930.27565-21-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: DD3875BCCB X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784106709158500 Content-Type: text/plain; charset="utf-8" Make this code easier on the eyes and remove all the visual clutter. There will be more lines added here in next patches. Signed-off-by: Fabiano Rosas --- migration/channel.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 205f8a26d1..2f33cb2653 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -35,31 +35,49 @@ bool migration_connect_outgoing(MigrationState *s, Migr= ationAddress *addr, Error **errp) { g_autoptr(QIOChannel) ioc =3D NULL; + SocketAddress *saddr; =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) { + switch (addr->transport) { + case MIGRATION_ADDRESS_TYPE_SOCKET: + saddr =3D &addr->u.socket; + + switch (saddr->type) { + case SOCKET_ADDRESS_TYPE_INET: + case SOCKET_ADDRESS_TYPE_UNIX: + case SOCKET_ADDRESS_TYPE_VSOCK: socket_connect_outgoing(s, saddr, errp); /* * async: after the socket is connected, calls * migration_channel_connect_outgoing() directly. */ return true; - } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + break; + case SOCKET_ADDRESS_TYPE_FD: ioc =3D fd_connect_outgoing(s, saddr->u.fd.str, errp); + break; + default: + g_assert_not_reached(); } + + break; + #ifdef CONFIG_RDMA - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + case MIGRATION_ADDRESS_TYPE_RDMA: ioc =3D rdma_connect_outgoing(s, &addr->u.rdma, errp); + break; #endif - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + + case MIGRATION_ADDRESS_TYPE_EXEC: ioc =3D exec_connect_outgoing(s, addr->u.exec.args, errp); - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + break; + + case MIGRATION_ADDRESS_TYPE_FILE: ioc =3D file_connect_outgoing(s, &addr->u.file, errp); - } else { + break; + + default: error_setg(errp, "uri is not a valid migration protocol"); + break; } =20 if (!ioc) { --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784105; cv=none; d=zohomail.com; s=zohoarc; b=ZigeSiaNgWJjbRQBN7Ai4G87uCyJHWzAQ2lkEv85hi1nakgAeTTO56nRO9QNkAmna0W07cUNlSEpY0+KVSeplh8tQfIqagLRwE4TaEoIvnbvlwkcoeankWxJTHSSwCnEsljhBJFMYINBe7NyFaObFRUrNyvl2W6dzTU0HnPIZvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784105; 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=jflGzj1VlA3/aYurEwO1N3ZJH8+WAr4qnfdqpovhE/c=; b=cPjVD3hvLTC8kHpmBvlW0tl3E+05VZ6mJ9qkThTk5w5Yju/s3NdYxqVOr35Y1TkJ8NriGW6uk7fjMouXSoaApovXeWNL/SN6EiV1zK9UYQWKBYZrkItQy32uAbqbDGNvpLUh5Au8ig8gSC4fneBJm73L8Dc0mR+W7o5HQvJvllM= 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 1766784105318861.3992647885327; Fri, 26 Dec 2025 13:21:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFF9-0003BS-Pj; Fri, 26 Dec 2025 16:21:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFF8-00036C-4R for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:21:02 -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 1vZFF5-0004Kb-EW for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:21: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 E907B5BCE9; Fri, 26 Dec 2025 21:20:09 +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 9F7793EA63; Fri, 26 Dec 2025 21:20: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 WOzfFwj8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784011; 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=jflGzj1VlA3/aYurEwO1N3ZJH8+WAr4qnfdqpovhE/c=; b=tBNSfkeb7nMpeW2CvuwDIAB0GMiEY3cCst7ndSQiO+YFAmI5+9y+jG9vDRKDqpzZqQdSND fipq4azF6C3AoWb2V9Z/efyZwlmyEj12acxfvVxpHxOVLsG+ipwrdxchSijaixibzNCadi yL3NbO6rHojvZYDNXhbXjolMoA91Bso= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784011; 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=jflGzj1VlA3/aYurEwO1N3ZJH8+WAr4qnfdqpovhE/c=; b=wOMLW15WA6kcaOPsfRO3gWJFn+YNLY/0jtdRt1yys/83UyjULM+senVuiYPmc7yE5jL7gH h2Ikn7iONuSN4zCA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=H2AV6mwA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=vvRvfmei DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784009; 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=jflGzj1VlA3/aYurEwO1N3ZJH8+WAr4qnfdqpovhE/c=; b=H2AV6mwA4fRxgZ68jTp7/ZR4dr6VdHbb5mwLpaXfWeRy2tloe14NgDlVwhin+YTV+ZlVQe YRpULoU7at0n/1Rg04tesIBWz/wvS04VXLgwyT2k/2iAiphq3Lmz3+NS2hMeVwwJoXC0U8 xV37agExkP5Gp11J8DUpOw2J9A2j6Xw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784009; 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=jflGzj1VlA3/aYurEwO1N3ZJH8+WAr4qnfdqpovhE/c=; b=vvRvfmeiTwsdmkzZsj/CB8ltSnFzWH/6JqG+5XLVcaYw08cdOJ6XfZwint3wSOkmvO3vH8 nlV8YMx9OjFajkDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Li Zhijian Subject: [RFC PATCH 21/25] migration/channel: Cleanup early passing of MigrationState Date: Fri, 26 Dec 2025 18:19:23 -0300 Message-ID: <20251226211930.27565-22-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; 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)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: E907B5BCE9 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) (identity @suse.de) X-ZM-MESSAGEID: 1766784106868158500 Content-Type: text/plain; charset="utf-8" MigrationState is being passed around quite a lot, but there are not many actual users. Reduce the passing around by converting some key functions to use migrate_get_current(). Although this goes against the general direction of not using migrate_get_current(), doing this helps to isolate the places that actually need MigrationState and could facilitate future cleanups. In the early connection code, qmp_migrate() needs MigrationState only to make sure it reaches: migrate_prepare() migrate_hup_add() migration_start_outgoing() migration_connect_error_propagate() The first two are at the top level, so are trivial to change. The last two actually require passing 's' around between several functions, making the code way more complex than it needs to be. Signed-off-by: Fabiano Rosas --- migration/channel.c | 21 +++++++++---------- migration/channel.h | 5 ++--- migration/exec.c | 3 +-- migration/exec.h | 3 +-- migration/fd.c | 3 +-- migration/fd.h | 3 +-- migration/file.c | 3 +-- migration/file.h | 3 +-- migration/migration.c | 49 +++++++++++++++++++++++-------------------- migration/migration.h | 4 ++-- migration/rdma.c | 5 ++--- migration/rdma.h | 3 +-- migration/socket.c | 32 +++++++--------------------- migration/socket.h | 3 +-- migration/tls.c | 11 +++++----- migration/tls.h | 2 +- 16 files changed, 63 insertions(+), 90 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 2f33cb2653..042e01b224 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -31,8 +31,7 @@ #include "trace.h" #include "yank_functions.h" =20 -bool migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, - Error **errp) +bool migration_connect_outgoing(MigrationAddress *addr, Error **errp) { g_autoptr(QIOChannel) ioc =3D NULL; SocketAddress *saddr; @@ -45,7 +44,7 @@ bool migration_connect_outgoing(MigrationState *s, Migrat= ionAddress *addr, case SOCKET_ADDRESS_TYPE_INET: case SOCKET_ADDRESS_TYPE_UNIX: case SOCKET_ADDRESS_TYPE_VSOCK: - socket_connect_outgoing(s, saddr, errp); + socket_connect_outgoing(saddr, errp); /* * async: after the socket is connected, calls * migration_channel_connect_outgoing() directly. @@ -53,7 +52,7 @@ bool migration_connect_outgoing(MigrationState *s, Migrat= ionAddress *addr, return true; break; case SOCKET_ADDRESS_TYPE_FD: - ioc =3D fd_connect_outgoing(s, saddr->u.fd.str, errp); + ioc =3D fd_connect_outgoing(saddr->u.fd.str, errp); break; default: g_assert_not_reached(); @@ -63,16 +62,16 @@ bool migration_connect_outgoing(MigrationState *s, Migr= ationAddress *addr, =20 #ifdef CONFIG_RDMA case MIGRATION_ADDRESS_TYPE_RDMA: - ioc =3D rdma_connect_outgoing(s, &addr->u.rdma, errp); + ioc =3D rdma_connect_outgoing(&addr->u.rdma, errp); break; #endif =20 case MIGRATION_ADDRESS_TYPE_EXEC: - ioc =3D exec_connect_outgoing(s, addr->u.exec.args, errp); + ioc =3D exec_connect_outgoing(addr->u.exec.args, errp); break; =20 case MIGRATION_ADDRESS_TYPE_FILE: - ioc =3D file_connect_outgoing(s, &addr->u.file, errp); + ioc =3D file_connect_outgoing(&addr->u.file, errp); break; =20 default: @@ -84,7 +83,7 @@ bool migration_connect_outgoing(MigrationState *s, Migrat= ionAddress *addr, return false; } =20 - migration_channel_connect_outgoing(s, ioc); + migration_channel_connect_outgoing(ioc); return true; } =20 @@ -252,12 +251,12 @@ out: } } =20 -void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc) +void migration_channel_connect_outgoing(QIOChannel *ioc) { trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc); + migration_tls_channel_connect(ioc); =20 /* * async: the above will call back to this function after @@ -268,7 +267,7 @@ void migration_channel_connect_outgoing(MigrationState = *s, QIOChannel *ioc) =20 migration_ioc_register_yank(ioc); migration_outgoing_setup(ioc); - migration_start_outgoing(s); + migration_start_outgoing(); } =20 =20 diff --git a/migration/channel.h b/migration/channel.h index 4851179ae6..8cf16bfda9 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -29,7 +29,7 @@ enum { =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 -void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc= ); +void migration_channel_connect_outgoing(QIOChannel *ioc); =20 int migration_channel_read_peek(QIOChannel *ioc, const char *buf, @@ -39,7 +39,6 @@ int migration_channel_read_peek(QIOChannel *ioc, bool migration_has_main_and_multifd_channels(void); bool migration_has_all_channels(void); =20 -bool migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, - Error **errp); +bool migration_connect_outgoing(MigrationAddress *addr, Error **errp); void migration_connect_incoming(MigrationAddress *addr, Error **errp); #endif diff --git a/migration/exec.c b/migration/exec.c index a1a7ede3b4..a62fc0d00b 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -40,8 +40,7 @@ const char *exec_get_cmd_path(void) } #endif =20 -QIOChannel *exec_connect_outgoing(MigrationState *s, strList *command, - Error **errp) +QIOChannel *exec_connect_outgoing(strList *command, Error **errp) { QIOChannel *ioc =3D NULL; g_auto(GStrv) argv =3D strv_from_str_list(command); diff --git a/migration/exec.h b/migration/exec.h index 3e39270dce..03c494b73c 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -27,6 +27,5 @@ const char *exec_get_cmd_path(void); #endif void exec_connect_incoming(strList *host_port, Error **errp); =20 -QIOChannel *exec_connect_outgoing(MigrationState *s, strList *host_port, - Error **errp); +QIOChannel *exec_connect_outgoing(strList *host_port, Error **errp); #endif diff --git a/migration/fd.c b/migration/fd.c index bbf380d1a0..2480f48f2b 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -49,8 +49,7 @@ static bool migration_fd_valid(int fd) return false; } =20 -QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname, - Error **errp) +QIOChannel *fd_connect_outgoing(const char *fdname, Error **errp) { QIOChannel *ioc =3D NULL; int fd =3D monitor_get_fd(monitor_cur(), fdname, errp); diff --git a/migration/fd.h b/migration/fd.h index ce0b751273..dfadbf4cc5 100644 --- a/migration/fd.h +++ b/migration/fd.h @@ -21,6 +21,5 @@ =20 void fd_connect_incoming(const char *fdname, Error **errp); =20 -QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname, - Error **errp); +QIOChannel *fd_connect_outgoing(const char *fdname, Error **errp); #endif diff --git a/migration/file.c b/migration/file.c index 5618aced49..9cdb55d94e 100644 --- a/migration/file.c +++ b/migration/file.c @@ -93,8 +93,7 @@ out: return ret; } =20 -QIOChannel *file_connect_outgoing(MigrationState *s, - FileMigrationArgs *file_args, Error **er= rp) +QIOChannel *file_connect_outgoing(FileMigrationArgs *file_args, Error **er= rp) { QIOChannelFile *fioc =3D NULL; g_autofree char *filename =3D g_strdup(file_args->filename); diff --git a/migration/file.h b/migration/file.h index 5936c64fea..74efd48abf 100644 --- a/migration/file.h +++ b/migration/file.h @@ -16,8 +16,7 @@ =20 void file_connect_incoming(FileMigrationArgs *file_args, Error **errp); =20 -QIOChannel *file_connect_outgoing(MigrationState *s, - FileMigrationArgs *file_args, Error **er= rp); +QIOChannel *file_connect_outgoing(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/migration.c b/migration/migration.c index c75c2c7e52..c11cd4ebf6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -101,7 +101,7 @@ 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); +static void migrate_hup_delete(void); =20 static void migration_downtime_start(MigrationState *s) { @@ -1372,7 +1372,7 @@ static void migration_cleanup(MigrationState *s) =20 qemu_savevm_state_cleanup(); cpr_state_close(); - migrate_hup_delete(s); + migrate_hup_delete(); =20 close_return_path_on_source(s); =20 @@ -1454,8 +1454,9 @@ static void migrate_error_free(MigrationState *s) } } =20 -void migration_connect_error_propagate(MigrationState *s, Error *error) +void migration_connect_error_propagate(Error *error) { + MigrationState *s =3D migrate_get_current(); MigrationStatus current =3D s->state; MigrationStatus next =3D MIGRATION_STATUS_NONE; bool resume =3D false; @@ -1555,7 +1556,7 @@ void migration_cancel(void) migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED); cpr_state_close(); - migrate_hup_delete(s); + migrate_hup_delete(); } } =20 @@ -1961,8 +1962,10 @@ bool migration_is_blocked(Error **errp) } =20 /* Returns true if continue to migrate, or false if error detected */ -static bool migrate_prepare(MigrationState *s, bool resume, Error **errp) +static bool migrate_prepare(bool resume, Error **errp) { + MigrationState *s =3D migrate_get_current(); + if (resume) { if (s->state !=3D MIGRATION_STATUS_POSTCOPY_PAUSED) { error_setg(errp, "Cannot resume if there is no " @@ -2080,16 +2083,19 @@ 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) +static void migrate_hup_add(QIOChannel *ioc, GSourceFunc 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); + MigrationState *s =3D migrate_get_current(); + + 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); } =20 -static void migrate_hup_delete(MigrationState *s) +static void migrate_hup_delete(void) { + MigrationState *s =3D migrate_get_current(); + if (s->hup_source) { g_source_destroy(s->hup_source); g_source_unref(s->hup_source); @@ -2101,19 +2107,18 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *c= hannel, GIOCondition cond, void *opaque) { - MigrationState *s =3D migrate_get_current(); MigrationAddress *addr =3D opaque; Error *local_err =3D NULL; =20 qmp_migrate_finish(addr, &local_err); =20 if (local_err) { - migration_connect_error_propagate(s, local_err); + migration_connect_error_propagate(local_err); } =20 =20 cpr_state_close(); - migrate_hup_delete(s); + migrate_hup_delete(); qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } @@ -2122,7 +2127,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) { - MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationChannel) channel =3D NULL; MigrationAddress *addr =3D NULL; MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; @@ -2173,7 +2177,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - if (!migrate_prepare(s, has_resume && resume, errp)) { + if (!migrate_prepare(has_resume && resume, errp)) { /* Error detected, put into errp */ return; } @@ -2200,7 +2204,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, + migrate_hup_add(cpr_state_ioc(), (GSourceFunc)qmp_migrate_finish_c= b, QAPI_CLONE(MigrationAddress, addr)); =20 } else { @@ -2209,16 +2213,14 @@ void qmp_migrate(const char *uri, bool has_channels, =20 out: if (local_err) { - migration_connect_error_propagate(s, error_copy(local_err)); + migration_connect_error_propagate(error_copy(local_err)); error_propagate(errp, local_err); } } =20 static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) { - MigrationState *s =3D migrate_get_current(); - - migration_connect_outgoing(s, addr, errp); + migration_connect_outgoing(addr, errp); } =20 void qmp_migrate_cancel(Error **errp) @@ -3895,8 +3897,9 @@ fail_setup: return NULL; } =20 -void migration_start_outgoing(MigrationState *s) +void migration_start_outgoing(void) { + MigrationState *s =3D migrate_get_current(); Error *local_err =3D NULL; uint64_t rate_limit; bool resume =3D (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP); @@ -3975,7 +3978,7 @@ void migration_start_outgoing(MigrationState *s) return; =20 fail: - migration_connect_error_propagate(s, local_err); + migration_connect_error_propagate(local_err); if (s->error) { error_report_err(error_copy(s->error)); } diff --git a/migration/migration.h b/migration/migration.h index 138831d7d9..1292c1ee3a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -529,11 +529,11 @@ void migrate_set_state(MigrationStatus *state, Migrat= ionStatus old_state, void migration_outgoing_setup(QIOChannel *ioc); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); =20 -void migration_connect_error_propagate(MigrationState *s, Error *error); +void migration_connect_error_propagate(Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 -void migration_start_outgoing(MigrationState *s); +void migration_start_outgoing(void); void migration_start_incoming(void); =20 int migration_call_notifiers(MigrationState *s, MigrationEventType type, diff --git a/migration/rdma.c b/migration/rdma.c index 3db3a89bdb..56e0ee8aa9 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3923,10 +3923,9 @@ err: g_free(rdma); } =20 -QIOChannel *rdma_connect_outgoing(void *opaque, - InetSocketAddress *host_port, Error **er= rp) +QIOChannel *rdma_connect_outgoing(InetSocketAddress *host_port, Error **er= rp) { - MigrationState *s =3D opaque; + MigrationState *s =3D migrate_get_current(); RDMAContext *rdma_return_path =3D NULL; RDMAContext *rdma; int ret; diff --git a/migration/rdma.h b/migration/rdma.h index 8a6515f130..205184f244 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,8 +21,7 @@ =20 #include "system/memory.h" =20 -QIOChannel *rdma_connect_outgoing(void *opaque, InetSocketAddress *host_po= rt, - Error **errp); +QIOChannel *rdma_connect_outgoing(InetSocketAddress *host_port, Error **er= rp); =20 void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 diff --git a/migration/socket.c b/migration/socket.c index ac3183d5d5..34ce7abbd3 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -42,23 +42,8 @@ void socket_send_channel_create(QIOTaskFunc f, void *dat= a) f, data, NULL, NULL); } =20 -struct SocketConnectData { - MigrationState *s; -}; - -static void socket_connect_data_free(void *opaque) +static void socket_outgoing_migration(QIOTask *task, gpointer opaque) { - struct SocketConnectData *data =3D opaque; - if (!data) { - return; - } - g_free(data); -} - -static void socket_outgoing_migration(QIOTask *task, - gpointer opaque) -{ - struct SocketConnectData *data =3D opaque; g_autoptr(QIOChannel) sioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 @@ -73,22 +58,19 @@ static void socket_outgoing_migration(QIOTask *task, } =20 trace_migration_socket_outgoing_connected(); - migration_channel_connect_outgoing(data->s, sioc); + migration_channel_connect_outgoing(sioc); return; err: trace_migration_socket_outgoing_error(error_get_pretty(err)); - migration_connect_error_propagate(data->s, err); + migration_connect_error_propagate(err); } =20 -void socket_connect_outgoing(MigrationState *s, SocketAddress *saddr, - Error **errp) +void socket_connect_outgoing(SocketAddress *saddr, Error **errp) { + MigrationState *s =3D migrate_get_current(); QIOChannelSocket *sioc =3D qio_channel_socket_new(); - struct SocketConnectData *data =3D g_new0(struct SocketConnectData, 1); SocketAddress *addr =3D QAPI_CLONE(SocketAddress, saddr); =20 - data->s =3D s; - /* in case previous migration leaked it */ qapi_free_SocketAddress(outgoing_args.saddr); outgoing_args.saddr =3D addr; @@ -101,8 +83,8 @@ void socket_connect_outgoing(MigrationState *s, SocketAd= dress *saddr, qio_channel_socket_connect_async(sioc, saddr, socket_outgoing_migration, - data, - socket_connect_data_free, + NULL, + NULL, NULL); } =20 diff --git a/migration/socket.h b/migration/socket.h index f0c89b64c7..0ddff7e9df 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -25,8 +25,7 @@ void socket_send_channel_create(QIOTaskFunc f, void *data= ); =20 void socket_connect_incoming(SocketAddress *saddr, Error **errp); =20 -void socket_connect_outgoing(MigrationState *s, - SocketAddress *saddr, Error **errp); +void socket_connect_outgoing(SocketAddress *saddr, Error **errp); void socket_cleanup_outgoing_migration(void); =20 #endif diff --git a/migration/tls.c b/migration/tls.c index f68e6a533b..d71d3f9ea6 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -103,18 +103,17 @@ void migration_tls_channel_process_incoming(QIOChanne= l *ioc, Error **errp) static void migration_tls_outgoing_handshake(QIOTask *task, gpointer opaque) { - MigrationState *s =3D opaque; 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)= ); - migration_connect_error_propagate(s, err); + migration_connect_error_propagate(err); return; } =20 trace_migration_tls_outgoing_handshake_complete(); - migration_channel_connect_outgoing(s, ioc); + migration_channel_connect_outgoing(ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, @@ -130,14 +129,14 @@ 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(QIOChannel *ioc) { QIOChannelTLS *tioc; Error *local_err =3D NULL; =20 tioc =3D migration_tls_client_create(ioc, &local_err); if (!tioc) { - migration_connect_error_propagate(s, local_err); + migration_connect_error_propagate(local_err); return; } =20 @@ -150,7 +149,7 @@ void migration_tls_channel_connect(MigrationState *s, Q= IOChannel *ioc) } qio_channel_tls_handshake(tioc, migration_tls_outgoing_handshake, - s, + NULL, NULL, NULL); } diff --git a/migration/tls.h b/migration/tls.h index 7399c42edf..7ccd495f81 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -29,7 +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(QIOChannel *ioc); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc); --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784082; cv=none; d=zohomail.com; s=zohoarc; b=LwEpLx4JcKgeNI7oNctnd5o1TxSAjjba/vilMhZphfiiT2quLiGssZ4QjMbj5ThWYS+9FniZ+ble/4hyDcTPigNpFwEQdxVat3sgiN7ehAjz9yjOspNa5OQtjcr03fjcEk0A713gcwjN4q5iXdI6iH7ybbk/urv9757Mf0VHzq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784082; 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=BUyCvyJIWhl+/SpTLRotM1zYCsp+lUHnfmiZRYJQwZA=; b=fv7bxoFh69jmwN3AM5YNdva7iTr95BXcZkiU3v+fCt6veAj2osQvFO6f+GSz7NpQCil7undnzvcMUb99xVeLfyf+ITkeoeeKZsiLrCqvBKJ8qlD2ncZBXN0Alz7JmvUaFoGG354TwpmLrtVdir5pIFwQ5lm3pMNNN8ycUXrKSDs= 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 1766784082916116.1560532398313; Fri, 26 Dec 2025 13:21:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEY-0001XF-M5; Fri, 26 Dec 2025 16:20:26 -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 1vZFEU-0001SN-4T for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:22 -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 1vZFES-00047x-Fp for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:21 -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 91762336A8; Fri, 26 Dec 2025 21:20:11 +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 7C9F33EA65; Fri, 26 Dec 2025 21:20: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 AApLDwr8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784011; 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=BUyCvyJIWhl+/SpTLRotM1zYCsp+lUHnfmiZRYJQwZA=; b=eO0l++jsbXsChOFfr/dYJtCogMcWNecVDVG0G6hwgU4E1h4MBNt1rjnZf7y/uLWrPBOZ/Q FDVu2qELn7PZIt4lpwqBMdbs1YJJ0ffd8fKZEy/FudBmoyl7th5WlnttvEKO4g4Qi0WOS2 as1kiontTUs//qY1+DgdS2NgN93qSvQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784011; 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=BUyCvyJIWhl+/SpTLRotM1zYCsp+lUHnfmiZRYJQwZA=; b=NGtN5PgORLyCqkxZNWrwzAMCWZsuGF6CtDwRdCI4LcT4uGk5mvqsl17fZtJKs4y9t/Ni+f FPidLX/86qsk+sBg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eO0l++js; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=NGtN5PgO DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784011; 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=BUyCvyJIWhl+/SpTLRotM1zYCsp+lUHnfmiZRYJQwZA=; b=eO0l++jsbXsChOFfr/dYJtCogMcWNecVDVG0G6hwgU4E1h4MBNt1rjnZf7y/uLWrPBOZ/Q FDVu2qELn7PZIt4lpwqBMdbs1YJJ0ffd8fKZEy/FudBmoyl7th5WlnttvEKO4g4Qi0WOS2 as1kiontTUs//qY1+DgdS2NgN93qSvQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784011; 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=BUyCvyJIWhl+/SpTLRotM1zYCsp+lUHnfmiZRYJQwZA=; b=NGtN5PgORLyCqkxZNWrwzAMCWZsuGF6CtDwRdCI4LcT4uGk5mvqsl17fZtJKs4y9t/Ni+f FPidLX/86qsk+sBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 22/25] migration/channel: Merge both sides of the connection initiation code Date: Fri, 26 Dec 2025 18:19:24 -0300 Message-ID: <20251226211930.27565-23-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 91762336A8 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784084681158500 Content-Type: text/plain; charset="utf-8" Now that everything is in channel.c, it's easier to browse this code if it's all in the same place. It's also easier to grasp what the connection flow is if both sides of the connection are close together. Signed-off-by: Fabiano Rosas --- migration/channel.c | 86 +++++++++++++++++++++++---------------------- migration/channel.h | 14 ++++++-- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 042e01b224..ba9aa1c58b 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -31,10 +31,11 @@ #include "trace.h" #include "yank_functions.h" =20 -bool migration_connect_outgoing(MigrationAddress *addr, Error **errp) +bool migration_connect(MigrationAddress *addr, bool out, Error **errp) { g_autoptr(QIOChannel) ioc =3D NULL; SocketAddress *saddr; + ERRP_GUARD(); =20 switch (addr->transport) { case MIGRATION_ADDRESS_TYPE_SOCKET: @@ -44,15 +45,24 @@ bool migration_connect_outgoing(MigrationAddress *addr,= Error **errp) case SOCKET_ADDRESS_TYPE_INET: case SOCKET_ADDRESS_TYPE_UNIX: case SOCKET_ADDRESS_TYPE_VSOCK: - socket_connect_outgoing(saddr, errp); - /* - * async: after the socket is connected, calls - * migration_channel_connect_outgoing() directly. - */ - return true; + if (out) { + socket_connect_outgoing(saddr, errp); + /* + * async: after the socket is connected, calls + * migration_channel_connect_outgoing() directly. + */ + return true; + } else { + socket_connect_incoming(saddr, errp); + } + break; case SOCKET_ADDRESS_TYPE_FD: - ioc =3D fd_connect_outgoing(saddr->u.fd.str, errp); + if (out) { + ioc =3D fd_connect_outgoing(saddr->u.fd.str, errp); + } else { + fd_connect_incoming(saddr->u.fd.str, errp); + } break; default: g_assert_not_reached(); @@ -62,16 +72,28 @@ bool migration_connect_outgoing(MigrationAddress *addr,= Error **errp) =20 #ifdef CONFIG_RDMA case MIGRATION_ADDRESS_TYPE_RDMA: - ioc =3D rdma_connect_outgoing(&addr->u.rdma, errp); + if (out) { + ioc =3D rdma_connect_outgoing(&addr->u.rdma, errp); + } else { + rdma_connect_incoming(&addr->u.rdma, errp); + } break; #endif =20 case MIGRATION_ADDRESS_TYPE_EXEC: - ioc =3D exec_connect_outgoing(addr->u.exec.args, errp); + if (out) { + ioc =3D exec_connect_outgoing(addr->u.exec.args, errp); + } else { + exec_connect_incoming(addr->u.exec.args, errp); + } break; =20 case MIGRATION_ADDRESS_TYPE_FILE: - ioc =3D file_connect_outgoing(&addr->u.file, errp); + if (out) { + ioc =3D file_connect_outgoing(&addr->u.file, errp); + } else { + file_connect_incoming(&addr->u.file, errp); + } break; =20 default: @@ -79,42 +101,22 @@ bool migration_connect_outgoing(MigrationAddress *addr= , Error **errp) break; } =20 - if (!ioc) { - return false; - } - - migration_channel_connect_outgoing(ioc); - return true; -} - -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); + if (out) { + if (!ioc) { + return false; } -#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"); + + migration_channel_connect_outgoing(ioc); + return true; } =20 /* - * async: the above routines all wait for the incoming connection - * and call back to migration_channel_process_incoming() to start - * the migration. + * async: on the incoming side all of the transport routines above + * wait for the incoming connection and call back to + * migration_channel_process_incoming() to start the migration. */ + + return !*errp; } =20 bool migration_has_main_and_multifd_channels(void) diff --git a/migration/channel.h b/migration/channel.h index 8cf16bfda9..86934fee38 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -39,6 +39,16 @@ int migration_channel_read_peek(QIOChannel *ioc, bool migration_has_main_and_multifd_channels(void); bool migration_has_all_channels(void); =20 -bool migration_connect_outgoing(MigrationAddress *addr, Error **errp); -void migration_connect_incoming(MigrationAddress *addr, Error **errp); +bool migration_connect(MigrationAddress *addr, bool out, Error **errp); +static inline bool migration_connect_outgoing(MigrationAddress *addr, + Error **errp) +{ + return migration_connect(addr, true, errp); +} + +static inline bool migration_connect_incoming(MigrationAddress *addr, + Error **errp) +{ + return migration_connect(addr, false, errp); +} #endif --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784084; cv=none; d=zohomail.com; s=zohoarc; b=F5b8EMaVIRTC9GDNT37LaXSvOCNKXRe9Frjmj8qFd7wKyl0lrYAWW6xfPvY5aOJSr9YTsfQIXcsFpZ6G24V72SqLV3pQSvVLXDP/OraT8HwgvBJUWWsyttTXzedHK9VL44qDnGeIlPda8dq9TNWydjagbNUh4DvqCFjOre6Zoco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784084; 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=CvDhQbE5OymhaWJ4FEWOmJTckfPb4O/dEFgWzep2NL0=; b=YDd4YD6khwE1vT89WEn6B9EbtxLLbjdta3HgdJZybeFpxDU6AbxRmASs6fAjWbxr5tfp+htbHVgc4tYHxVz3gJHNqcaNLRHxXMYVgDjlwSSQAtmwriojGQxFpXvaVPVSncJHN4yZ5qcmyViRHqg8yzKL8LjWgU69UsXnfDvN47o= 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 1766784084884297.7533760821253; Fri, 26 Dec 2025 13:21:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFEb-0001a3-TO; Fri, 26 Dec 2025 16:20:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZFEZ-0001Ya-Sb for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:28 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vZFEY-00049K-16 for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:20:27 -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 291C3336AB; Fri, 26 Dec 2025 21:20:13 +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 1E7D93EA63; Fri, 26 Dec 2025 21:20:11 +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 WPfHMwv8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784013; 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=CvDhQbE5OymhaWJ4FEWOmJTckfPb4O/dEFgWzep2NL0=; b=Gp9dP/fymVPrry4ezM1dE+6KT3WDW+NH6OSs9/WsNRPEKXNWzKamj8PeKho8G3w8mvsuAk CAuh5euV0Db6T711A6oyZHZgInut3dIwANJ7OPrfPKYvWWAIHtW/S4H0W9PBwfIygdl/zi SUTjTWwh0ZIQWqQRy3d9kkdjXB8g1Qs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784013; 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=CvDhQbE5OymhaWJ4FEWOmJTckfPb4O/dEFgWzep2NL0=; b=LSpAvitnxQrNt7bOhwbatzwKZLxQLkhkf9U+rZOkL4YJn0fVSZKQFdMMfhgn0890frY6fh YCzKNS/q2Nfy/ACw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="Gp9dP/fy"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=LSpAvitn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784013; 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=CvDhQbE5OymhaWJ4FEWOmJTckfPb4O/dEFgWzep2NL0=; b=Gp9dP/fymVPrry4ezM1dE+6KT3WDW+NH6OSs9/WsNRPEKXNWzKamj8PeKho8G3w8mvsuAk CAuh5euV0Db6T711A6oyZHZgInut3dIwANJ7OPrfPKYvWWAIHtW/S4H0W9PBwfIygdl/zi SUTjTWwh0ZIQWqQRy3d9kkdjXB8g1Qs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784013; 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=CvDhQbE5OymhaWJ4FEWOmJTckfPb4O/dEFgWzep2NL0=; b=LSpAvitnxQrNt7bOhwbatzwKZLxQLkhkf9U+rZOkL4YJn0fVSZKQFdMMfhgn0890frY6fh YCzKNS/q2Nfy/ACw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 23/25] migration: Move channel parsing to channel.c Date: Fri, 26 Dec 2025 18:19:25 -0300 Message-ID: <20251226211930.27565-24-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 291C3336AB 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784086596158500 Content-Type: text/plain; charset="utf-8" Encapsulate the MigrationChannelList parsing in a new migrate_channels_parse() located at channel.c. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 54 +++++++++++++++++++++++++++++++++++++++++++ migration/channel.h | 5 ++++ migration/migration.c | 50 +++++++++++---------------------------- 3 files changed, 73 insertions(+), 36 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index ba9aa1c58b..8b43c3d983 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" @@ -314,3 +317,54 @@ 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; + + if (cpr_channelp) { + single_channel =3D false; + } else { + single_channel =3D true; + } + + 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 (single_channel) { + if (channels->next) { + error_setg(errp, "Channel list must have only one entry, " + "for type 'main'"); + return false; + } + break; + } + } + + 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 86934fee38..b3276550b7 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -51,4 +51,9 @@ static inline bool migration_connect_incoming(MigrationAd= dress *addr, { return migration_connect(addr, false, 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 c11cd4ebf6..6064f1e5ea 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 @@ -784,7 +778,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(); @@ -2127,10 +2121,8 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_detach, bool det= ach, bool has_resume, bool resume, Error **errp) { - 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 @@ -2141,38 +2133,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; } @@ -2189,7 +2167,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 @@ -2205,10 +2183,10 @@ void qmp_migrate(const char *uri, bool has_channels, */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(cpr_state_ioc(), (GSourceFunc)qmp_migrate_finish_c= b, - QAPI_CLONE(MigrationAddress, addr)); + QAPI_CLONE(MigrationAddress, main_ch->addr)); =20 } else { - qmp_migrate_finish(addr, &local_err); + qmp_migrate_finish(main_ch->addr, &local_err); } =20 out: --=20 2.51.0 From nobody Wed Jan 7 09:26:21 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=1766784113; cv=none; d=zohomail.com; s=zohoarc; b=RWm4EcybBf9lY7lfJ4+YBdF0ezjwIIIdtaztZ6M8l8PstjwhnLY5731ZFv2RWxF1x6XwgG5rR/JXyO+WfX4VgHsOgeTKLhJZlIrhb/ePkX2PYlQ+ILvsFp+tm6D26NOMwQMWObZqgO8LMi3MB/A540bfO8j1Uq/Q7H+7y56FwBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784113; 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=nZYij0rOuEg38KzRK+gK1tvVNvAJC0Im/etk/9Ju80I=; b=bRU5/6xYPa94VnZLk7ExFRIueMendq3cEjQvYoxHDdxj2DPTWVgFznb3rBt8MYOHAQl9DLprMvRs8v39ZSxxYHG3phLV1OMtT876n3bCAwfP0/TVF34ZRi75yTT+6IsMhODYZryNj4tcG0lhxNlgRtUe71R/5UZnYR+YArEQhpU= 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 1766784113031599.4322802022143; Fri, 26 Dec 2025 13:21:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFFF-0003bJ-7O; Fri, 26 Dec 2025 16:21: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 1vZFFD-0003R6-Hl for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:21: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 1vZFFB-0004LO-DZ for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:21:07 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BC37B5BCE4; Fri, 26 Dec 2025 21:20: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 B46453EA63; Fri, 26 Dec 2025 21:20:13 +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 WGwAHQ38TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784014; 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=nZYij0rOuEg38KzRK+gK1tvVNvAJC0Im/etk/9Ju80I=; b=pKRETSC5rEQTB1lsw1BfII6gIDoQY+JML/nyLfJmm+57/oUXG4dmjnxkN7if+sbjZlRUCb mFmRxkimqvPzdj4XyhCYcCA/E56mlmPc54nLFnOBNuFWOxBXS3qvwBAcGaQ78aVFQdWKnY Q8/RQlRynjHybLpUF2bZqjt7U0/v/Eo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784014; 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=nZYij0rOuEg38KzRK+gK1tvVNvAJC0Im/etk/9Ju80I=; b=ZSMs43g+G0MD6x0iRE1mFOguKP4bGOCOAF/po9UcJrmzWFH4K+xmuDl+YzECdQyN1xU5wc Iqys7otIRG8SuWDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784014; 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=nZYij0rOuEg38KzRK+gK1tvVNvAJC0Im/etk/9Ju80I=; b=pKRETSC5rEQTB1lsw1BfII6gIDoQY+JML/nyLfJmm+57/oUXG4dmjnxkN7if+sbjZlRUCb mFmRxkimqvPzdj4XyhCYcCA/E56mlmPc54nLFnOBNuFWOxBXS3qvwBAcGaQ78aVFQdWKnY Q8/RQlRynjHybLpUF2bZqjt7U0/v/Eo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784014; 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=nZYij0rOuEg38KzRK+gK1tvVNvAJC0Im/etk/9Ju80I=; b=ZSMs43g+G0MD6x0iRE1mFOguKP4bGOCOAF/po9UcJrmzWFH4K+xmuDl+YzECdQyN1xU5wc Iqys7otIRG8SuWDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 24/25] migration: Move URI parsing to channel.c Date: Fri, 26 Dec 2025 18:19:26 -0300 Message-ID: <20251226211930.27565-25-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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.987]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1766784114922158500 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. While here, add some words about the memory management of the MigrationChannel object, which is slightly different from migrate_uri_parse() and migrate_channels_parse(). The former takes a string and has to allocate a MigrationChannel, the latter takes a QAPI object that is managed by the QAPI code. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.c | 97 +++++++++++++++++++++++++++++++++++++++++-- migration/channel.h | 9 ++-- migration/migration.c | 95 ++---------------------------------------- 3 files changed, 101 insertions(+), 100 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 8b43c3d983..d30e29c9b3 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -40,6 +40,12 @@ bool migration_connect(MigrationAddress *addr, bool out,= Error **errp) SocketAddress *saddr; ERRP_GUARD(); =20 + /* + * This is reached from a QMP command, the transport code below + * must copy the relevant parts of 'addr' before this function + * returns because the QAPI code will free it. + */ + switch (addr->transport) { case MIGRATION_ADDRESS_TYPE_SOCKET: saddr =3D &addr->u.socket; @@ -318,10 +324,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; @@ -353,6 +359,15 @@ bool migrate_channels_parse(MigrationChannelList *chan= nels, } } =20 + /* + * These don't technically need to be cloned because they come + * from a QAPI object ('channels'). The top-level caller + * (qmp_migrate) needs to copy the necessary information before + * returning from the QMP command. Cloning here is just to keep + * the interface consistent with migrate_uri_parse() that _does + * not_ take a QAPI object and instead allocates and transfers + * ownership of a MigrationChannel to qmp_migrate. + */ if (cpr_channelp) { *cpr_channelp =3D QAPI_CLONE(MigrationChannel, channelv[MIGRATION_CHANNEL_TYPE_CPR]); @@ -368,3 +383,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 b3276550b7..3724b0493a 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -52,8 +52,9 @@ static inline bool migration_connect_incoming(MigrationAd= dress *addr, return migration_connect(addr, false, 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 6064f1e5ea..15d8459a81 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; @@ -2124,27 +2051,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 Wed Jan 7 09:26:21 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=1766784096; cv=none; d=zohomail.com; s=zohoarc; b=LnsAgJ9rOxOsrr+h/WxXJtYlP1VafFcb75pL+gFbo1z3867E2e1S3A6avadd21rZOIZxljZ702h/soXmWFpxoUlhWvkYTQyHN/mTn8rPs0imodiPSzBjydG6TOwvJ70N40ggqgCel4vevQAkHL6i4kAp/Hv9bp5GAQWgeqGo7r8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766784096; 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=mqj7eIxmqSfwi0x0PViGUESmvgBn7IsXqDeDDlZ4qaY=; b=e52WSRZX9BXEIisBEIXDD3ldurhOoEntybGZRRfXbdFbdqD4DiQzKAR04LnFaOnlqcQEJP980qej8JWicaqbeEM9X8T13Kl/a/MEUaKM4A4a6DT7Gh5P7GIe8jI+3XoGtyonGHL/z0SH+ILqu+oY/rY0pJ+BPosDSdrQZFW7VSA= 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 1766784095993463.72397337729615; Fri, 26 Dec 2025 13:21:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZFFO-0004ch-03; Fri, 26 Dec 2025 16:21: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 1vZFFJ-0004CP-Bl for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:21:13 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vZFFH-0004My-Ba for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:21:13 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 548E15BCF1; Fri, 26 Dec 2025 21:20: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 4B6C43EA63; Fri, 26 Dec 2025 21:20:15 +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 CBFhAw/8TmnwJwAAD6G6ig (envelope-from ); Fri, 26 Dec 2025 21:20:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784017; 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=mqj7eIxmqSfwi0x0PViGUESmvgBn7IsXqDeDDlZ4qaY=; b=aHDkKWrMA3ccDmI6OvcET8D95OzTPprA7rKPbJexpFw00DZtKE0Z/AsX80ShLHixg5Lin+ p71troD8mjsT5GYTZdSl0tSOcwrfFCoKVEr0Zw3+nGsFWWgH0G61TUVPzb8GVDyI5rayNN 6hxDatqEgcRhwDsygiPa0fs4pSz8Nb8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784017; 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=mqj7eIxmqSfwi0x0PViGUESmvgBn7IsXqDeDDlZ4qaY=; b=q3ZFK0LgRP8+ee9OVNx9kSWiJU0KVlsCsO+FG+qmeLid/XbOotbcxcM/YQ9WYfSkPMXo9e EVvuK30vwkdhK4Cg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mWENP+7S; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=nsT+HCZB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766784016; 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=mqj7eIxmqSfwi0x0PViGUESmvgBn7IsXqDeDDlZ4qaY=; b=mWENP+7SYgYCxjbUdzFaLZGA97DfhRg9tprQuG1wXFXDVkkZXx7OzG7UftgPgWlrEQGouM 3HXK+oKw/mk+a+pSe6y3cKPSiRQbdZHIVFDd1+/uDbpBB6szKKfoKv6cgpcB6FtPNnVYNy EEAVLf3sbEjydNRyVjgKkKfHEGdhZZo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766784016; 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=mqj7eIxmqSfwi0x0PViGUESmvgBn7IsXqDeDDlZ4qaY=; b=nsT+HCZBEggNW0txJAN8UC7IDK9XRgG57VVkpq5ShkH9FVTUrQfi51kwA60xygQnSWxCde 82O0PbZ6k6rT1zCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com Subject: [RFC PATCH 25/25] migration: Remove qmp_migrate_finish Date: Fri, 26 Dec 2025 18:19:27 -0300 Message-ID: <20251226211930.27565-26-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251226211930.27565-1-farosas@suse.de> References: <20251226211930.27565-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 548E15BCF1 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) (identity @suse.de) X-ZM-MESSAGEID: 1766784096692158500 Content-Type: text/plain; charset="utf-8" With recent cleanups, the qmp_migrate_finish() function has now become just a call to migration_connect_outgoing(), which makes sense because that's what the "second part of qmp_migrate" does. The qmp_migrate_finish is (in retrospect) too confusing because it never had a matching qmp_migrate_start. I think it's best to just remove this function and call migration_connect_outgoing() directly. Signed-off-by: Fabiano Rosas --- migration/migration.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 15d8459a81..228e322de1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1470,8 +1470,8 @@ void migration_cancel(void) } =20 /* - * If qmp_migrate_finish has not been called, then there is no path th= at - * will complete the cancellation. Do it now. + * If migration_connect_outgoing has not been called, then there + * is no path that will complete the cancellation. Do it now. */ if (setup && !s->to_dst_file) { migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, @@ -2002,8 +2002,6 @@ static bool migrate_prepare(bool resume, Error **errp) return true; } =20 -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); - static void migrate_hup_add(QIOChannel *ioc, GSourceFunc cb, void *opaque) { MigrationState *s =3D migrate_get_current(); @@ -2031,7 +2029,7 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, MigrationAddress *addr =3D opaque; Error *local_err =3D NULL; =20 - qmp_migrate_finish(addr, &local_err); + migration_connect_outgoing(addr, &local_err); =20 if (local_err) { migration_connect_error_propagate(local_err); @@ -2086,18 +2084,19 @@ void qmp_migrate(const char *uri, bool has_channels, * For cpr-transfer, the target may not be listening yet on the migrat= ion * channel, because first it must finish cpr_load_state. The target t= ells * us it is listening by closing the cpr-state socket. Wait for that = HUP - * event before connecting in qmp_migrate_finish. + * event before connecting in migration_connect_outgoing. * * The HUP could occur because the target fails while reading CPR stat= e, * 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. + * connection, so migration_connect_outgoing fail to connect, and + * then recover. */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(cpr_state_ioc(), (GSourceFunc)qmp_migrate_finish_c= b, QAPI_CLONE(MigrationAddress, main_ch->addr)); =20 } else { - qmp_migrate_finish(main_ch->addr, &local_err); + migration_connect_outgoing(main_ch->addr, &local_err); } =20 out: @@ -2107,11 +2106,6 @@ out: } } =20 -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) -{ - migration_connect_outgoing(addr, errp); -} - void qmp_migrate_cancel(Error **errp) { /* --=20 2.51.0