From nobody Sun Jan 25 10:13:46 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=1769177877; cv=none; d=zohomail.com; s=zohoarc; b=UTCsFUyRKzHx9y3fdSMTt3q63hB6YUlRmmyxSUaKRUp0JgI4Nbw+WrQ+hHKArZKeGPZjavK5P+hFhhQ2NMZP3K0dQCyTAnlZwnHzTynt8IrMfH+BLaVkXeRMTRJfU43hfjRuBMZz9k2Lb/iCn+w5MEYKt5rakcDLUCSn/4ytUZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177877; 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=sWRL/nWrCVHSK6esLTDPIGSojxWa678TN/Hbt9SGVV0=; b=fQqipRgM8N9aWhz8wcP/xQS0cajQIRglQY2A6ppryh5Tf49tsCfKi9kF3TWXsRzcs1Tt9nQlAk3jYmdocF4E/Y4iQSo9JXOxGa4myM8BszM78qrRbhu4iwWT2UpU6I1+nyHZeadR+gDOMTzXrmatoyQjyLTR+2CCWZcUXDfJqBE= 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 1769177877165379.80468662446754; Fri, 23 Jan 2026 06:17:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHyk-00008q-7z; Fri, 23 Jan 2026 09:17:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHyF-0008QH-EG for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:08 -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 1vjHyD-0003bk-Sa for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17: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 651AE5BCCE; Fri, 23 Jan 2026 14:17:03 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D412E1395E; Fri, 23 Jan 2026 14:17: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 +ER3I92Cc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177824; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sWRL/nWrCVHSK6esLTDPIGSojxWa678TN/Hbt9SGVV0=; b=vWyP8eww2ioTtsYffPZwHq2vvGBHYGmdqqqZNIFloUaQx0Y8A9PotxnnmXHRhPHntEh0sJ HZF3CQ0URFGXzqjdct6XBAy9UogK0REJfUNeQtrNvt2P3b+zphwbMg8DdvMVVrHzI3OefX GxCz8UilaGCBEaIS3lAbsEjSxk17CAY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177824; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sWRL/nWrCVHSK6esLTDPIGSojxWa678TN/Hbt9SGVV0=; b=VUVk422/8HSfGAICkAyaxlsTtT08oN3MEVcFYk5dGLUtVz675eg8kpj9MTAx+go87lGbsm KmcXN/hIOIr/B1BA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ckc4+iAQ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=uQZ4yBuK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177823; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sWRL/nWrCVHSK6esLTDPIGSojxWa678TN/Hbt9SGVV0=; b=ckc4+iAQfTr4sB373ff+VAbgEqp9tjDhFIBlQzvlQSI6ccvhNygLah8qujpbHD8tpD1/tX L9yXTAP3WoW6mtt9nZmN3ETA734hyVzp7ia+uYAz5S0MewpbqcKvqm9LIck4zFruUnt/x1 24YCZfiXEHA/QBJXNSbLbw7rjjHfj48= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177823; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sWRL/nWrCVHSK6esLTDPIGSojxWa678TN/Hbt9SGVV0=; b=uQZ4yBuKZdwPNykV3jAikODj/UwjtBoMNSugAiHso5KT1Xk5DvugY7XBNuM0A1sQ3Ql9rW P2Se5wZS2IcHiDCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com Subject: [PATCH v4 01/25] migration: Remove redundant state change Date: Fri, 23 Jan 2026 11:16:31 -0300 Message-ID: <20260123141656.6765-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; 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-Queue-Id: 651AE5BCCE X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769177878204158500 Content-Type: text/plain; charset="utf-8" If local_err is set, migration_connect_error_propagate() will be called and that function already has a state transition from SETUP to FAILED. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 1bcde301f7..f3d541dc5b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2324,8 +2324,6 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { error_setg(&local_err, "uri is not a valid migration protocol"); - migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); } =20 if (local_err) { --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178050; cv=none; d=zohomail.com; s=zohoarc; b=nA03GCCi1ZZnYRs66ANdk7jUdwwR98/jNWg5rl97SivB5yxgavDyMedBr6o6+o8GqgmmyKOunMM3BNUfMjOhD3OcA0W7rXSv2Fytq7cUKMz9lKs9dZ7piGUAihNQZZhTtsARVLQM+JpP/V8ZP93D97ANTepuAlMswPVXACyP03k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178050; 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=0Ufu+1dVtGzz0ELoB4DWoKubxqCkQ5qApaqr3r1poPk=; b=dySCDieL/D5Gyf3P4xG+0SWcJziLrbVy0iVEFQFkQttt2asqf/9sIrm7WOT3MWgJCCHu98rO8X1Eeq/X/OMICzg0zFUPgoUEwjOhYtocq4FJQVtwyeGg6vnBlIdxpW/N1L1ULNCYvGBjP0AMyJWxCeemi9iEdxKOieApvjjWlUg= 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 1769178050389677.9413296929081; Fri, 23 Jan 2026 06:20:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHyn-0000Dd-7i; Fri, 23 Jan 2026 09:17:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHyK-0008RQ-Qq for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:20 -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 1vjHyJ-0003cQ-DM for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:12 -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 BCE8E5BCCF; Fri, 23 Jan 2026 14:17:05 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E2629139E8; Fri, 23 Jan 2026 14:17: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 4JIjKN+Cc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Ufu+1dVtGzz0ELoB4DWoKubxqCkQ5qApaqr3r1poPk=; b=xUCsVdXEapJQvMvY7my4POMUOFZKOtmhT1GBBrF5RkWdaozyrMVxf09BqytsOJUBqtR4HW cAwU+8bFvLqSuHBrkHGQZnKdZCMBzfpllgx+kGRNMRrMmJj69GGailwb+yjLm6TWNuKodQ izqPHv+Id7IjXQg8sc9DVjM9qY/R40E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Ufu+1dVtGzz0ELoB4DWoKubxqCkQ5qApaqr3r1poPk=; b=oTFZQVTlmmPhFDPwdNds9lirD5Yr4js0/G3S0BMnIEvb5gMtS/oqCfoT1Uxk3Pq/C9o76Y eQXLqh8keqz6FNBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Ufu+1dVtGzz0ELoB4DWoKubxqCkQ5qApaqr3r1poPk=; b=xUCsVdXEapJQvMvY7my4POMUOFZKOtmhT1GBBrF5RkWdaozyrMVxf09BqytsOJUBqtR4HW cAwU+8bFvLqSuHBrkHGQZnKdZCMBzfpllgx+kGRNMRrMmJj69GGailwb+yjLm6TWNuKodQ izqPHv+Id7IjXQg8sc9DVjM9qY/R40E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Ufu+1dVtGzz0ELoB4DWoKubxqCkQ5qApaqr3r1poPk=; b=oTFZQVTlmmPhFDPwdNds9lirD5Yr4js0/G3S0BMnIEvb5gMtS/oqCfoT1Uxk3Pq/C9o76Y eQXLqh8keqz6FNBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 02/25] migration: Fix state change at migration_channel_process_incoming Date: Fri, 23 Jan 2026 11:16:32 -0300 Message-ID: <20260123141656.6765-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[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_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178051053158500 Content-Type: text/plain; charset="utf-8" When the incoming migration fails during the channel connection phase, the state transition to FAILED is currently being done in the MigrationState->state, but the MigrationIncomingState->state is the one that should be used. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/channel.c b/migration/channel.c index 92435fa7f7..4768c71455 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -48,7 +48,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) =20 if (local_err) { error_report_err(local_err); - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); + migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED= ); if (mis->exit_on_error) { exit(EXIT_FAILURE); } --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177974; cv=none; d=zohomail.com; s=zohoarc; b=Nvm+ebW4EDqdIsA+NOLhMvz1kkDGBdVrYT3wzZmaitMnVYVml0yD2SpdUnA2Jqba8o5hp20fWblfdas1k+CbAgk1MjAOsvoj7kgAsfPV1r1Ju3ZjpLrUwVB6+6YAwJBD5mfMlp1UGT05JaDWWDtSLnKkM6yU7fqEmpDJL1KhYQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177974; 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=o6O8CgAPCa2Wh5i/Qy/d9wgRT5etJvIyx4G3pi36YK8=; b=Uj1GmZKk9jxPTH6T8nPTR0/x+WX7R6sUuVbw5wNaIC8nrFvB201X4BWY/XScHaAWjiIyR2w7oL8P7YMg01p39RsjEN4S1GQ1Ng7PMYym8M+31Os0V7n8gbq0NWLbvVa3hlqcj2kSrViNvUDtRz6Zdqy63DTUQzgnM1OSYfXgGxw= 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 1769177974621617.973002835213; Fri, 23 Jan 2026 06:19:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHys-0000IC-TT; Fri, 23 Jan 2026 09:17: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 1vjHyK-0008RP-Hm for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:20 -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 1vjHyI-0003cG-RY for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:12 -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 1DEBC33809; Fri, 23 Jan 2026 14:17:08 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3FED91395E; Fri, 23 Jan 2026 14:17: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 4HOwAOKCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177828; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o6O8CgAPCa2Wh5i/Qy/d9wgRT5etJvIyx4G3pi36YK8=; b=kGhq4JsVCeSuRA7HZdMhH11ZVBE4anZxKUXkaS4Nuhs0cFYgnxXglnhOr4zDJPF4GsuSv+ zVuSi6QDcTodKh8FO5tZRelyFCNhL3bd8wR5hPZaZ/OCh+9syX03F9ChPwmMbDMS2eQIfV ziQsLqTBvMoalGTACyjVjasNS0al2EQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177828; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o6O8CgAPCa2Wh5i/Qy/d9wgRT5etJvIyx4G3pi36YK8=; b=MyAHLx+KNHsb4Cfu9gkLCpUyvdJv5FJEGtZBniuIgIuO1MXs8oxxkyw5q9T27EHDrlHVfQ XsNn1yOTWwstD4BQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=kGhq4JsV; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=MyAHLx+K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177828; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o6O8CgAPCa2Wh5i/Qy/d9wgRT5etJvIyx4G3pi36YK8=; b=kGhq4JsVCeSuRA7HZdMhH11ZVBE4anZxKUXkaS4Nuhs0cFYgnxXglnhOr4zDJPF4GsuSv+ zVuSi6QDcTodKh8FO5tZRelyFCNhL3bd8wR5hPZaZ/OCh+9syX03F9ChPwmMbDMS2eQIfV ziQsLqTBvMoalGTACyjVjasNS0al2EQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177828; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o6O8CgAPCa2Wh5i/Qy/d9wgRT5etJvIyx4G3pi36YK8=; b=MyAHLx+KNHsb4Cfu9gkLCpUyvdJv5FJEGtZBniuIgIuO1MXs8oxxkyw5q9T27EHDrlHVfQ XsNn1yOTWwstD4BQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 03/25] migration/tls: Remove unused parameter Date: Fri, 23 Jan 2026 11:16:33 -0300 Message-ID: <20260123141656.6765-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, suse.de:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 1DEBC33809 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177976862154100 Content-Type: text/plain; charset="utf-8" The MigrationState parameter is not used at migration_tls_channel_process_incoming(). The last usage was removed by commit 3f461a0c0b ("migration: Drop unused parameter for migration_tls_get_creds()") Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 3 +-- migration/tls.c | 4 +--- migration/tls.h | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 4768c71455..b4ab676048 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -32,7 +32,6 @@ */ void migration_channel_process_incoming(QIOChannel *ioc) { - MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; =20 @@ -40,7 +39,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) ioc, object_get_typename(OBJECT(ioc))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_process_incoming(s, ioc, &local_err); + migration_tls_channel_process_incoming(ioc, &local_err); } else { migration_ioc_register_yank(ioc); migration_ioc_process_incoming(ioc, &local_err); diff --git a/migration/tls.c b/migration/tls.c index 56b5d1cc90..1df31bdcbb 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -71,9 +71,7 @@ static void migration_tls_incoming_handshake(QIOTask *tas= k, object_unref(OBJECT(ioc)); } =20 -void migration_tls_channel_process_incoming(MigrationState *s, - QIOChannel *ioc, - Error **errp) +void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp) { QCryptoTLSCreds *creds; QIOChannelTLS *tioc; diff --git a/migration/tls.h b/migration/tls.h index 58b25e1228..7607cfe803 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -24,9 +24,7 @@ #include "io/channel.h" #include "io/channel-tls.h" =20 -void migration_tls_channel_process_incoming(MigrationState *s, - QIOChannel *ioc, - Error **errp); +void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp); =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, const char *hostname, --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178066; cv=none; d=zohomail.com; s=zohoarc; b=UCgk/6YNGXMxpBab4M7kZQX3q4DtbsLq4x2TaTJHseJrIJTp2pRNDyfPB5g5rxn8NG/Vn/5MyqK00cVzkEdR9CD0OGe34nzqqX3jQGyjZEBNEYkh54KetX71rC57WpqfZPFpfmMBb979nVelg9nngOjRImGAXL8/8tWOj69ck7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178066; 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=s1pWRCuruOAucvYcFjm/bmkkxf8M34TlMg+2ydS6Cmg=; b=D+akcwlVVrmr80u5DzUzfwB73RgyFNjJ20d/9jg74TQbHKz5p25l47Tyio7L3Ic3Nxqx1xgfLQq9l1+SgIfQdt0U/kC7ijWOa/nzUAKEQ3m/jbwfVSVJTggZ5dPT8kiBX0Tunbkm3IPG9J7iiuBjfclWjlJVH2IW/uYhmxS0qOA= 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 176917806605847.727024202066445; Fri, 23 Jan 2026 06:21:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHyx-0000Pv-A0; Fri, 23 Jan 2026 09:17:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHyV-0008Sz-21 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17: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 1vjHyR-0003d1-BZ for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17: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 836613380B; Fri, 23 Jan 2026 14:17:10 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A66C61395E; Fri, 23 Jan 2026 14:17: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 8HNfGeSCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177830; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s1pWRCuruOAucvYcFjm/bmkkxf8M34TlMg+2ydS6Cmg=; b=lyrAaI2SYzGAuEgPQJUq6QRBl4g9GgSta2QPfLpdTPZ5UsENpxfb5Pfz1ePegjlWj2vXwb 0efk3lznrHytcnqOfAVQbB3jSV6R5ckyLGTLWjQAQ9OVd8q0OdHYKnAsS14RLyRESGuVNA uBVfjXLHvsRCFtiLf7X32VxR9PXLmI8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177830; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s1pWRCuruOAucvYcFjm/bmkkxf8M34TlMg+2ydS6Cmg=; b=9GwgG2KgZPsWt/QER/XBW/9TWsFwSJ17uTeHey1tVIVs3tJDL5qX7RRG0YXMScSiyTDw+U +/IK/q0sMCNErIDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=lyrAaI2S; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9GwgG2Kg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177830; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s1pWRCuruOAucvYcFjm/bmkkxf8M34TlMg+2ydS6Cmg=; b=lyrAaI2SYzGAuEgPQJUq6QRBl4g9GgSta2QPfLpdTPZ5UsENpxfb5Pfz1ePegjlWj2vXwb 0efk3lznrHytcnqOfAVQbB3jSV6R5ckyLGTLWjQAQ9OVd8q0OdHYKnAsS14RLyRESGuVNA uBVfjXLHvsRCFtiLf7X32VxR9PXLmI8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177830; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s1pWRCuruOAucvYcFjm/bmkkxf8M34TlMg+2ydS6Cmg=; b=9GwgG2KgZPsWt/QER/XBW/9TWsFwSJ17uTeHey1tVIVs3tJDL5qX7RRG0YXMScSiyTDw+U +/IK/q0sMCNErIDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 04/25] migration: Cleanup TLS handshake hostname passing Date: Fri, 23 Jan 2026 11:16:34 -0300 Message-ID: <20260123141656.6765-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-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)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:dkim, suse.de:email, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 836613380B X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178067317158500 Content-Type: text/plain; charset="utf-8" The TLS hostname is doing a tour around the world just to be cached into s->hostname. We're already abusing MigrationState by doing that, so incorporate the s->hostname into migration_tls_hostname() and stop passing the string around. The old route was roughly: -transport code (socket.c, fd.c, etc): if (SOCKET_ADDRESS_TYPE_INET) hostname =3D saddr->u.inet.host else hostname =3D NULL migration_channel_connect(..., hostname) s->hostname =3D hostname; migration_tls_client_create(..., hostname) if (migrate_tls_hostname()) qio_channel_tls_new_client(migrate_tls_hostname()) else qio_channel_tls_new_client(hostname) -postcopy_preempt_setup: postcopy_preempt_send_channel_new migration_tls_client_create(..., s->hostname) New route is: -socket.c only: if SOCKET_ADDRESS_TYPE_INET s->hostname =3D saddr->u.inet.host migration_channel_connect() migration_tls_client_create() qio_channel_tls_new_client(migrate_tls_hostname()) -postcopy_preempt_setup: postcopy_preempt_send_channel_new migration_tls_client_create() qio_channel_tls_new_client(migrate_tls_hostname()) Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 6 ++---- migration/channel.h | 1 - migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/multifd.c | 9 +++------ migration/options.c | 5 +++++ migration/postcopy-ram.c | 2 +- migration/socket.c | 9 +++------ migration/tls.c | 17 ++++------------- migration/tls.h | 2 -- migration/trace-events | 10 +++++----- 12 files changed, 26 insertions(+), 41 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index b4ab676048..ba14f66d85 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,20 +60,18 @@ void migration_channel_process_incoming(QIOChannel *ioc) * * @s: Current migration state * @ioc: Channel to which we are connecting - * @hostname: Where we want to connect * @error: Error indicating failure to connect, free'd here */ void migration_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error *error) { trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), hostname, error); + ioc, object_get_typename(OBJECT(ioc)), error); =20 if (!error) { if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc, hostname, &error); + migration_tls_channel_connect(s, ioc, &error); =20 if (!error) { /* tls_channel_connect will call back to this diff --git a/migration/channel.h b/migration/channel.h index 5bdb8208a7..2215091323 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -22,7 +22,6 @@ void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error *error_in); =20 int migration_channel_read_peek(QIOChannel *ioc, diff --git a/migration/exec.c b/migration/exec.c index 20e6cccf8c..78fe0fff13 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index 9bf9be6acb..c956b260a4 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index bb8031e3c7..c490f2b219 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/multifd.c b/migration/multifd.c index c9d4a67a46..98d62431db 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -810,12 +810,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; } @@ -825,7 +823,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); @@ -872,8 +870,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 ac410676ef..f5ef93f193 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1966,7 +1966,7 @@ postcopy_preempt_send_channel_new(QIOTask *task, gpoi= nter opaque) } =20 if (migrate_channel_requires_tls_upgrade(ioc)) { - tioc =3D migration_tls_client_create(ioc, s->hostname, &local_err); + tioc =3D migration_tls_client_create(ioc, &local_err); if (!tioc) { goto out; } diff --git a/migration/socket.c b/migration/socket.c index 9e379bf56f..426f363b99 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -44,7 +44,6 @@ void socket_send_channel_create(QIOTaskFunc f, void *data) =20 struct SocketConnectData { MigrationState *s; - char *hostname; }; =20 static void socket_connect_data_free(void *opaque) @@ -53,7 +52,6 @@ static void socket_connect_data_free(void *opaque) if (!data) { return; } - g_free(data->hostname); g_free(data); } =20 @@ -69,7 +67,7 @@ static void socket_outgoing_migration(QIOTask *task, goto out; } =20 - trace_migration_socket_outgoing_connected(data->hostname); + trace_migration_socket_outgoing_connected(); =20 if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { @@ -77,7 +75,7 @@ static void socket_outgoing_migration(QIOTask *task, } =20 out: - migration_channel_connect(data->s, sioc, data->hostname, err); + migration_channel_connect(data->s, sioc, err); object_unref(OBJECT(sioc)); } =20 @@ -96,7 +94,7 @@ void socket_start_outgoing_migration(MigrationState *s, outgoing_args.saddr =3D addr; =20 if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET) { - data->hostname =3D g_strdup(saddr->u.inet.host); + s->hostname =3D g_strdup(saddr->u.inet.host); } =20 qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing"); @@ -180,4 +178,3 @@ void socket_start_incoming_migration(SocketAddress *sad= dr, qapi_free_SocketAddress(address); } } - diff --git a/migration/tls.c b/migration/tls.c index 1df31bdcbb..82f58cbc78 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -112,12 +112,11 @@ static void migration_tls_outgoing_handshake(QIOTask = *task, } else { trace_migration_tls_outgoing_handshake_complete(); } - migration_channel_connect(s, ioc, NULL, err); + migration_channel_connect(s, ioc, err); object_unref(OBJECT(ioc)); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, - const char *hostname, Error **errp) { QCryptoTLSCreds *creds; @@ -127,29 +126,21 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel= *ioc, return NULL; } =20 - const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname) { - hostname =3D tls_hostname; - } - - return qio_channel_tls_new_client(ioc, creds, hostname, errp); + return qio_channel_tls_new_client(ioc, creds, migrate_tls_hostname(), = errp); } =20 void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error **errp) { QIOChannelTLS *tioc; =20 - tioc =3D migration_tls_client_create(ioc, hostname, errp); + tioc =3D migration_tls_client_create(ioc, errp); if (!tioc) { return; } =20 - /* Save hostname into MigrationState for handshake */ - s->hostname =3D g_strdup(hostname); - trace_migration_tls_outgoing_handshake_start(hostname); + trace_migration_tls_outgoing_handshake_start(); qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing"); =20 if (migrate_postcopy_ram() || migrate_return_path()) { diff --git a/migration/tls.h b/migration/tls.h index 7607cfe803..7cd9c76013 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -27,12 +27,10 @@ void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp); =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, - const char *hostname, Error **errp); =20 void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error **errp); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ diff --git a/migration/trace-events b/migration/trace-events index bf11b62b17..da8f909cac 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -149,10 +149,10 @@ multifd_send_sync_main_wait(uint8_t id) "channel %u" multifd_send_terminate_threads(void) "" multifd_send_thread_end(uint8_t id, uint64_t packets) "channel %u packets = %" PRIu64 multifd_send_thread_start(uint8_t id) "%u" -multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *ho= stname) "ioc=3D%p tioc=3D%p hostname=3D%s" +multifd_tls_outgoing_handshake_start(void *ioc, void *tioc) "ioc=3D%p tioc= =3D%p" multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=3D%p= err=3D%s" multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=3D%p" -multifd_set_outgoing_channel(void *ioc, const char *ioctype, const char *h= ostname) "ioc=3D%p ioctype=3D%s hostname=3D%s" +multifd_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p io= ctype=3D%s" =20 # migration.c migrate_set_state(const char *new_state) "new state %s" @@ -204,7 +204,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype, const char = *hostname, void *err) "ioc=3D%p ioctype=3D%s hostname=3D%s err=3D%p" +migration_set_outgoing_channel(void *ioc, const char *ioctype, void *err) = "ioc=3D%p ioctype=3D%s err=3D%p" =20 # global_state.c migrate_state_too_big(void) "" @@ -328,11 +328,11 @@ migration_file_incoming(const char *filename) "filena= me=3D%s" =20 # socket.c migration_socket_incoming_accepted(void) "" -migration_socket_outgoing_connected(const char *hostname) "hostname=3D%s" +migration_socket_outgoing_connected(void) "" migration_socket_outgoing_error(const char *err) "error=3D%s" =20 # tls.c -migration_tls_outgoing_handshake_start(const char *hostname) "hostname=3D%= s" +migration_tls_outgoing_handshake_start(void) "" migration_tls_outgoing_handshake_error(const char *err) "err=3D%s" migration_tls_outgoing_handshake_complete(void) "" migration_tls_incoming_handshake_start(void) "" --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177946; cv=none; d=zohomail.com; s=zohoarc; b=ayXsZudbDIGflXGdIxKOklxkLCCqQbT+dVXh1m1nwfcUvapswmyFgOZUaXaLbHhEbSPvKeQO47E43u6BbN7ZeApblzQrMYAOdw7TNk5NFPPcdJWTtXqre/Tz6eoXvXjLFHTwBndjS0I1fDfe+lHlKfnLz+8vGrlguB1zO5kiS28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177946; 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=9gmgoGHSjf3TW+xdmHPZRI8uN6+ODOqPrDGzvVz83Rk=; b=SjjEIfG9EBu4EvAitoqeuJZMRymz6lzaWw434bxh9byVxrs6waUv1Q25rdZlVXed4DuU/igtpePYIRqJfEbWpYOw99Hu8H5oGzpnru6G6Pk63tVXMfIIHl1SgyXebez476iXUlanU4h+rMhlD0Ta1HFzUiDJi2Rxi/MgCmvYIOc= 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 1769177946399634.9687254986039; Fri, 23 Jan 2026 06:19:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHz9-0000dA-6v; Fri, 23 Jan 2026 09:18: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 1vjHyc-0008VA-SB for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:32 -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 1vjHya-0003dh-Ch for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:29 -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 0E51A33809; Fri, 23 Jan 2026 14:17: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 0AA061395E; Fri, 23 Jan 2026 14:17: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 eFLPLuaCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177833; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9gmgoGHSjf3TW+xdmHPZRI8uN6+ODOqPrDGzvVz83Rk=; b=r0jttY5kisYnXQxUXInr9+5Ab5RmxujCH+ENmu0lrRJAvYF/qxddRk0LxwSlB+FtFN+g4b 8l7fcs/huQEmpne8hejTKxhtNtJF55rTonB8VLK97q2CzKaD5EI81cj+zZEpWKFR4oZhcd PcFh3i6HV3H6m98cNx/KtwrYQktBKZA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177833; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9gmgoGHSjf3TW+xdmHPZRI8uN6+ODOqPrDGzvVz83Rk=; b=hBQzpmRfOzhKW5HnlY1fHHL7JRbNvxzYXS6IOpD+ZJMhhDftsWfV8miJj3CM1qvHrtgQWF 6/QavCcX6okOvQCg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=r0jttY5k; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=hBQzpmRf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177833; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9gmgoGHSjf3TW+xdmHPZRI8uN6+ODOqPrDGzvVz83Rk=; b=r0jttY5kisYnXQxUXInr9+5Ab5RmxujCH+ENmu0lrRJAvYF/qxddRk0LxwSlB+FtFN+g4b 8l7fcs/huQEmpne8hejTKxhtNtJF55rTonB8VLK97q2CzKaD5EI81cj+zZEpWKFR4oZhcd PcFh3i6HV3H6m98cNx/KtwrYQktBKZA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177833; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9gmgoGHSjf3TW+xdmHPZRI8uN6+ODOqPrDGzvVz83Rk=; b=hBQzpmRfOzhKW5HnlY1fHHL7JRbNvxzYXS6IOpD+ZJMhhDftsWfV8miJj3CM1qvHrtgQWF 6/QavCcX6okOvQCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 05/25] migration: Move postcopy_try_recover into migration_incoming_process Date: Fri, 23 Jan 2026 11:16:35 -0300 Message-ID: <20260123141656.6765-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, suse.de:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 0E51A33809 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177948697154100 Content-Type: text/plain; charset="utf-8" The postcopy_try_recover() call doesn't need to be duplicated, move it into migration_incoming_process(). This removes code from migration_fd_process_incoming() so it can be removed in the near future. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f3d541dc5b..a0b50873ca 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -943,12 +943,6 @@ static void migration_incoming_setup(QEMUFile *f) qemu_file_set_blocking(f, false, &error_abort); } =20 -void migration_incoming_process(void) -{ - Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); - qemu_coroutine_enter(co); -} - /* Returns true if recovered from a paused migration, otherwise false */ static bool postcopy_try_recover(void) { @@ -982,12 +976,19 @@ static bool postcopy_try_recover(void) return false; } =20 +void migration_incoming_process(void) +{ + if (postcopy_try_recover()) { + return; + } + + Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); + qemu_coroutine_enter(co); +} + void migration_fd_process_incoming(QEMUFile *f) { migration_incoming_setup(f); - if (postcopy_try_recover()) { - return; - } migration_incoming_process(); } =20 @@ -1087,10 +1088,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc,= Error **errp) } =20 if (migration_has_main_and_multifd_channels()) { - /* If it's a recovery, we're done */ - if (postcopy_try_recover()) { - return; - } migration_incoming_process(); } } --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177952; cv=none; d=zohomail.com; s=zohoarc; b=b/NJ6mMXFPofJ1JZrHXvIlzqFJ8C6pLr/FP5/b+xPNRfD+ta48//ZByunA/4THiQKNE+nz47r7DiCYeympi/zwa7bPbVS+TpJanw67PYuFflF/tJSA9W4+giwipwGYiMnFqkPX/gpmOmNs6qQ0JYC3YWwRlYFT9jhmVLFNpOi8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177952; 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=M/QZtDu7HIJudsDmcYL8xgjjE+4D+oJrXIclJ+By0XI=; b=ZqbuU+8eey9BQuFZymhX4k3172lk0gOfL8lfz+U1zlBsnxBmsUEQpxdurPkte7aMWD5y/043VqNrL2U8KSkNXuc+EGh1PNR59bluspv4wJjF/DP1CwbJ6EEGpau3TETSCFXxlPOO7L+3o1Rt2vwYQerG81zPI1KaEdSRptnQ+aI= 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 1769177952942997.1541906656173; Fri, 23 Jan 2026 06:19:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHz8-0000X6-Nf; Fri, 23 Jan 2026 09:18:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHyj-00008O-0l for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:38 -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 1vjHyg-0003eh-VD for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:36 -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 E5F5A33810; Fri, 23 Jan 2026 14:17:15 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8FD8C1395E; Fri, 23 Jan 2026 14:17: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 AJ8vE+mCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177836; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/QZtDu7HIJudsDmcYL8xgjjE+4D+oJrXIclJ+By0XI=; b=DVm/xHo26Ccj4+nQ1dKqIyyeTLVa9yFE7x/FeTf15o7vprWw1zzjDe9cBit8jyfdIqR2ZW EQojseovSc7NzjniFruxppqzOxfXJXNZSNfm1DpTlni4JCeufN0Rs4PK3oYsZ8+dwGK17H 1vX1hYJn6oEoyw8M8MCnr/75mOQ3J6A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177836; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/QZtDu7HIJudsDmcYL8xgjjE+4D+oJrXIclJ+By0XI=; b=pwfpffhSTaCd9S2GyWjMuPek9OQC9/mYcTmSVUupCdBkf3jmNVI6jfIz0Y1QmWPPgboVE2 mEbz9l0SI96DkVAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/QZtDu7HIJudsDmcYL8xgjjE+4D+oJrXIclJ+By0XI=; b=RsZXmGtAiij9XUezOui4KPMBf/Dow7+UuGRB/MMW8g7EPbW5tk3yGQBjtkqk4JZEXYR3SE TAVoZ549xby8qAqxqAaCrWITs5fpD3C/hSLe/FI6tFtfIPA+bxfBjmH4KtnPAZkr2snDNI G9nnH+Whpp+FA/O/iF3/NlKbWuhvgvw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/QZtDu7HIJudsDmcYL8xgjjE+4D+oJrXIclJ+By0XI=; b=1AKqzg/pWrthh9eYu37Yi6C0x4jMtFTvqqcPX8/QUEPA0bJmYD6PhYp9cX3+60CYa3gnOS XAVsPb3OERUAEUBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Mark Kanda , Ben Chaney , Prasad Pandit Subject: [PATCH v4 06/25] migration: Use migrate_mode() to query for cpr-transfer Date: Fri, 23 Jan 2026 11:16:36 -0300 Message-ID: <20260123141656.6765-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[oracle.com:email,suse.de:mid,suse.de:email,fedoraproject.org:email,imap1.dmz-prg2.suse.org:helo]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(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 client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769177954637158500 Content-Type: text/plain; charset="utf-8" cpr_set_incoming_mode() is only called on the target side, so migrate_mode() on the source side is the same as s->parameters.mode. Use the function to reduce explicit access to s->parameters, we have options.c for that. Cc: Mark Kanda Cc: Ben Chaney Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/cpr-exec.c | 2 +- migration/migration.c | 27 +++++++++++++-------------- migration/migration.h | 5 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index da287d8031..e315a30f92 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -164,7 +164,7 @@ static void cpr_exec_cb(void *opaque) err =3D NULL; =20 /* Note, we can go from state COMPLETED to FAILED */ - migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); =20 if (!migration_block_activate(&err)) { /* error was already reported */ diff --git a/migration/migration.c b/migration/migration.c index a0b50873ca..16085eb8d6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1534,7 +1534,7 @@ static void migration_cleanup(MigrationState *s) } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; - migration_call_notifiers(s, type, NULL); + migration_call_notifiers(type, NULL); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 @@ -1694,10 +1694,9 @@ void migration_remove_notifier(NotifierWithReturn *n= otify) } } =20 -int migration_call_notifiers(MigrationState *s, MigrationEventType type, - Error **errp) +int migration_call_notifiers(MigrationEventType type, Error **errp) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D migrate_mode(); MigrationEvent e; NotifierWithReturn *notifier; GSList *elem, *next; @@ -1778,9 +1777,9 @@ bool migration_thread_is_self(void) return qemu_thread_is_self(&s->thread); } =20 -bool migrate_mode_is_cpr(MigrationState *s) +bool migrate_mode_is_cpr(void) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D migrate_mode(); return mode =3D=3D MIG_MODE_CPR_REBOOT || mode =3D=3D MIG_MODE_CPR_TRANSFER || mode =3D=3D MIG_MODE_CPR_EXEC; @@ -2134,7 +2133,7 @@ static bool migrate_prepare(MigrationState *s, bool r= esume, Error **errp) } } =20 - if (migrate_mode_is_cpr(s)) { + if (migrate_mode_is_cpr()) { const char *conflict =3D NULL; =20 if (migrate_postcopy()) { @@ -2250,7 +2249,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; } @@ -2275,7 +2274,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 @@ -2850,7 +2849,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) * at the transition to postcopy and after the device state; in partic= ular * spice needs to trigger a transition now */ - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_DONE, NULL); =20 migration_downtime_end(ms); =20 @@ -2899,7 +2898,7 @@ fail: migrate_set_state(&ms->state, ms->state, MIGRATION_STATUS_FAILED); } migration_block_activate(NULL); - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_FAILED, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); bql_unlock(); return -1; } @@ -3001,7 +3000,7 @@ static int migration_completion_precopy(MigrationStat= e *s) =20 bql_lock(); =20 - if (!migrate_mode_is_cpr(s)) { + if (!migrate_mode_is_cpr()) { ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { goto out_unlock; @@ -4047,7 +4046,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) rate_limit =3D migrate_max_bandwidth(); =20 /* Notify before starting migration thread */ - if (migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP, &local_er= r)) { + if (migration_call_notifiers(MIG_EVENT_PRECOPY_SETUP, &local_err))= { goto fail; } } @@ -4083,7 +4082,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) return; } =20 - if (migrate_mode_is_cpr(s)) { + if (migrate_mode_is_cpr()) { ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { error_setg(&local_err, "migration_stop_vm failed, error %d", -= ret); diff --git a/migration/migration.h b/migration/migration.h index ccc4e536a5..8b55d4741a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -538,8 +538,7 @@ bool migrate_has_error(MigrationState *s); =20 void migration_connect(MigrationState *s, Error *error_in); =20 -int migration_call_notifiers(MigrationState *s, MigrationEventType type, - Error **errp); +int migration_call_notifiers(MigrationEventType type, Error **errp); =20 int migrate_init(MigrationState *s, Error **errp); bool migration_is_blocked(Error **errp); @@ -548,7 +547,7 @@ bool migration_in_postcopy(void); bool migration_postcopy_is_alive(MigrationStatus state); MigrationState *migrate_get_current(void); bool migration_has_failed(MigrationState *); -bool migrate_mode_is_cpr(MigrationState *); +bool migrate_mode_is_cpr(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177915; cv=none; d=zohomail.com; s=zohoarc; b=k+bemVYgOLjd+nLbYXvuV181aMTrA24dcRgD092z6LhHAziUwpKAvalmiQAz4DKeKl3CMFLTL9E+bdvXJTny4vnn3IbjjtQcO08xOLUxS7fmiMHqFnlsw+EJxcPG6QQq1tQtSjiJZTyFqUTIS2WOP+nO4pmT2/JS6hiep8wTT5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177915; 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=kuqbPH569qjHJCkNk6NglGi2HTTW+35tRNlJ1R5Lm2o=; b=YAM5doR8GHaPaVJOugDUb+2SwqchOREFk0Njp40L75MFoJHhn/6qGSBhhyvi2tghu24lHpwT61Ru/Q4NRBCifnAWrhqa6gtaRejCrXVJeTMwUEUEvlj6mb5SIoUxSBLOk5hooqVXDjUu0DxsR94RjsaQbtMZvzB6/PqGO3VjjD4= 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 1769177915901804.6601410893063; Fri, 23 Jan 2026 06:18:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzA-0000iI-TT; Fri, 23 Jan 2026 09:18:05 -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 1vjHyp-0000GL-C4 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:44 -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 1vjHym-0003fK-QR for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:42 -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 41E8A33813; Fri, 23 Jan 2026 14:17:18 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 636831395E; Fri, 23 Jan 2026 14:17:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OJxjCeyCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177838; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kuqbPH569qjHJCkNk6NglGi2HTTW+35tRNlJ1R5Lm2o=; b=xN7m7ngdFpM1Th2WnE/AfsL9DmfRmMGg9U2akuqGqf1au8dp6ucLWQ4Raqd15lYGQu4SXp LfHVvqHhkdQ6EsSFMUGs2Pn5S6tm8ZxCLzbAtU2W3N7xzaxkoBS8BhM/yQtimC0TRGR6lY 4cFWmp0onCq7q2wmE3ucCPJaQ80MNL4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177838; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kuqbPH569qjHJCkNk6NglGi2HTTW+35tRNlJ1R5Lm2o=; b=Pfile7aQcrDlRtgBfB+DW6TgFU6j8Df0yREjYspL7poVKH+QoFE4suqGSDGkcUhU/ZwJgn pkK8zQOP4UoQzpAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xN7m7ngd; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Pfile7aQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177838; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kuqbPH569qjHJCkNk6NglGi2HTTW+35tRNlJ1R5Lm2o=; b=xN7m7ngdFpM1Th2WnE/AfsL9DmfRmMGg9U2akuqGqf1au8dp6ucLWQ4Raqd15lYGQu4SXp LfHVvqHhkdQ6EsSFMUGs2Pn5S6tm8ZxCLzbAtU2W3N7xzaxkoBS8BhM/yQtimC0TRGR6lY 4cFWmp0onCq7q2wmE3ucCPJaQ80MNL4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177838; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kuqbPH569qjHJCkNk6NglGi2HTTW+35tRNlJ1R5Lm2o=; b=Pfile7aQcrDlRtgBfB+DW6TgFU6j8Df0yREjYspL7poVKH+QoFE4suqGSDGkcUhU/ZwJgn pkK8zQOP4UoQzpAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 07/25] migration: Free the error earlier in the resume case Date: Fri, 23 Jan 2026 11:16:37 -0300 Message-ID: <20260123141656.6765-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:mid,suse.de:email,fedoraproject.org:email]; 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-Queue-Id: 41E8A33813 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177918750158500 Content-Type: text/plain; charset="utf-8" Freeing the error at migration_connect() is redundant in the normal migration case. The freeing already happened at migrate_init(): qmp_migrate() -> migrate_prepare() -> migrate_init() -> qmp_migrate_finish() -> *_start_outgoing_migration() -> migration_channel_connect() -> migration_connect() For the resume case, migrate_prepare() returns early and doesn't reach migrate_init(). Move the extra migrate_error_free() call to migrate_prepare() along with the resume check. Also change migrate_init() to use migrate_error_free(), so it's easier to see where are the places the error gets freed. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 16085eb8d6..913e2b9921 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1809,8 +1809,8 @@ int migrate_init(MigrationState *s, Error **errp) s->setup_time =3D 0; s->start_postcopy =3D false; s->migration_thread_running =3D false; - error_free(s->error); - s->error =3D NULL; + + migrate_error_free(s); =20 if (should_send_vmdesc()) { s->vmdesc =3D json_writer_new(false); @@ -2085,6 +2085,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; } @@ -4013,13 +4020,6 @@ void migration_connect(MigrationState *s, Error *err= or_in) bool resume =3D (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP); int ret; =20 - /* - * If there's a previous error, free it and prepare for another one. - * Meanwhile if migration completes successfully, there won't have an = error - * dumped when calling migration_cleanup(). - */ - migrate_error_free(s); - s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177986; cv=none; d=zohomail.com; s=zohoarc; b=mvPVjEz8pp5ilhYLlZO7i57pmA9i0GT9jYehFwQQXd6v8p1yNNTHji4CSyCd6ViscEFSx03btABhZELi5vFVTOfXo+2jZxMGsyyAHsMpzXKOMk/nggQdHMd+IG29wHnQqdXa4Htq2wdENBV4BXWdSlQ1NnnlCalrg0VfVi99VBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177986; 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=lTBNi7O7VSbyPdSafD8vgsPIwsj4ueKe6JefrgHMCvM=; b=TzZLFTqmHFyP9P9sFiaUr6XOjQbtj8An8ppUjaVG/8RErjVwjqcinn5ZGpsvow3KjDwOXHCzZlnbnkIKX4eybbg5EmJ/spVoCJgylYqr/unZbG3g4JPTVh/7aWq3b1hFQG9gm1F/6Q0QesspJoYxi59kLd4E7B3HMIsFJt86AEo= 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 1769177986672440.7866014805445; Fri, 23 Jan 2026 06:19:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHyv-0000LH-5n; Fri, 23 Jan 2026 09:17:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHyW-0008TC-5L for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:28 -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 1vjHyU-0003dO-Hf for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:23 -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 91E625BCCF; Fri, 23 Jan 2026 14:17:20 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B60361395E; Fri, 23 Jan 2026 14:17:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KCJhHe6Cc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177840; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTBNi7O7VSbyPdSafD8vgsPIwsj4ueKe6JefrgHMCvM=; b=FJKCxeFz8TrutLKQ3+u7e9lbeLQD20t56EAnC/bSjBCMFerpPpqURatBGB04A80RFTqhsV CCfPUi6eDHUrS6K0vBFO34JMu7wAcAoJglhuJolpI5E/Q/t6rSVoqt5Cv9uLO0DMBSyV9i VH7CDvKhX+oSEiHSTI9swmqR0QcOlbc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177840; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTBNi7O7VSbyPdSafD8vgsPIwsj4ueKe6JefrgHMCvM=; b=f+NDLhC7rBJfvoqAJRPSomUZloUoXr4Rv9pWyusnr5GBKMXPY9JO4jtYFCD8jMo51nOKVt mG/iG6ZiQd1aM+BA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=FJKCxeFz; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=f+NDLhC7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177840; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTBNi7O7VSbyPdSafD8vgsPIwsj4ueKe6JefrgHMCvM=; b=FJKCxeFz8TrutLKQ3+u7e9lbeLQD20t56EAnC/bSjBCMFerpPpqURatBGB04A80RFTqhsV CCfPUi6eDHUrS6K0vBFO34JMu7wAcAoJglhuJolpI5E/Q/t6rSVoqt5Cv9uLO0DMBSyV9i VH7CDvKhX+oSEiHSTI9swmqR0QcOlbc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177840; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTBNi7O7VSbyPdSafD8vgsPIwsj4ueKe6JefrgHMCvM=; b=f+NDLhC7rBJfvoqAJRPSomUZloUoXr4Rv9pWyusnr5GBKMXPY9JO4jtYFCD8jMo51nOKVt mG/iG6ZiQd1aM+BA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 08/25] migration: Move error reporting out of migration_cleanup Date: Fri, 23 Jan 2026 11:16:38 -0300 Message-ID: <20260123141656.6765-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,fedoraproject.org:email,suse.de:dkim,suse.de:mid,suse.de:email]; 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-Queue-Id: 91E625BCCF X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177988753158500 Content-Type: text/plain; charset="utf-8" In the next patches migration_cleanup() will be used in qmp_migrate(), which currently does not show an error message. Move the error reporting out of migration_cleanup() to avoid duplicate messages. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 913e2b9921..1bb59b8305 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1528,10 +1528,6 @@ static void migration_cleanup(MigrationState *s) MIGRATION_STATUS_CANCELLED); } =20 - if (s->error) { - /* It is used on info migrate. We can't free it */ - error_report_err(error_copy(s->error)); - } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; migration_call_notifiers(type, NULL); @@ -1540,7 +1536,12 @@ static void migration_cleanup(MigrationState *s) =20 static void migration_cleanup_bh(void *opaque) { - migration_cleanup(opaque); + MigrationState *s =3D opaque; + + migration_cleanup(s); + if (s->error) { + error_report_err(error_copy(s->error)); + } } =20 /* @@ -4023,18 +4024,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 @@ -4113,8 +4108,10 @@ fail: if (s->state !=3D MIGRATION_STATUS_CANCELLING) { migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); } - error_report_err(local_err); migration_cleanup(s); + if (s->error) { + error_report_err(error_copy(s->error)); + } } =20 static void migration_class_init(ObjectClass *klass, const void *data) --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177906; cv=none; d=zohomail.com; s=zohoarc; b=FWc8gBm63VGJVImiy8pbx+RSjDLDNEq56z0KVrota7LC2obNoLhLoBnOe3SUA2JkHcXUI2XNneFFQIspqVqj2LpY812tY169uWpMowSDjV2VN+qwKXmx4dRS8ChJ4Zlep1FZFZKQ1LgEuVgpbzfdBEoNlCQ330tazfvsURL9s30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177906; 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=5uw7EwYvc2vbCK46LCxyZnB1rCGkQfOwE0fpg6avZbc=; b=AE5UxpIXbaVYVkrPuwPRuOztkHUhaMatxLh3E9AWYu/FIel6XyOEtdRAnL59dj8YjhqIzGx3+kFpkAq2wDlJXbH9ErL8W7azwK3CsMwAPJxwUh6f3tl/hrjWDrbSIdttwQ9tMfz8NuqB8I/VONWxA8kW1JustpC2CvLwDqwTBnY= 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 1769177906452861.3057095916457; Fri, 23 Jan 2026 06:18:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHyu-0000Kl-Cr; Fri, 23 Jan 2026 09:17:48 -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 1vjHyd-0008VG-7M for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:32 -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 1vjHya-0003dl-Cd for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:30 -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 E5CE55BCCE; Fri, 23 Jan 2026 14:17:22 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 145331395E; Fri, 23 Jan 2026 14:17:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uLULMfCCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177843; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5uw7EwYvc2vbCK46LCxyZnB1rCGkQfOwE0fpg6avZbc=; b=M/GOEv4+wdTT4SeGQRBBX1pt/+QLM9WWjrAG5rMkNhVgz3EvMd1c6cZwiyJe/z8aG7xpqM ocBJF+uWcvXdIK7EaIDuIx1eF+6qNl/+KGGt1B96lVU/H5DXcoaBB+2yLQdRoYUT6C98XY TZGv/1n2ULWTgXTav5uPa26cKQH6lEs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177843; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5uw7EwYvc2vbCK46LCxyZnB1rCGkQfOwE0fpg6avZbc=; b=7IyMxbJfVfVSUA2TGjpgWAi7BfvVC6je4KCcF8P3V3xHlPzlEbR3XkbvjGEVnM+f0BCj9/ 7jLSPsPZcJzr1zAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=KSWOsE2y; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=iJp5VBQV DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177842; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5uw7EwYvc2vbCK46LCxyZnB1rCGkQfOwE0fpg6avZbc=; b=KSWOsE2yLr7zluN3UiGv+yNxIldJihZUMYC+5dncrmEQ4mkvgI37unKeSsOCM6vgFgDIPq /DFrrnWhypmkMwRQBFoCOhTNeCYlv1v7b7yUs8xvFLUx9aZpmw7LFXTvOF7Mko/0CA+t/b wiQVcL66xo1bDjHXd2qr53N2QclgEjc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177842; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5uw7EwYvc2vbCK46LCxyZnB1rCGkQfOwE0fpg6avZbc=; b=iJp5VBQVeaAauCKqUpTJc9yaruduhuCpRkA8QmzPSBqDATCHTiTedO9eQrYk6tfGLW+WgO 6M7c/nsiBR0JwCDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 09/25] migration: Expand migration_connect_error_propagate to cover cancelling Date: Fri, 23 Jan 2026 11:16:39 -0300 Message-ID: <20260123141656.6765-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:mid,suse.de:email,fedoraproject.org:email]; 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-Queue-Id: E5CE55BCCE X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1769177908830158500 Content-Type: text/plain; charset="utf-8" Cover the CANCELLING state in migration_connect_error_propagate() and use it to funnel errors from migrate_prepare() until the end of migration_connect(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 1bb59b8305..36b14a1b56 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1573,18 +1573,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 @@ -1595,7 +1602,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 @@ -4104,10 +4114,7 @@ void migration_connect(MigrationState *s, Error *err= or_in) return; =20 fail: - migrate_error_propagate(s, error_copy(local_err)); - if (s->state !=3D MIGRATION_STATUS_CANCELLING) { - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); - } + migration_connect_error_propagate(s, local_err); migration_cleanup(s); if (s->error) { error_report_err(error_copy(s->error)); --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178128; cv=none; d=zohomail.com; s=zohoarc; b=PQVbUVl+7z7W/mLhTkx1hx/hnfbpTPJbgeVK4EFWjs6J32fNtPUSrtUd74onJrW7i0IzCAY7I6obFhJYY6S2SywshCfmChP8ErbbBNmCPnOHLaOqp2MRYoMUFi80RCZgZGut8ZU9I2RoZvRIiLLmBb0XHUMmMOAxxJblXRtyAwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178128; 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=TpoPxFAfbScFkYVabBEz2lMDswSTrsc4+kovjmLUUx4=; b=dx7gH2PHgzCqNwyA/krjeNSqalW3VV68YpiAlKxV4DAHC1dkzurS57sJ4k9GBi06Z7i5b35LIcQ7pvDMItuzPsPppLP88VcNXihVjYgEED24K9LgwZHs57YTUeM24oBuFfmwJ2gJLrp/nIf1DDXm5uHxIlEqyNLy2Io7h+HtcTg= 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 1769178128975965.7990752737885; Fri, 23 Jan 2026 06:22:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzV-0001FS-AJ; Fri, 23 Jan 2026 09:18:25 -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 1vjHyv-0000Nj-4m for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:49 -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 1vjHyt-0003gJ-Hq for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:48 -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 3ED8D3380B; Fri, 23 Jan 2026 14:17:25 +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 641201395E; Fri, 23 Jan 2026 14:17:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aAVmCfOCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177845; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TpoPxFAfbScFkYVabBEz2lMDswSTrsc4+kovjmLUUx4=; b=HC+lOH/4npV6zgXJ6pLYZPO5W1rzfWnN9DypL0l0I7R/Q9J3ThWuLvkc5nDlL0h//ifGnZ 9urBf6TkVNLkE5f8sa9IGBGQUI6C9yVBef85oqnNGkQ1N9wVXo7ch9K7BkksYZgocUhMpH Xz/QCT11b5xo0/1/jA1jaNeWlgEvy+I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177845; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TpoPxFAfbScFkYVabBEz2lMDswSTrsc4+kovjmLUUx4=; b=sQCVV16hhmDQiisibia/OvcVOI/8Z2VCaRHk0Iun79S2ql/kNH2BOOkRU/+I5SIaY1aNRA mh8Zezkmsy+sWYDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="HC+lOH/4"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=sQCVV16h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177845; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TpoPxFAfbScFkYVabBEz2lMDswSTrsc4+kovjmLUUx4=; b=HC+lOH/4npV6zgXJ6pLYZPO5W1rzfWnN9DypL0l0I7R/Q9J3ThWuLvkc5nDlL0h//ifGnZ 9urBf6TkVNLkE5f8sa9IGBGQUI6C9yVBef85oqnNGkQ1N9wVXo7ch9K7BkksYZgocUhMpH Xz/QCT11b5xo0/1/jA1jaNeWlgEvy+I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177845; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TpoPxFAfbScFkYVabBEz2lMDswSTrsc4+kovjmLUUx4=; b=sQCVV16hhmDQiisibia/OvcVOI/8Z2VCaRHk0Iun79S2ql/kNH2BOOkRU/+I5SIaY1aNRA mh8Zezkmsy+sWYDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 10/25] migration: yank: Move register instance earlier Date: Fri, 23 Jan 2026 11:16:40 -0300 Message-ID: <20260123141656.6765-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-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%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,fedoraproject.org:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 3ED8D3380B X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178131208154100 Content-Type: text/plain; charset="utf-8" Move the register_instance call to migrate_prepare() so it can be paired with the unregister_instance at migration_cleanup(). Otherwise, the cleanup cannot be run when cpr_state_save() fails because the instance is registered only after it. When resuming from a paused postcopy migration, migrate_prepare() returns early, but migration_cleanup() doesn't run, so the yank will remain paired. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 36b14a1b56..2605eb2d10 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2178,11 +2178,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) @@ -2207,7 +2208,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()); @@ -2219,7 +2220,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; @@ -2272,8 +2272,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; } @@ -2297,28 +2296,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 || @@ -2341,9 +2334,6 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, } =20 if (local_err) { - if (!resume_requested) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); - } migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); return; --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178085; cv=none; d=zohomail.com; s=zohoarc; b=NniVBqJomF42LLTQqxN3xhJ0Q2sLcZXQQ9I2V0tWdGc9bFIoNPfEjA+Xi2neBMuGnyB7fS0XQzbRmMvLGqw8oHHCkWfmmBTS0+0JdinM+lDsufJpxRuCElrE0ikEhIWUku1c/JYbKKJcG0cnCrXEwc2GfGVYhghRr50q58MZiWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178085; 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=MCayuFmc9Ylos3QSBYyrLOGg1tnSbP2u2gpw6OUOL5g=; b=HtN/IzructtImte1pHAhN3y/VhcyPwTsam3iHQ9NNohQzPk+6mW6Kr2/pdyek0KAQRUBRuPKaOwxPltDygXV+0mdTGSniFIKeRE5Nqh/qS6xjDIwRaZimQyReA+XuIdrsYC33wGGxQbedBpUWnqeOJkZT2W+1bCTrJPNZn0h9nY= 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 1769178085101671.1626481095774; Fri, 23 Jan 2026 06:21:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzc-0002D6-4F; Fri, 23 Jan 2026 09:18:32 -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 1vjHz0-0000UE-62 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17: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 1vjHyy-0003h3-C4 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:53 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 883CD33812; Fri, 23 Jan 2026 14:17:27 +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 B02211395E; Fri, 23 Jan 2026 14:17:25 +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 wPojHPWCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177847; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MCayuFmc9Ylos3QSBYyrLOGg1tnSbP2u2gpw6OUOL5g=; b=pRy1VoxdexH278u5dwFcxtd3rdgxqH31o7xSJL1Jfw2xi/jXDRkxT8Uc/wxUqCqAniws4v J1h9cRWY+nTai/fdWPRNzZZ9itpSHC9L84sDvJBjh98PkqqgnhDnnRTEz2dE6kfCpXI0Ww M1f2iZNOA2JvfiXNqs+uKkm12pDatio= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177847; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MCayuFmc9Ylos3QSBYyrLOGg1tnSbP2u2gpw6OUOL5g=; b=nRFiqxXBtPV0UtZc42OJdd5she1W9jEE2XW36PR12YCF/oFKtARIFfJbE7fsw2zL6IKK5I FoNVd1zhQzVTyyCw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=pRy1Voxd; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=nRFiqxXB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177847; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MCayuFmc9Ylos3QSBYyrLOGg1tnSbP2u2gpw6OUOL5g=; b=pRy1VoxdexH278u5dwFcxtd3rdgxqH31o7xSJL1Jfw2xi/jXDRkxT8Uc/wxUqCqAniws4v J1h9cRWY+nTai/fdWPRNzZZ9itpSHC9L84sDvJBjh98PkqqgnhDnnRTEz2dE6kfCpXI0Ww M1f2iZNOA2JvfiXNqs+uKkm12pDatio= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177847; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MCayuFmc9Ylos3QSBYyrLOGg1tnSbP2u2gpw6OUOL5g=; b=nRFiqxXBtPV0UtZc42OJdd5she1W9jEE2XW36PR12YCF/oFKtARIFfJbE7fsw2zL6IKK5I FoNVd1zhQzVTyyCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 11/25] migration: Fold migration_cleanup() into migration_connect_error_propagate() Date: Fri, 23 Jan 2026 11:16:41 -0300 Message-ID: <20260123141656.6765-12-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:mid,suse.de:email,fedoraproject.org:email]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 883CD33812 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178086530154100 Content-Type: text/plain; charset="utf-8" Whenever an error occurs between migrate_init() and the start of migration_thread, do cleanup immediately. This allows the special casing for resume to be removed from migration_connect(), that check is now done at migration_connect_error_propagate() which already had a case for resume. The cleanup at qmp_migrate_finish_cb can also be removed because it will always be reached either via the error path at qmp_migrate_finish->migration_connect_error_propagate or via the migrate_cleanup_bh. The yank_unregister_instance at qmp_migrate() is now replaced by the one at migration_cleanup(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2605eb2d10..c3c1a09a6e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1574,15 +1574,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: @@ -1607,6 +1613,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,9 +2219,6 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, MigrationAddress *addr =3D opaque; =20 qmp_migrate_finish(addr, NULL); - - cpr_state_close(); - migrate_hup_delete(migrate_get_current()); qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } @@ -2220,7 +2227,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; @@ -2277,6 +2283,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; } @@ -2301,7 +2314,6 @@ void qmp_migrate(const char *uri, bool has_channels, =20 out: if (local_err) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); } @@ -4024,9 +4036,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)); } @@ -4105,7 +4114,6 @@ void migration_connect(MigrationState *s, Error *erro= r_in) =20 fail: migration_connect_error_propagate(s, local_err); - migration_cleanup(s); if (s->error) { error_report_err(error_copy(s->error)); } --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178116; cv=none; d=zohomail.com; s=zohoarc; b=bg7Kc1m0VwNA2jRB4btIszqDq7IsHI6kbLWirVfjqw6NeNnp1xtoGJajRoxTqZ7gYFrbcsEykwr1EM83/ATif6JVQlc/zymrfzNnBt/u7xkndFMkYSRqOiFNLZei2dhYdTEOAkDkKAb9Geb/uWNpkJv+zv7NM2qWXwZ56pOcmWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178116; 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=A3OE+jXrbELhAwM030gKO3Xh2sMFIeNeqIm2Rhfx39Q=; b=kCy7J2y8krZF3U/ib1An3j3cnO5llsJcNj76dHC1ethIXzTLGzuvGG5Y9z0TTtjAnhr3RBelhyMCMQZyk/kpyk2exF1A4FB0uu8PwM6SGJHd51jxpX4wB6lj1dFRxGNxTu51LZxA2HoiNbfcMX8l1sTB0zSAhGjkqWPnnwTdk+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176917811634522.671806681941803; Fri, 23 Jan 2026 06:21:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzY-0001au-Ke; Fri, 23 Jan 2026 09:18:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHz8-0000bo-Gn for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:02 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjHz4-0003hg-FK for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:00 -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 3328C33814; Fri, 23 Jan 2026 14:17:30 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1BDC81395E; Fri, 23 Jan 2026 14:17:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UE8FM/eCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A3OE+jXrbELhAwM030gKO3Xh2sMFIeNeqIm2Rhfx39Q=; b=sJlsZujM/CCEvm5KAd8Dv2wiRhMSO3U0EuAXzTq7eNSux8fUoUSpE2HxiWkL9cGOCiiu2V d23hWBoneLlxJFmIz1H5Y6qlwXbkHK5n6BqSN+MG+I/nxpcLjZaz3M5hVF40hwEm0RQYkG uxkwH49Rv1TCCGH+f/Pw3MmoWbFh6zY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A3OE+jXrbELhAwM030gKO3Xh2sMFIeNeqIm2Rhfx39Q=; b=uujbN3kFRPxGegOMlxyNJ8k+O5Cpp8exPF0Nx8dk4XxNDsvq3RaO1vv9ZeNkz2buvKhVFn o/RR70WDzufwXrDQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=sJlsZujM; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=uujbN3kF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A3OE+jXrbELhAwM030gKO3Xh2sMFIeNeqIm2Rhfx39Q=; b=sJlsZujM/CCEvm5KAd8Dv2wiRhMSO3U0EuAXzTq7eNSux8fUoUSpE2HxiWkL9cGOCiiu2V d23hWBoneLlxJFmIz1H5Y6qlwXbkHK5n6BqSN+MG+I/nxpcLjZaz3M5hVF40hwEm0RQYkG uxkwH49Rv1TCCGH+f/Pw3MmoWbFh6zY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A3OE+jXrbELhAwM030gKO3Xh2sMFIeNeqIm2Rhfx39Q=; b=uujbN3kFRPxGegOMlxyNJ8k+O5Cpp8exPF0Nx8dk4XxNDsvq3RaO1vv9ZeNkz2buvKhVFn o/RR70WDzufwXrDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit , Li Zhijian Subject: [PATCH v4 12/25] migration: Handle error in the early async paths Date: Fri, 23 Jan 2026 11:16:42 -0300 Message-ID: <20260123141656.6765-13-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email,fedoraproject.org:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 3328C33814 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178117463158500 Content-Type: text/plain; charset="utf-8" Simplify migration_channel_connect() and migration_connect() to not take an error as input. Move the error handling into the paths that generate the error. To achieve this, call migration_connect_error_propagate() from socket.c and tls.c, which are the async paths. For the sync paths, the handling is done as normal by returning all the way to qmp_migrate_finish(), except that now the sync paths don't pass the error forward into migration_connect() anymore. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 49 ++++++++++++++++++++---------------------- migration/channel.h | 4 +--- migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/migration.c | 11 ++-------- migration/migration.h | 3 ++- migration/rdma.c | 2 +- migration/socket.c | 17 ++++++++------- migration/tls.c | 14 ++++++------ migration/tls.h | 3 +-- migration/trace-events | 2 +- 12 files changed, 50 insertions(+), 61 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index ba14f66d85..26cb7bf059 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,38 +60,35 @@ void migration_channel_process_incoming(QIOChannel *ioc) * * @s: Current migration state * @ioc: Channel to which we are connecting - * @error: Error indicating failure to connect, free'd here */ -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - Error *error) +void migration_channel_connect(MigrationState *s, QIOChannel *ioc) { - trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), error); + trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); =20 - if (!error) { - if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc, &error); + if (migrate_channel_requires_tls_upgrade(ioc)) { + Error *local_err =3D NULL; =20 - if (!error) { - /* tls_channel_connect will call back to this - * function after the TLS handshake, - * so we mustn't call migration_connect until then - */ - - return; - } - } else { - QEMUFile *f =3D qemu_file_new_output(ioc); - - migration_ioc_register_yank(ioc); - - qemu_mutex_lock(&s->qemu_file_lock); - s->to_dst_file =3D f; - qemu_mutex_unlock(&s->qemu_file_lock); + migration_tls_channel_connect(s, ioc, &local_err); + if (local_err) { + migration_connect_error_propagate(s, local_err); } + + /* + * async: the above will call back to this function after + * the TLS handshake is successfully completed. + */ + return; } - migration_connect(s, error); + + QEMUFile *f =3D qemu_file_new_output(ioc); + + migration_ioc_register_yank(ioc); + + qemu_mutex_lock(&s->qemu_file_lock); + s->to_dst_file =3D f; + qemu_mutex_unlock(&s->qemu_file_lock); + + migration_connect(s); } =20 =20 diff --git a/migration/channel.h b/migration/channel.h index 2215091323..ccfeaaef18 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -20,9 +20,7 @@ =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - Error *error_in); +void migration_channel_connect(MigrationState *s, QIOChannel *ioc); =20 int migration_channel_read_peek(QIOChannel *ioc, const char *buf, diff --git a/migration/exec.c b/migration/exec.c index 78fe0fff13..d83a07435a 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index c956b260a4..0144a70742 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index c490f2b219..7bb9c1c79f 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/migration.c b/migration/migration.c index c3c1a09a6e..88fd3c4d75 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1570,7 +1570,7 @@ static void migrate_error_free(MigrationState *s) s->error =3D NULL; } =20 -static void migration_connect_error_propagate(MigrationState *s, Error *er= ror) +void migration_connect_error_propagate(MigrationState *s, Error *error) { MigrationStatus current =3D s->state; MigrationStatus next =3D MIGRATION_STATUS_NONE; @@ -4026,7 +4026,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; @@ -4034,13 +4034,6 @@ void migration_connect(MigrationState *s, Error *err= or_in) int ret; =20 s->expected_downtime =3D migrate_downtime_limit(); - if (error_in) { - migration_connect_error_propagate(s, error_in); - if (s->error) { - error_report_err(error_copy(s->error)); - } - return; - } =20 if (resume) { /* This is a resumed migration */ diff --git a/migration/migration.h b/migration/migration.h index 8b55d4741a..d134881eaf 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -533,10 +533,11 @@ void migration_incoming_process(void); =20 bool migration_has_all_channels(void); =20 +void migration_connect_error_propagate(MigrationState *s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 -void migration_connect(MigrationState *s, Error *error_in); +void migration_connect(MigrationState *s); =20 int migration_call_notifiers(MigrationEventType type, Error **errp); =20 diff --git a/migration/rdma.c b/migration/rdma.c index cced173379..c41c3e24b9 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3996,7 +3996,7 @@ void rdma_start_outgoing_migration(void *opaque, =20 s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; - migration_connect(s, NULL); + migration_connect(s); return; return_path_err: qemu_rdma_cleanup(rdma); diff --git a/migration/socket.c b/migration/socket.c index 426f363b99..676fe26712 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -59,24 +59,25 @@ static void socket_outgoing_migration(QIOTask *task, gpointer opaque) { struct SocketConnectData *data =3D opaque; - QIOChannel *sioc =3D QIO_CHANNEL(qio_task_get_source(task)); + g_autoptr(QIOChannel) sioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { - trace_migration_socket_outgoing_error(error_get_pretty(err)); - goto out; + goto fail; } =20 - trace_migration_socket_outgoing_connected(); - if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { error_setg(&err, "Zero copy send feature not detected in host kern= el"); + goto fail; } =20 -out: - migration_channel_connect(data->s, sioc, err); - object_unref(OBJECT(sioc)); + trace_migration_socket_outgoing_connected(); + migration_channel_connect(data->s, sioc); + return; +fail: + trace_migration_socket_outgoing_error(error_get_pretty(err)); + migration_connect_error_propagate(data->s, err); } =20 void socket_start_outgoing_migration(MigrationState *s, diff --git a/migration/tls.c b/migration/tls.c index 82f58cbc78..837b08294f 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -104,16 +104,17 @@ static void migration_tls_outgoing_handshake(QIOTask = *task, gpointer opaque) { MigrationState *s =3D opaque; - QIOChannel *ioc =3D QIO_CHANNEL(qio_task_get_source(task)); + g_autoptr(QIOChannel) ioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { trace_migration_tls_outgoing_handshake_error(error_get_pretty(err)= ); - } else { - trace_migration_tls_outgoing_handshake_complete(); + migration_connect_error_propagate(s, err); + return; } - migration_channel_connect(s, ioc, err); - object_unref(OBJECT(ioc)); + + trace_migration_tls_outgoing_handshake_complete(); + migration_channel_connect(s, ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, @@ -129,8 +130,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, return qio_channel_tls_new_client(ioc, creds, migrate_tls_hostname(), = errp); } =20 -void migration_tls_channel_connect(MigrationState *s, - QIOChannel *ioc, +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, Error **errp) { QIOChannelTLS *tioc; diff --git a/migration/tls.h b/migration/tls.h index 7cd9c76013..0e86d38862 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -29,8 +29,7 @@ void migration_tls_channel_process_incoming(QIOChannel *i= oc, Error **errp); QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, Error **errp); =20 -void migration_tls_channel_connect(MigrationState *s, - QIOChannel *ioc, +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, Error **errp); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ diff --git a/migration/trace-events b/migration/trace-events index da8f909cac..cbf10d0b63 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -204,7 +204,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype, void *err) = "ioc=3D%p ioctype=3D%s err=3D%p" +migration_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" =20 # global_state.c migrate_state_too_big(void) "" --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177930; cv=none; d=zohomail.com; s=zohoarc; b=ftlmGWnIneSFI+WI4nlLtHbPgBeIedJx5rlYZyJ/nHFm5a3ub3mrGrBwg4bXeMGHoiw+0IfnpnYhvwFmE3AmSCACBDHO5zpkCJAocx7bBTQUjbzW3+2qi5mDP7Ym4+PEFvmy8c3bBYZtuzXcSnEe7AxxQBOinaNlLoQOjvFxC/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177930; 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=7uaKxkoH9WzdDyQNdPI8x4kUt+g1NlQMLSp8YZHEAE0=; b=BB20N5zSFbjgvQdYl3Xg3/XoXadnnvYKrPEqyNCjNKyh7v3CsegSCi0VSHoVkBC6xfcWJjLqlfaDJv4YKJwX83lbBgBDvjB0msL9582IObYvGLv7mg+8k3uvKKdzQmosPGeBOFK0vvIAeVhS/6K65DFckzqD+sg8QDXk63crylQ= 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 1769177930279424.85949180776265; Fri, 23 Jan 2026 06:18:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzB-0000km-62; Fri, 23 Jan 2026 09:18:06 -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 1vjHyk-000099-7P for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:38 -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 1vjHyh-0003el-Ca for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:37 -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 865CF5BCCE; Fri, 23 Jan 2026 14:17:32 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AE8D81395E; Fri, 23 Jan 2026 14:17:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0IlsG/qCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177852; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7uaKxkoH9WzdDyQNdPI8x4kUt+g1NlQMLSp8YZHEAE0=; b=AdVXhojmSbEVr8gLLGiPmJu6hTyfXa0QN2Wwk7wRdcfw4GM4h+W/csc4a+bwJMSaTk6BzA oSKzDy6mQ4CWTm3mTcBljQa3HtKlgIHmZ9DQw/zOhXiRFfVIybS5uEYdqVYB7z8cqnJL7y JRpC26p7CoBXmy7MviEVC0RvvAPsJMs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177852; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7uaKxkoH9WzdDyQNdPI8x4kUt+g1NlQMLSp8YZHEAE0=; b=fgbXFJmK9a2EqwSgQ+YTW7oyHOAHPGz/XB1tgwXmN1oZED0WpRAXZDx+TBR9GKP2fO6DNc XU/znkDGvwI0BuBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=AdVXhojm; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=fgbXFJmK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177852; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7uaKxkoH9WzdDyQNdPI8x4kUt+g1NlQMLSp8YZHEAE0=; b=AdVXhojmSbEVr8gLLGiPmJu6hTyfXa0QN2Wwk7wRdcfw4GM4h+W/csc4a+bwJMSaTk6BzA oSKzDy6mQ4CWTm3mTcBljQa3HtKlgIHmZ9DQw/zOhXiRFfVIybS5uEYdqVYB7z8cqnJL7y JRpC26p7CoBXmy7MviEVC0RvvAPsJMs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177852; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7uaKxkoH9WzdDyQNdPI8x4kUt+g1NlQMLSp8YZHEAE0=; b=fgbXFJmK9a2EqwSgQ+YTW7oyHOAHPGz/XB1tgwXmN1oZED0WpRAXZDx+TBR9GKP2fO6DNc XU/znkDGvwI0BuBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 13/25] migration: Move setting of QEMUFile into migration_outgoing|incoming_setup Date: Fri, 23 Jan 2026 11:16:43 -0300 Message-ID: <20260123141656.6765-14-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:mid,suse.de:email,fedoraproject.org:email]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 865CF5BCCE X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177932826158501 Content-Type: text/plain; charset="utf-8" Centralize, on both sides of migration, the setting of the to_src_file and from_dst_file QEMUFiles. This will clean up the interface with channel.c and rdma.c, allowing those files to stop dealing with QEMUFile themselves. (multifd_recv_new_channel was changed to return bool+errp for convenience) Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 9 +---- migration/migration.c | 84 ++++++++++++++++++++++++++----------------- migration/migration.h | 2 ++ migration/multifd.c | 8 +++-- migration/multifd.h | 2 +- 5 files changed, 61 insertions(+), 44 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 26cb7bf059..6acce7b2a2 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -14,7 +14,6 @@ #include "channel.h" #include "tls.h" #include "migration.h" -#include "qemu-file.h" #include "trace.h" #include "qapi/error.h" #include "io/channel-tls.h" @@ -80,14 +79,8 @@ void migration_channel_connect(MigrationState *s, QIOCha= nnel *ioc) return; } =20 - QEMUFile *f =3D qemu_file_new_output(ioc); - migration_ioc_register_yank(ioc); - - qemu_mutex_lock(&s->qemu_file_lock); - s->to_dst_file =3D f; - qemu_mutex_unlock(&s->qemu_file_lock); - + migration_outgoing_setup(ioc); migration_connect(s); } =20 diff --git a/migration/migration.c b/migration/migration.c index 88fd3c4d75..02ee202633 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -930,17 +930,56 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -/** - * migration_incoming_setup: Setup incoming migration - * @f: file for main migration channel +static bool migration_has_main_and_multifd_channels(void); + +/* + * Returns whether all the necessary channels to proceed with the + * incoming migration have been established without error. */ -static void migration_incoming_setup(QEMUFile *f) +bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); + QEMUFile *f; =20 - assert(!mis->from_src_file); - mis->from_src_file =3D f; - qemu_file_set_blocking(f, false, &error_abort); + if (multifd_recv_setup(errp) !=3D 0) { + return false; + } + + switch (channel) { + case CH_MAIN: + f =3D qemu_file_new_input(ioc); + assert(!mis->from_src_file); + mis->from_src_file =3D f; + qemu_file_set_blocking(f, false, &error_abort); + break; + + case CH_MULTIFD: + if (!multifd_recv_new_channel(ioc, errp)) { + return false; + } + break; + + case CH_POSTCOPY: + assert(!mis->postcopy_qemufile_dst); + f =3D qemu_file_new_input(ioc); + postcopy_preempt_new_channel(mis, f); + return false; + + default: + g_assert_not_reached(); + } + + return migration_has_main_and_multifd_channels(); +} + +void migration_outgoing_setup(QIOChannel *ioc) +{ + MigrationState *s =3D migrate_get_current(); + QEMUFile *f =3D qemu_file_new_output(ioc); + + qemu_mutex_lock(&s->qemu_file_lock); + s->to_dst_file =3D f; + qemu_mutex_unlock(&s->qemu_file_lock); } =20 /* Returns true if recovered from a paused migration, otherwise false */ @@ -988,7 +1027,11 @@ void migration_incoming_process(void) =20 void migration_fd_process_incoming(QEMUFile *f) { - migration_incoming_setup(f); + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + assert(!mis->from_src_file); + mis->from_src_file =3D f; + qemu_file_set_blocking(f, false, &error_abort); migration_incoming_process(); } =20 @@ -1011,8 +1054,6 @@ static bool migration_has_main_and_multifd_channels(v= oid) void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); - Error *local_err =3D NULL; - QEMUFile *f; uint8_t channel; uint32_t channel_magic =3D 0; int ret =3D 0; @@ -1066,28 +1107,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc,= Error **errp) channel =3D CH_POSTCOPY; } =20 - if (multifd_recv_setup(errp) !=3D 0) { - return; - } - - if (channel =3D=3D CH_MAIN) { - f =3D qemu_file_new_input(ioc); - migration_incoming_setup(f); - } else if (channel =3D=3D CH_MULTIFD) { - /* Multiple connections */ - multifd_recv_new_channel(ioc, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - } else if (channel =3D=3D CH_POSTCOPY) { - assert(!mis->postcopy_qemufile_dst); - f =3D qemu_file_new_input(ioc); - postcopy_preempt_new_channel(mis, f); - return; - } - - if (migration_has_main_and_multifd_channels()) { + if (migration_incoming_setup(ioc, channel, errp)) { migration_incoming_process(); } } diff --git a/migration/migration.h b/migration/migration.h index d134881eaf..4dcf299719 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -530,6 +530,8 @@ void migrate_set_state(MigrationStatus *state, Migratio= nStatus old_state, void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); +bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); +void migration_outgoing_setup(QIOChannel *ioc); =20 bool migration_has_all_channels(void); =20 diff --git a/migration/multifd.c b/migration/multifd.c index 98d62431db..fccdcc9662 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1517,7 +1517,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; @@ -1532,7 +1532,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 { @@ -1545,7 +1545,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)); @@ -1554,4 +1554,6 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p, QEMU_THREAD_JOINABLE); qatomic_inc(&multifd_recv_state->count); + + return true; } diff --git a/migration/multifd.h b/migration/multifd.h index 9b6d81e7ed..89a395aef2 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -42,7 +42,7 @@ int multifd_recv_setup(Error **errp); void multifd_recv_cleanup(void); void multifd_recv_shutdown(void); bool multifd_recv_all_channels_created(void); -void multifd_recv_new_channel(QIOChannel *ioc, Error **errp); +bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp); void multifd_recv_sync_main(void); int multifd_send_sync_main(MultiFDSyncReq req); bool multifd_queue_page(RAMBlock *block, ram_addr_t offset); --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178049; cv=none; d=zohomail.com; s=zohoarc; b=hvsDpfuvr12yS9cjoirJxGVoN61tjjQqlQI6kJZpH99w2ZK28+q52gysMY2HgQH9YFqG8XjQ/48smiiDHLG2M+QlZU3G8iHGHFBe4V42Vs5I4hN9bpuiW898Tjf7X/LCEKpCgkSbL54FiZpN1gU6AjgSS1VFVIFxQ8tBmVjOlsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178049; 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=HMGqm/g/q2fhwUe99YoCVWspW/1TT3nwuSRPYtyOYEU=; b=nnLrylG/fEAf+CRx7oOwP27c+fSDhUiwo4x23Zx6leRQwTpNXPAzpibtDNyekHOk6mOw8MWaX/ydz4rp3ldw1pvYrW97YNlcgPd/pX4SVqEdI6Be/ul7jqcNeJlYW0Iqelj53E7NSVeOQCx0cjqzcc3riYyma1Lh5NMupzNJ8X8= 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 1769178049497624.7082296413596; Fri, 23 Jan 2026 06:20:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzA-0000it-UI; Fri, 23 Jan 2026 09:18:05 -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 1vjHyr-0000IQ-PK for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:46 -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 1vjHyp-0003fZ-0u for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:45 -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 24C4C5BCCF; Fri, 23 Jan 2026 14:17: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 0D22A1395E; Fri, 23 Jan 2026 14:17:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YCinL/yCc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177855; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMGqm/g/q2fhwUe99YoCVWspW/1TT3nwuSRPYtyOYEU=; b=Eh47K/OVVEcTSaJI4gswKeXifZbwFYHITCTDnTmB3AbBNKsjNuy5bMgXki/YEGqTRprg53 +2ooz9BgPsA57CmnYhxrQkxleBFAKNij0MH3ze7LNbLVL+26jnGpjk0lKhz3L5DIoRjPFW nj4+749BS7AxxY5jQMbFPIAPv5jJ+QA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177855; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMGqm/g/q2fhwUe99YoCVWspW/1TT3nwuSRPYtyOYEU=; b=PhBurQvMigLyB/4RDfMdVXhI1EdSxipqxqpCZnmXCRTB6JIYyGyhxNq80s6j/fW2VWZ42m DQZ//jMUenSUayDw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="Eh47K/OV"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=PhBurQvM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177855; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMGqm/g/q2fhwUe99YoCVWspW/1TT3nwuSRPYtyOYEU=; b=Eh47K/OVVEcTSaJI4gswKeXifZbwFYHITCTDnTmB3AbBNKsjNuy5bMgXki/YEGqTRprg53 +2ooz9BgPsA57CmnYhxrQkxleBFAKNij0MH3ze7LNbLVL+26jnGpjk0lKhz3L5DIoRjPFW nj4+749BS7AxxY5jQMbFPIAPv5jJ+QA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177855; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMGqm/g/q2fhwUe99YoCVWspW/1TT3nwuSRPYtyOYEU=; b=PhBurQvMigLyB/4RDfMdVXhI1EdSxipqxqpCZnmXCRTB6JIYyGyhxNq80s6j/fW2VWZ42m DQZ//jMUenSUayDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit , Li Zhijian Subject: [PATCH v4 14/25] migration/rdma: Use common connection paths Date: Fri, 23 Jan 2026 11:16:44 -0300 Message-ID: <20260123141656.6765-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns, fedoraproject.org:email, suse.de:mid, suse.de:dkim, suse.de:email] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 24C4C5BCCF X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178051117158500 Content-Type: text/plain; charset="utf-8" Use the common connection paths for the incoming and outgoing sides of rdma migration. This removes one usage of QEMUFile from rdma.c. It also allows further unification of the connection code in next patches. Move the channels enum to channel.h so rdma.c can access it. The RDMA channel is considered a CH_MAIN channel. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.h | 7 +++++++ migration/migration.c | 13 ------------- migration/migration.h | 1 - migration/rdma.c | 23 +++++++++++------------ 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/migration/channel.h b/migration/channel.h index ccfeaaef18..93dedbf52b 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -18,6 +18,13 @@ =20 #include "io/channel.h" =20 +/* Migration channel types */ +enum { + CH_MAIN, + CH_MULTIFD, + CH_POSTCOPY +}; + void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect(MigrationState *s, QIOChannel *ioc); diff --git a/migration/migration.c b/migration/migration.c index 02ee202633..5c1594cf8f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -91,9 +91,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 -/* Migration channel types */ -enum { CH_MAIN, CH_MULTIFD, CH_POSTCOPY }; - /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -1025,16 +1022,6 @@ void migration_incoming_process(void) qemu_coroutine_enter(co); } =20 -void migration_fd_process_incoming(QEMUFile *f) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - - assert(!mis->from_src_file); - mis->from_src_file =3D f; - qemu_file_set_blocking(f, false, &error_abort); - migration_incoming_process(); -} - static bool migration_has_main_and_multifd_channels(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/migration.h b/migration/migration.h index 4dcf299719..cd6cfd62ba 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -527,7 +527,6 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); diff --git a/migration/rdma.c b/migration/rdma.c index c41c3e24b9..98a6cebb17 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "channel.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "exec/target_page.h" @@ -384,7 +385,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdmain; RDMAContext *rdmaout; - QEMUFile *file; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -3835,32 +3835,30 @@ static void qio_channel_rdma_register_types(void) =20 type_init(qio_channel_rdma_register_types); =20 -static QEMUFile *rdma_new_input(RDMAContext *rdma) +static QIOChannel *rdma_new_input(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); rioc->rdmain =3D rdma; rioc->rdmaout =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 -static QEMUFile *rdma_new_output(RDMAContext *rdma) +static QIOChannel *rdma_new_output(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); rioc->rdmaout =3D rdma; rioc->rdmain =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 static void rdma_accept_incoming_migration(void *opaque) { RDMAContext *rdma =3D opaque; - QEMUFile *f; + QIOChannel *ioc; =20 trace_qemu_rdma_accept_incoming_migration(); if (qemu_rdma_accept(rdma) < 0) { @@ -3874,15 +3872,16 @@ static void rdma_accept_incoming_migration(void *op= aque) return; } =20 - f =3D rdma_new_input(rdma); - if (f =3D=3D NULL) { + ioc =3D rdma_new_input(rdma); + if (ioc =3D=3D NULL) { error_report("RDMA ERROR: could not open RDMA for input"); qemu_rdma_cleanup(rdma); return; } =20 rdma->migration_started_on_destination =3D 1; - migration_fd_process_incoming(f); + migration_incoming_setup(ioc, CH_MAIN, &error_abort); + migration_incoming_process(); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, @@ -3994,8 +3993,8 @@ void rdma_start_outgoing_migration(void *opaque, =20 trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 - s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; + migration_outgoing_setup(rdma_new_output(rdma)); migration_connect(s); return; return_path_err: --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178195; cv=none; d=zohomail.com; s=zohoarc; b=ih0Bf5Yj9NuACeG+oGMjHbjCVorYuOYHQngxrZholJec2Pihix3U1efJmifc4UDM1cdGrvKqIQyIQTzo2u0ManzpNTP/zpgNXj+7Nmxq4ldj8EkSaNhYDGUBg2XFo6U7n62x2JBkP1Fz9okwelbO1xCEFxdHkVZq6TFojhZNAac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178195; 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=5Y4zDtQa6HJWGAVWcUdCXehZDIlwejXK2GZ4+foVT8E=; b=aL1N3EPtqOJ686s2bS48PY9igzgh1uuoPcdlYVyy9iIG5jh3EVmWp8VzwS1gdi9D/KTeml9bLhLmw2SBIkz1H8k7WCjK1W+2yTXgVyr4gWXoUPNH0LnxtbsnIGAf68kysByYrvPm8aLaORnHDDLjb0nb03jeAKVEDEBCxRtvpRU= 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 1769178195378315.30008577838055; Fri, 23 Jan 2026 06:23:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzV-0001Cs-5r; Fri, 23 Jan 2026 09:18:25 -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 1vjHyx-0000Qa-3R for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:52 -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 1vjHyv-0003gT-EE for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17: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-out2.suse.de (Postfix) with ESMTPS id 76DEF5BCDA; Fri, 23 Jan 2026 14:17: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 9E39F1395E; Fri, 23 Jan 2026 14:17: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 sNm9F/+Cc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Y4zDtQa6HJWGAVWcUdCXehZDIlwejXK2GZ4+foVT8E=; b=m+JWtvc8PTefkzE/lEnkJK2PSW7s+AzgT/dF59BLaetactM1xnEtb0OdLKN47qrbQgjvbU f68K7steZzkbSm9/aE8OF7chO9oSo6X7m5YPwPxie0lqZyWbPtxT7fYlgohRAV7ZNI+7xZ WkZTLbKi44ruvKZS9i104yvW66vI0yM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Y4zDtQa6HJWGAVWcUdCXehZDIlwejXK2GZ4+foVT8E=; b=ULI5S3oUyY+UhPz8MfEBOLL3NMQJYFIWh3HOVLkfvyAFBnfmMVCJcz/LE0lEMm38JDYoM0 gUjvGcym0xYpn1Cg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=m+JWtvc8; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ULI5S3oU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Y4zDtQa6HJWGAVWcUdCXehZDIlwejXK2GZ4+foVT8E=; b=m+JWtvc8PTefkzE/lEnkJK2PSW7s+AzgT/dF59BLaetactM1xnEtb0OdLKN47qrbQgjvbU f68K7steZzkbSm9/aE8OF7chO9oSo6X7m5YPwPxie0lqZyWbPtxT7fYlgohRAV7ZNI+7xZ WkZTLbKi44ruvKZS9i104yvW66vI0yM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Y4zDtQa6HJWGAVWcUdCXehZDIlwejXK2GZ4+foVT8E=; b=ULI5S3oUyY+UhPz8MfEBOLL3NMQJYFIWh3HOVLkfvyAFBnfmMVCJcz/LE0lEMm38JDYoM0 gUjvGcym0xYpn1Cg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 15/25] migration: Start incoming from channel.c Date: Fri, 23 Jan 2026 11:16:45 -0300 Message-ID: <20260123141656.6765-16-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns, fedoraproject.org:email, suse.de:mid, suse.de:dkim, suse.de:email] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 76DEF5BCDA X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178196136158500 Content-Type: text/plain; charset="utf-8" Leave migration_ioc_process_incoming to do only the channel identification process and move the migration start into channel.c. Both routines will be renamed in the next patches to better reflect their usage. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 12 ++++++++++-- migration/channel.h | 5 +++-- migration/migration.c | 13 +++++-------- migration/migration.h | 3 ++- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 6acce7b2a2..b8d757c17b 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -33,6 +33,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) { MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; + MigChannelType ch; =20 trace_migration_set_incoming_channel( ioc, object_get_typename(OBJECT(ioc))); @@ -41,9 +42,16 @@ void migration_channel_process_incoming(QIOChannel *ioc) migration_tls_channel_process_incoming(ioc, &local_err); } else { migration_ioc_register_yank(ioc); - migration_ioc_process_incoming(ioc, &local_err); - } + ch =3D migration_ioc_process_incoming(ioc, &local_err); + if (!ch) { + goto out; + } =20 + if (migration_incoming_setup(ioc, ch, &local_err)) { + migration_incoming_process(); + } + } +out: if (local_err) { error_report_err(local_err); migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED= ); diff --git a/migration/channel.h b/migration/channel.h index 93dedbf52b..b361e1c838 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -19,11 +19,12 @@ #include "io/channel.h" =20 /* Migration channel types */ -enum { +typedef enum { + CH_NONE, CH_MAIN, CH_MULTIFD, CH_POSTCOPY -}; +} MigChannelType; =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 diff --git a/migration/migration.c b/migration/migration.c index 5c1594cf8f..4745c3bdf7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1038,10 +1038,10 @@ static bool migration_has_main_and_multifd_channels= (void) return true; } =20 -void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) +MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p) { MigrationIncomingState *mis =3D migration_incoming_get_current(); - uint8_t channel; + MigChannelType channel =3D CH_NONE; uint32_t channel_magic =3D 0; int ret =3D 0; =20 @@ -1060,7 +1060,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); @@ -1075,7 +1075,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()) { /* @@ -1087,16 +1086,14 @@ void migration_ioc_process_incoming(QIOChannel *ioc= , Error **errp) channel =3D CH_MAIN; } else { error_setg(errp, "non-peekable channel used without multifd"); - return; } } else { assert(migrate_postcopy_preempt()); channel =3D CH_POSTCOPY; } =20 - if (migration_incoming_setup(ioc, channel, errp)) { - migration_incoming_process(); - } +out: + return channel; } =20 /** diff --git a/migration/migration.h b/migration/migration.h index cd6cfd62ba..b55cc40613 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -28,6 +28,7 @@ #include "postcopy-ram.h" #include "system/runstate.h" #include "migration/misc.h" +#include "channel.h" =20 #define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" #define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" @@ -527,7 +528,7 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); +MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); void migration_outgoing_setup(QIOChannel *ioc); --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178199; cv=none; d=zohomail.com; s=zohoarc; b=gf0ZoSs2hVpPFPxi+tJdqwGACo+fIOfpl1V1iVo/H3FDtv/ohFcwI7cdRqRWTRMpfaeRkn+F9bQFi3aF3KTwPH0XxZqxOG04raRj2pyzThQc8P8TWk1IphTUOs/DaSXV667LJPgg09YFlBOUZruZsnb4NxuWtJ7c4dysSbNt404= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178199; 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=sf/q+I9m/iBsplwkpebQXtUgYZICo5nq9TuGlY03gRQ=; b=CVllAmrQNUDpyS5IebDqvcoVGQ1CTJrAYnf6IyplsnkjsOpEOcziBiwXgBnASNgXmjMCd7wHCplFo2JaeeHCLm8CnaAFZiKGV60uN2YtpLumkj8/SASAv/32cX1BLZR69JnsAWe/lV9wSAlJrHVXszsD79Y7RjWGI+23cLyIh70= 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 1769178199882285.6075913056296; Fri, 23 Jan 2026 06:23:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzd-0002Mv-UJ; Fri, 23 Jan 2026 09:18:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHz2-0000XB-SK for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17:58 -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 1vjHz0-0003hD-6R for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:17: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 D24815BCCE; Fri, 23 Jan 2026 14:17:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 010B01395E; Fri, 23 Jan 2026 14:17: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 uOqyLAGDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sf/q+I9m/iBsplwkpebQXtUgYZICo5nq9TuGlY03gRQ=; b=drQXzkZJ1z+vW2yQBBm91fQVZEJ6SUrvbL44vP1q3RkEfLjnY06gs8Y9InSmKsKnJkfO1M xbYg+gTSN8dSzT8mTfunC+WF+kxtsEUHtPCVT04BxDZJQhcdHrrCwv0C0/HoJFn+YTitPL JLAYVcluXdzwAOQC7gtV7HIDO3Rxm2A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sf/q+I9m/iBsplwkpebQXtUgYZICo5nq9TuGlY03gRQ=; b=t3A4iYz8iOopmPjSftyRg73BZHAtyo95Y8i+E24iz1jmcmOlzk7B9e4ip4WyLxuVebsQ6j 0qdU5mUlIncwS9AQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=drQXzkZJ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=t3A4iYz8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sf/q+I9m/iBsplwkpebQXtUgYZICo5nq9TuGlY03gRQ=; b=drQXzkZJ1z+vW2yQBBm91fQVZEJ6SUrvbL44vP1q3RkEfLjnY06gs8Y9InSmKsKnJkfO1M xbYg+gTSN8dSzT8mTfunC+WF+kxtsEUHtPCVT04BxDZJQhcdHrrCwv0C0/HoJFn+YTitPL JLAYVcluXdzwAOQC7gtV7HIDO3Rxm2A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sf/q+I9m/iBsplwkpebQXtUgYZICo5nq9TuGlY03gRQ=; b=t3A4iYz8iOopmPjSftyRg73BZHAtyo95Y8i+E24iz1jmcmOlzk7B9e4ip4WyLxuVebsQ6j 0qdU5mUlIncwS9AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 16/25] migration/channel: Rename migration_channel_connect Date: Fri, 23 Jan 2026 11:16:46 -0300 Message-ID: <20260123141656.6765-17-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; DBL_BLOCKED_OPENRESOLVER(0.00)[fedoraproject.org:email, suse.de:dkim, suse.de:mid, suse.de:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] X-Rspamd-Action: no action X-Rspamd-Queue-Id: D24815BCCE X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178200408154100 Content-Type: text/plain; charset="utf-8" Rename migration_channel_connect to indicate this is the source side. Future patches will do similar changes to the incoming side and this will avoid inconsistencies in naming. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 9 +-------- migration/channel.h | 2 +- migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/socket.c | 2 +- migration/tls.c | 2 +- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index b8d757c17b..f41333adcc 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -61,14 +61,7 @@ out: } } =20 - -/** - * @migration_channel_connect - Create new outgoing migration channel - * - * @s: Current migration state - * @ioc: Channel to which we are connecting - */ -void migration_channel_connect(MigrationState *s, QIOChannel *ioc) +void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc) { trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); =20 diff --git a/migration/channel.h b/migration/channel.h index b361e1c838..574bfec65c 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -28,7 +28,7 @@ typedef enum { =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 -void migration_channel_connect(MigrationState *s, QIOChannel *ioc); +void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc= ); =20 int migration_channel_read_peek(QIOChannel *ioc, const char *buf, diff --git a/migration/exec.c b/migration/exec.c index d83a07435a..d1629944dc 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index 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 676fe26712..f94959828f 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -73,7 +73,7 @@ static void socket_outgoing_migration(QIOTask *task, } =20 trace_migration_socket_outgoing_connected(); - migration_channel_connect(data->s, sioc); + migration_channel_connect_outgoing(data->s, sioc); return; fail: trace_migration_socket_outgoing_error(error_get_pretty(err)); diff --git a/migration/tls.c b/migration/tls.c index 837b08294f..89ba52de02 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -114,7 +114,7 @@ static void migration_tls_outgoing_handshake(QIOTask *t= ask, } =20 trace_migration_tls_outgoing_handshake_complete(); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178116; cv=none; d=zohomail.com; s=zohoarc; b=LmtXWprkpdO2nPhukEstcPH/46UVY5g2nPS2QQ5AD6TnfLxqzdBZrDnr68K0dSm4IqqRthVC/VtOPZhY0upZBjMexmz+dGqML9aI2cIO8DvLqzoIHhpxkVK8V1Hzuh5ZJS58DUGwtVSvZxkLV+uj8V65YHmDVazAJelDEMYXmyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178116; 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=moIuMnraXU6NKmeqmd+SD14KS4odDyrT9Jl23Ut5oDc=; b=TzXEhsYbCE7cHQsaRFqZuYEjzhhHzhTYPpkc18SvQqYL1M+dn7KHOw1+P2bxx+O2aMrcdZLxJjGxDlqbzWLi47K4TOWJ2nh8DFMoIGM07UIO6GDmZtU4ZG93lWRF2OnlhzLWEtuAYjaWAYOAxtU3hzWeylVCpDpiLUMURN439ks= 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 1769178116404793.7845964054507; Fri, 23 Jan 2026 06:21:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzW-0001MZ-O5; Fri, 23 Jan 2026 09:18: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 1vjHzA-0000jZ-Gx for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:04 -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 1vjHz6-0003hu-8q for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:04 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7AB415BCDE; Fri, 23 Jan 2026 14:17: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 675AA1395E; Fri, 23 Jan 2026 14:17: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 6M40CgSDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177862; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=moIuMnraXU6NKmeqmd+SD14KS4odDyrT9Jl23Ut5oDc=; b=OpoO62vTUYNgYaWIcCLpDzd8gWTJTWY/usEPicWlJfBpBf11AjyowLMwG0/KM+JZqQZSEa Hr8kF+BxKR4cjy/ostMiy2+vTy8xeGHStjoSuPfLPCOaMDOTMomHpdlCvgUYlhyXHBxoTk Lxt11t7rvWVzItynvPGQZfkXzxUpNqA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177862; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=moIuMnraXU6NKmeqmd+SD14KS4odDyrT9Jl23Ut5oDc=; b=hQ4Z4tLmM09vDUjHQhUvOZi6KC54cen5U81GcuSbhRaudJFhM3htCdWx2B1Ar9glu8tfk5 Ao04rHbagIWywjBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OpoO62vT; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=hQ4Z4tLm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177862; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=moIuMnraXU6NKmeqmd+SD14KS4odDyrT9Jl23Ut5oDc=; b=OpoO62vTUYNgYaWIcCLpDzd8gWTJTWY/usEPicWlJfBpBf11AjyowLMwG0/KM+JZqQZSEa Hr8kF+BxKR4cjy/ostMiy2+vTy8xeGHStjoSuPfLPCOaMDOTMomHpdlCvgUYlhyXHBxoTk Lxt11t7rvWVzItynvPGQZfkXzxUpNqA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177862; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=moIuMnraXU6NKmeqmd+SD14KS4odDyrT9Jl23Ut5oDc=; b=hQ4Z4tLmM09vDUjHQhUvOZi6KC54cen5U81GcuSbhRaudJFhM3htCdWx2B1Ar9glu8tfk5 Ao04rHbagIWywjBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit , Li Zhijian Subject: [PATCH v4 17/25] migration: Rename instances of start Date: Fri, 23 Jan 2026 11:16:47 -0300 Message-ID: <20260123141656.6765-18-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; DBL_BLOCKED_OPENRESOLVER(0.00)[fedoraproject.org:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo, suse.de:dkim, suse.de:mid, suse.de:email] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 7AB415BCDE X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178117669158500 Content-Type: text/plain; charset="utf-8" To make it easier to follow the code, rename the functions that start the migration thread and migration coroutine to contain the word "start". This will give new contributors the chance of seeing the word start and reaching the actual migration code, instead of twists and turns of qio_channel_add_watch and qio_task_run_in_thread. Remove all other instances of "start" and use wording more suitable to what the current migration stage is. The transport code such as fd_start_migration_outgoing becomes fd_connect_outgoing, the early setup code such as qemu_start_incoming_migration becomes qemu_setup_incoming_migration and so on. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 4 ++-- migration/exec.c | 5 ++--- migration/exec.h | 5 ++--- migration/fd.c | 4 ++-- migration/fd.h | 6 +++--- migration/file.c | 6 +++--- migration/file.h | 6 +++--- migration/migration.c | 30 +++++++++++++++--------------- migration/migration.h | 3 ++- migration/rdma.c | 21 ++++++++++----------- migration/rdma.h | 6 +++--- migration/socket.c | 8 +++----- migration/socket.h | 6 +++--- migration/trace-events | 10 +++++----- 14 files changed, 58 insertions(+), 62 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index f41333adcc..d1eec4942b 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -48,7 +48,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) } =20 if (migration_incoming_setup(ioc, ch, &local_err)) { - migration_incoming_process(); + migration_start_incoming(); } } out: @@ -82,7 +82,7 @@ void migration_channel_connect_outgoing(MigrationState *s= , QIOChannel *ioc) =20 migration_ioc_register_yank(ioc); migration_outgoing_setup(ioc); - migration_connect(s); + migration_start_outgoing(s); } =20 =20 diff --git a/migration/exec.c b/migration/exec.c index d1629944dc..c3085e803e 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -40,8 +40,7 @@ const char *exec_get_cmd_path(void) } #endif =20 -void exec_start_outgoing_migration(MigrationState *s, strList *command, - Error **errp) +void exec_connect_outgoing(MigrationState *s, strList *command, Error **er= rp) { QIOChannel *ioc =3D NULL; g_auto(GStrv) argv =3D strv_from_str_list(command); @@ -68,7 +67,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel= *ioc, return G_SOURCE_REMOVE; } =20 -void exec_start_incoming_migration(strList *command, Error **errp) +void exec_connect_incoming(strList *command, Error **errp) { QIOChannel *ioc; g_auto(GStrv) argv =3D strv_from_str_list(command); diff --git a/migration/exec.h b/migration/exec.h index 3107f205e3..e7e8e475ac 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -23,8 +23,7 @@ #ifdef WIN32 const char *exec_get_cmd_path(void); #endif -void exec_start_incoming_migration(strList *host_port, Error **errp); +void exec_connect_incoming(strList *host_port, Error **errp); =20 -void exec_start_outgoing_migration(MigrationState *s, strList *host_port, - Error **errp); +void exec_connect_outgoing(MigrationState *s, strList *host_port, Error **= errp); #endif diff --git a/migration/fd.c b/migration/fd.c index 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 4745c3bdf7..c2040bea75 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -740,7 +740,7 @@ migration_incoming_state_setup(MigrationIncomingState *= mis, Error **errp) return true; } =20 -static void qemu_start_incoming_migration(const char *uri, bool has_channe= ls, +static void qemu_setup_incoming_migration(const char *uri, bool has_channe= ls, MigrationChannelList *channels, Error **errp) { @@ -788,18 +788,18 @@ static void qemu_start_incoming_migration(const char = *uri, bool has_channels, if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_start_incoming_migration(saddr, errp); + socket_connect_incoming(saddr, errp); } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_start_incoming_migration(saddr->u.fd.str, errp); + fd_connect_incoming(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_incoming_migration(&addr->u.rdma, errp); + rdma_connect_incoming(&addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_incoming_migration(addr->u.exec.args, errp); + exec_connect_incoming(addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_start_incoming_migration(&addr->u.file, errp); + file_connect_incoming(&addr->u.file, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1012,7 +1012,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; @@ -1969,7 +1969,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); @@ -2016,7 +2016,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) @@ -2333,18 +2333,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"); } @@ -4030,7 +4030,7 @@ fail_setup: return NULL; } =20 -void migration_connect(MigrationState *s) +void migration_start_outgoing(MigrationState *s) { Error *local_err =3D NULL; uint64_t rate_limit; diff --git a/migration/migration.h b/migration/migration.h index b55cc40613..c4ea57d80a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -539,7 +539,8 @@ void migration_connect_error_propagate(MigrationState *= s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 -void migration_connect(MigrationState *s); +void migration_start_outgoing(MigrationState *s); +void migration_start_incoming(void); =20 int migration_call_notifiers(MigrationEventType type, Error **errp); =20 diff --git a/migration/rdma.c b/migration/rdma.c index 98a6cebb17..4d63fd723b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3881,17 +3881,16 @@ static void rdma_accept_incoming_migration(void *op= aque) =20 rdma->migration_started_on_destination =3D 1; migration_incoming_setup(ioc, CH_MAIN, &error_abort); - migration_incoming_process(); + migration_start_incoming(); } =20 -void rdma_start_incoming_migration(InetSocketAddress *host_port, - Error **errp) +void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp) { MigrationState *s =3D migrate_get_current(); int ret; RDMAContext *rdma; =20 - trace_rdma_start_incoming_migration(); + trace_rdma_connect_incoming(); =20 /* Avoid ram_block_discard_disable(), cannot change during migration. = */ if (ram_block_discard_is_required()) { @@ -3909,7 +3908,7 @@ void rdma_start_incoming_migration(InetSocketAddress = *host_port, goto err; } =20 - trace_rdma_start_incoming_migration_after_dest_init(); + trace_rdma_connect_incoming_after_dest_init(); =20 ret =3D rdma_listen(rdma->listen_id, 5); =20 @@ -3918,7 +3917,7 @@ void rdma_start_incoming_migration(InetSocketAddress = *host_port, goto cleanup_rdma; } =20 - trace_rdma_start_incoming_migration_after_rdma_listen(); + trace_rdma_connect_incoming_after_rdma_listen(); s->rdma_migration =3D true; qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration, NULL, (void *)(intptr_t)rdma); @@ -3933,8 +3932,8 @@ err: g_free(rdma); } =20 -void rdma_start_outgoing_migration(void *opaque, - InetSocketAddress *host_port, Error **errp) +void rdma_connect_outgoing(void *opaque, + InetSocketAddress *host_port, Error **errp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; @@ -3958,7 +3957,7 @@ void rdma_start_outgoing_migration(void *opaque, goto err; } =20 - trace_rdma_start_outgoing_migration_after_rdma_source_init(); + trace_rdma_connect_outgoing_after_rdma_source_init(); ret =3D qemu_rdma_connect(rdma, false, errp); =20 if (ret < 0) { @@ -3991,11 +3990,11 @@ void rdma_start_outgoing_migration(void *opaque, rdma_return_path->is_return_path =3D true; } =20 - trace_rdma_start_outgoing_migration_after_rdma_connect(); + trace_rdma_connect_outgoing_after_rdma_connect(); =20 s->rdma_migration =3D true; migration_outgoing_setup(rdma_new_output(rdma)); - migration_connect(s); + migration_start_outgoing(s); return; return_path_err: qemu_rdma_cleanup(rdma); diff --git a/migration/rdma.h b/migration/rdma.h index f74f16a459..170c25cf44 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,10 +21,10 @@ =20 #include "system/memory.h" =20 -void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_p= ort, - Error **errp); +void rdma_connect_outgoing(void *opaque, InetSocketAddress *host_port, + Error **errp); =20 -void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **e= rrp); +void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 /* * Constants used by rdma return codes diff --git a/migration/socket.c b/migration/socket.c index f94959828f..f57f1a8e7c 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -80,9 +80,8 @@ fail: migration_connect_error_propagate(data->s, err); } =20 -void socket_start_outgoing_migration(MigrationState *s, - SocketAddress *saddr, - Error **errp) +void socket_connect_outgoing(MigrationState *s, SocketAddress *saddr, + Error **errp) { QIOChannelSocket *sioc =3D qio_channel_socket_new(); struct SocketConnectData *data =3D g_new0(struct SocketConnectData, 1); @@ -140,8 +139,7 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } =20 -void socket_start_incoming_migration(SocketAddress *saddr, - Error **errp) +void socket_connect_incoming(SocketAddress *saddr, Error **errp) { QIONetListener *listener =3D qio_net_listener_new(); MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/socket.h b/migration/socket.h index 04ebbe95a1..f0c89b64c7 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -23,10 +23,10 @@ =20 void socket_send_channel_create(QIOTaskFunc f, void *data); =20 -void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); +void socket_connect_incoming(SocketAddress *saddr, Error **errp); =20 -void socket_start_outgoing_migration(MigrationState *s, - SocketAddress *saddr, Error **errp); +void socket_connect_outgoing(MigrationState *s, + SocketAddress *saddr, Error **errp); void socket_cleanup_outgoing_migration(void); =20 #endif diff --git a/migration/trace-events b/migration/trace-events index cbf10d0b63..91d7506634 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -271,11 +271,11 @@ rdma_registration_handle_wait(void) "" rdma_registration_start(uint64_t flags) "%" PRIu64 rdma_registration_stop(uint64_t flags) "%" PRIu64 rdma_registration_stop_ram(void) "" -rdma_start_incoming_migration(void) "" -rdma_start_incoming_migration_after_dest_init(void) "" -rdma_start_incoming_migration_after_rdma_listen(void) "" -rdma_start_outgoing_migration_after_rdma_connect(void) "" -rdma_start_outgoing_migration_after_rdma_source_init(void) "" +rdma_connect_incoming(void) "" +rdma_connect_incoming_after_dest_init(void) "" +rdma_connect_incoming_after_rdma_listen(void) "" +rdma_connect_outgoing_after_rdma_connect(void) "" +rdma_connect_outgoing_after_rdma_source_init(void) "" =20 # postcopy-ram.c postcopy_discard_send_finish(const char *ramblock, int nwords, int ncmds) = "%s mask words sent=3D%d in %d commands" --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178073; cv=none; d=zohomail.com; s=zohoarc; b=JixyQce7V78BW45HCzkzvyzV+H6xitFqt8cfUma5qcGo383OKdL+gxZksh5lGSA/4IxzMteuUZ58kSba3Kt0/uR6RiMxwiGMw3JZ15fZ4mOHxCmVAQkK/DH3y9Z0ik3m75vo5SheqTn0igRsCEVz7f2T+iawO7/FuK17Z2xk00U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178073; 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=Pe+Oic4njGGmxURglaGoNTuOEZUNIAQE94m5aVZhaLg=; b=ZcOddUObTODgdsoyHZiK3QKeKO12mb4dZMDwvdrm6WsXplCZPAoyYSzMSwF4uk20VqqP6fVGQi3vE5xY5NJUh8/9nmeWC4T0YunMJvKDHmhDFKXKT044dY1B15RHtxG7WWc9EW0nXnSY11eAaKthma8TjMEFT+IKwHudBFNph0Q= 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 1769178073596441.95630053656; Fri, 23 Jan 2026 06:21:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzb-0001wI-4M; Fri, 23 Jan 2026 09:18:31 -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 1vjHzG-0000q3-HM for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:18 -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 1vjHzE-0003jL-AU for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:10 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CB8D85BCE1; Fri, 23 Jan 2026 14:17:44 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 014D51395E; Fri, 23 Jan 2026 14:17: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 yOXjLAaDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pe+Oic4njGGmxURglaGoNTuOEZUNIAQE94m5aVZhaLg=; b=fAufMI0dExRTppN9OJjRK1leHac9MKIO6xuqb5yOV+V3/DdprQjbCkmUCHQgowum9lcxUY nySTvFfW05mx5pjNlsvQaS9Y5+uzvUY9fij0NOG9lkr5RzMi5zyzoFev+fLN7LQxOfmtpb LMS2d6wAUyi1D4+0CGgsoN82pJXBDjM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pe+Oic4njGGmxURglaGoNTuOEZUNIAQE94m5aVZhaLg=; b=xGZWxvjrHJBolKEvwl3BULAXCASLInr+Ixj7mTuZqXacirBBjnznLPh3EUGRalQ4KJ8ek2 BLDj98iv9O5V2zCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pe+Oic4njGGmxURglaGoNTuOEZUNIAQE94m5aVZhaLg=; b=fAufMI0dExRTppN9OJjRK1leHac9MKIO6xuqb5yOV+V3/DdprQjbCkmUCHQgowum9lcxUY nySTvFfW05mx5pjNlsvQaS9Y5+uzvUY9fij0NOG9lkr5RzMi5zyzoFev+fLN7LQxOfmtpb LMS2d6wAUyi1D4+0CGgsoN82pJXBDjM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pe+Oic4njGGmxURglaGoNTuOEZUNIAQE94m5aVZhaLg=; b=xGZWxvjrHJBolKEvwl3BULAXCASLInr+Ixj7mTuZqXacirBBjnznLPh3EUGRalQ4KJ8ek2 BLDj98iv9O5V2zCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Li Zhijian Subject: [PATCH v4 18/25] migration: Move channel code to channel.c Date: Fri, 23 Jan 2026 11:16:48 -0300 Message-ID: <20260123141656.6765-19-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[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_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178074440154100 Content-Type: text/plain; charset="utf-8" Move the code responsible for the various channels connection into channel.c. This is all executed before the migration_thread and process_incoming_migration_co are running, so it helps the reasoning to have them out of migration.c. migration_ioc_process_incoming becomes migration_channel_identify which is more in line with what the function does. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/channel.c | 99 ++++++++++++++++++++++++++++++++++++++++++- migration/channel.h | 4 ++ migration/migration.c | 96 ----------------------------------------- migration/migration.h | 4 -- migration/rdma.c | 1 + 5 files changed, 103 insertions(+), 101 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index d1eec4942b..f61d30d986 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -14,13 +14,110 @@ #include "channel.h" #include "tls.h" #include "migration.h" +#include "multifd.h" +#include "savevm.h" #include "trace.h" +#include "options.h" #include "qapi/error.h" #include "io/channel-tls.h" #include "io/channel-socket.h" #include "qemu/yank.h" #include "yank_functions.h" =20 +bool migration_has_main_and_multifd_channels(void) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + if (!mis->from_src_file) { + /* main channel not established */ + return false; + } + + if (migrate_multifd() && !multifd_recv_all_channels_created()) { + return false; + } + + /* main and all multifd channels are established */ + return true; +} + +/** + * @migration_has_all_channels: We have received all channels that we need + * + * Returns true when we have got connections to all the channels that + * we need for migration. + */ +bool migration_has_all_channels(void) +{ + if (!migration_has_main_and_multifd_channels()) { + return false; + } + + MigrationIncomingState *mis =3D migration_incoming_get_current(); + if (migrate_postcopy_preempt() && !mis->postcopy_qemufile_dst) { + return false; + } + + return true; +} + +static MigChannelType migration_channel_identify(MigrationIncomingState *m= is, + QIOChannel *ioc, Error **= errp) +{ + MigChannelType channel =3D CH_NONE; + uint32_t channel_magic =3D 0; + int ret =3D 0; + + if (!migration_has_main_and_multifd_channels()) { + if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK= )) { + /* + * With multiple channels, it is possible that we receive chan= nels + * out of order on destination side, causing incorrect mapping= of + * source channels on destination side. Check channel MAGIC to + * decide type of channel. Please note this is best effort, + * postcopy preempt channel does not send any magic number so + * avoid it for postcopy live migration. Also tls live migrati= on + * already does tls handshake while initializing main channel = so + * with tls this issue is not possible. + */ + ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, + sizeof(channel_magic), errp); + if (ret !=3D 0) { + goto out; + } + + channel_magic =3D be32_to_cpu(channel_magic); + if (channel_magic =3D=3D QEMU_VM_FILE_MAGIC) { + channel =3D CH_MAIN; + } else if (channel_magic =3D=3D MULTIFD_MAGIC) { + assert(migrate_multifd()); + channel =3D CH_MULTIFD; + } else if (!mis->from_src_file && + mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED= ) { + /* reconnect main channel for postcopy recovery */ + channel =3D CH_MAIN; + } else { + error_setg(errp, "unknown channel magic: %u", channel_magi= c); + } + } else if (mis->from_src_file && migrate_multifd()) { + /* + * Non-peekable channels like tls/file are processed as + * multifd channels when multifd is enabled. + */ + channel =3D CH_MULTIFD; + } else if (!mis->from_src_file) { + channel =3D CH_MAIN; + } else { + error_setg(errp, "non-peekable channel used without multifd"); + } + } else { + assert(migrate_postcopy_preempt()); + channel =3D CH_POSTCOPY; + } + +out: + return channel; +} + /** * @migration_channel_process_incoming - Create new incoming migration cha= nnel * @@ -42,7 +139,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) migration_tls_channel_process_incoming(ioc, &local_err); } else { migration_ioc_register_yank(ioc); - ch =3D migration_ioc_process_incoming(ioc, &local_err); + ch =3D migration_channel_identify(mis, ioc, &local_err); if (!ch) { goto out; } diff --git a/migration/channel.h b/migration/channel.h index 574bfec65c..19aa5ab795 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -34,4 +34,8 @@ int migration_channel_read_peek(QIOChannel *ioc, const char *buf, const size_t buflen, Error **errp); + +bool migration_has_main_and_multifd_channels(void); +bool migration_has_all_channels(void); + #endif diff --git a/migration/migration.c b/migration/migration.c index c2040bea75..30cdd24a1c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -927,8 +927,6 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -static bool migration_has_main_and_multifd_channels(void); - /* * Returns whether all the necessary channels to proceed with the * incoming migration have been established without error. @@ -1022,100 +1020,6 @@ void migration_start_incoming(void) qemu_coroutine_enter(co); } =20 -static bool migration_has_main_and_multifd_channels(void) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - if (!mis->from_src_file) { - /* main channel not established */ - return false; - } - - if (migrate_multifd() && !multifd_recv_all_channels_created()) { - return false; - } - - /* main and all multifd channels are established */ - return true; -} - -MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - MigChannelType channel =3D CH_NONE; - uint32_t channel_magic =3D 0; - int ret =3D 0; - - if (!migration_has_main_and_multifd_channels()) { - if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK= )) { - /* - * With multiple channels, it is possible that we receive chan= nels - * out of order on destination side, causing incorrect mapping= of - * source channels on destination side. Check channel MAGIC to - * decide type of channel. Please note this is best effort, - * postcopy preempt channel does not send any magic number so - * avoid it for postcopy live migration. Also tls live migrati= on - * already does tls handshake while initializing main channel = so - * with tls this issue is not possible. - */ - ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, - sizeof(channel_magic), errp); - if (ret !=3D 0) { - goto out; - } - - channel_magic =3D be32_to_cpu(channel_magic); - if (channel_magic =3D=3D QEMU_VM_FILE_MAGIC) { - channel =3D CH_MAIN; - } else if (channel_magic =3D=3D MULTIFD_MAGIC) { - assert(migrate_multifd()); - channel =3D CH_MULTIFD; - } else if (!mis->from_src_file && - mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED= ) { - /* reconnect main channel for postcopy recovery */ - channel =3D CH_MAIN; - } else { - error_setg(errp, "unknown channel magic: %u", channel_magi= c); - } - } else if (mis->from_src_file && migrate_multifd()) { - /* - * Non-peekable channels like tls/file are processed as - * multifd channels when multifd is enabled. - */ - channel =3D CH_MULTIFD; - } else if (!mis->from_src_file) { - channel =3D CH_MAIN; - } else { - error_setg(errp, "non-peekable channel used without multifd"); - } - } else { - assert(migrate_postcopy_preempt()); - channel =3D CH_POSTCOPY; - } - -out: - return channel; -} - -/** - * @migration_has_all_channels: We have received all channels that we need - * - * Returns true when we have got connections to all the channels that - * we need for migration. - */ -bool migration_has_all_channels(void) -{ - if (!migration_has_main_and_multifd_channels()) { - return false; - } - - MigrationIncomingState *mis =3D migration_incoming_get_current(); - if (migrate_postcopy_preempt() && !mis->postcopy_qemufile_dst) { - return false; - } - - return true; -} - int migrate_send_rp_switchover_ack(MigrationIncomingState *mis) { return migrate_send_rp_message(mis, MIG_RP_MSG_SWITCHOVER_ACK, 0, NULL= ); diff --git a/migration/migration.h b/migration/migration.h index c4ea57d80a..b6888daced 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -28,7 +28,6 @@ #include "postcopy-ram.h" #include "system/runstate.h" #include "migration/misc.h" -#include "channel.h" =20 #define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" #define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" @@ -528,13 +527,10 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -MigChannelType migration_ioc_process_incoming(QIOChannel *ioc, Error **err= p); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); void migration_outgoing_setup(QIOChannel *ioc); =20 -bool migration_has_all_channels(void); - void migration_connect_error_propagate(MigrationState *s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); diff --git a/migration/rdma.c b/migration/rdma.c index 4d63fd723b..e628a20aec 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -18,6 +18,7 @@ #include "channel.h" #include "qapi/error.h" #include "qemu/cutils.h" +#include "channel.h" #include "exec/target_page.h" #include "rdma.h" #include "migration.h" --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769177988; cv=none; d=zohomail.com; s=zohoarc; b=BkdO5hHA5Ls/Q6vxaKvjSsOaHEEh03KVTYhrSjp0R5sgudOOeOMRGwVin2b41n+E+PXBXvLvh1y0VCQEuT/ptCAeTeGTz8A5WluwRYIZn4UAzm+8F6nPwNXYWiQt/iiBmEba5jvuoMOdplmC9ionFZvqRbwf0+CJvaOD3bN7t8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177988; 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=mv+SzcwxqoBy5jwKeGluFabRVdyT3QHGjS9bK1MCCDM=; b=WQNg6FYNEm8VtjAJI4ADbAVf1bWbXfYr4USqHmrrLZKG3GQakuq/s9HIiUcwLmU8xtFaz5EHq72oaubl+iInyIoBDdkA/2SyysfhSjjtz1mZOdmYefP6klv1zdfLRN8UV4BtWvlDLmmZ5AUc5+nVFPzbj2fIqw4bZH7m1XjmxFg= 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 1769177988484620.3569129329456; Fri, 23 Jan 2026 06:19:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzg-0002XP-Uy; Fri, 23 Jan 2026 09:18:37 -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 1vjHzM-00016H-Ew for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:23 -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 1vjHzK-0003k2-EU for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:16 -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 256EE5BCCF; Fri, 23 Jan 2026 14:17:47 +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 4F3411395E; Fri, 23 Jan 2026 14:17: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 6EpuBAmDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mv+SzcwxqoBy5jwKeGluFabRVdyT3QHGjS9bK1MCCDM=; b=V6aNZS0UaImIk6Ta6zv+2CZF7vhavg5f97Zn8GPEkhsuWSIg/hQeRg6F8FtoIP9FQEFVNt j5tYVtKiZrhtm0nT7BcitMMPRsmzgUy2aJIjael4BIVkXO8PNdl69EB7TgqHKEXxgm8hrb OHbVwghVisIfmKAluW0QQ364/Kq+Bco= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mv+SzcwxqoBy5jwKeGluFabRVdyT3QHGjS9bK1MCCDM=; b=Fwm4sdZi/tbqRdrGSIa86oNwhgSnBXn8TkRjPuFiIslBT9aoJT0sMfbysKuqcsJezpTxMh h6s3vz81V9V2DSDQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=V6aNZS0U; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Fwm4sdZi DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mv+SzcwxqoBy5jwKeGluFabRVdyT3QHGjS9bK1MCCDM=; b=V6aNZS0UaImIk6Ta6zv+2CZF7vhavg5f97Zn8GPEkhsuWSIg/hQeRg6F8FtoIP9FQEFVNt j5tYVtKiZrhtm0nT7BcitMMPRsmzgUy2aJIjael4BIVkXO8PNdl69EB7TgqHKEXxgm8hrb OHbVwghVisIfmKAluW0QQ364/Kq+Bco= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mv+SzcwxqoBy5jwKeGluFabRVdyT3QHGjS9bK1MCCDM=; b=Fwm4sdZi/tbqRdrGSIa86oNwhgSnBXn8TkRjPuFiIslBT9aoJT0sMfbysKuqcsJezpTxMh h6s3vz81V9V2DSDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 19/25] migration: Move transport connection code into channel.c Date: Fri, 23 Jan 2026 11:16:49 -0300 Message-ID: <20260123141656.6765-20-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:dkim, suse.de:email, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns, fedoraproject.org:email] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 256EE5BCCF X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177988805158500 Content-Type: text/plain; charset="utf-8" Move the _connect_incoming|outgoing functions to channel.c. It leaves migration.c to deal with the established connection only. While here, sort the includes. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 66 +++++++++++++++++++++++++++++++++++++++---- migration/channel.h | 4 +++ migration/migration.c | 46 ++---------------------------- 3 files changed, 67 insertions(+), 49 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index f61d30d986..56c80b5cdf 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -12,18 +12,74 @@ =20 #include "qemu/osdep.h" #include "channel.h" -#include "tls.h" +#include "exec.h" +#include "fd.h" +#include "file.h" +#include "io/channel-socket.h" +#include "io/channel-tls.h" #include "migration.h" #include "multifd.h" -#include "savevm.h" -#include "trace.h" #include "options.h" +#include "qapi/qapi-types-migration.h" #include "qapi/error.h" -#include "io/channel-tls.h" -#include "io/channel-socket.h" +#include "qemu-file.h" #include "qemu/yank.h" +#include "rdma.h" +#include "savevm.h" +#include "socket.h" +#include "tls.h" +#include "trace.h" #include "yank_functions.h" =20 +void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, + Error **errp) +{ + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &addr->u.socket; + if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { + socket_connect_outgoing(s, saddr, errp); + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + fd_connect_outgoing(s, saddr->u.fd.str, errp); + } +#ifdef CONFIG_RDMA + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_connect_outgoing(s, &addr->u.rdma, errp); +#endif + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_connect_outgoing(s, addr->u.exec.args, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_connect_outgoing(s, &addr->u.file, errp); + } else { + error_setg(errp, "uri is not a valid migration protocol"); + } +} + +void migration_connect_incoming(MigrationAddress *addr, Error **errp) +{ + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &addr->u.socket; + if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { + socket_connect_incoming(saddr, errp); + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + fd_connect_incoming(saddr->u.fd.str, errp); + } +#ifdef CONFIG_RDMA + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_connect_incoming(&addr->u.rdma, errp); +#endif + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_connect_incoming(addr->u.exec.args, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_connect_incoming(&addr->u.file, errp); + } else { + error_setg(errp, "unknown migration protocol"); + } +} + bool migration_has_main_and_multifd_channels(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/channel.h b/migration/channel.h index 19aa5ab795..8264fe327d 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -17,6 +17,7 @@ #define QEMU_MIGRATION_CHANNEL_H =20 #include "io/channel.h" +#include "qapi/qapi-types-migration.h" =20 /* Migration channel types */ typedef enum { @@ -38,4 +39,7 @@ int migration_channel_read_peek(QIOChannel *ioc, bool migration_has_main_and_multifd_channels(void); bool migration_has_all_channels(void); =20 +void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, + Error **errp); +void migration_connect_incoming(MigrationAddress *addr, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index 30cdd24a1c..c941cde29f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -20,13 +20,10 @@ #include "qemu/main-loop.h" #include "migration/blocker.h" #include "exec.h" -#include "fd.h" #include "file.h" -#include "socket.h" #include "system/runstate.h" #include "system/system.h" #include "system/cpu-throttle.h" -#include "rdma.h" #include "ram.h" #include "migration/cpr.h" #include "migration/global_state.h" @@ -783,26 +780,7 @@ static void qemu_setup_incoming_migration(const char *= uri, bool has_channels, return; } =20 - if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr =3D &addr->u.socket; - if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_connect_incoming(saddr, errp); - } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_connect_incoming(saddr->u.fd.str, errp); - } -#ifdef CONFIG_RDMA - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_connect_incoming(&addr->u.rdma, errp); -#endif - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_connect_incoming(addr->u.exec.args, errp); - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_connect_incoming(&addr->u.file, errp); - } else { - error_setg(errp, "unknown migration protocol: %s", uri); - } + migration_connect_incoming(addr, errp); =20 /* Close cpr socket to tell source that we are listening */ cpr_state_close(); @@ -2232,31 +2210,11 @@ static void qmp_migrate_finish(MigrationAddress *ad= dr, Error **errp) MigrationState *s =3D migrate_get_current(); Error *local_err =3D NULL; =20 - if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr =3D &addr->u.socket; - if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || - saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { - socket_connect_outgoing(s, saddr, &local_err); - } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_connect_outgoing(s, saddr->u.fd.str, &local_err); - } -#ifdef CONFIG_RDMA - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_connect_outgoing(s, &addr->u.rdma, &local_err); -#endif - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_connect_outgoing(s, addr->u.exec.args, &local_err); - } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_connect_outgoing(s, &addr->u.file, &local_err); - } else { - error_setg(&local_err, "uri is not a valid migration protocol"); - } + migration_connect_outgoing(s, addr, &local_err); =20 if (local_err) { migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); - return; } } =20 --=20 2.51.0 From nobody Sun Jan 25 10:13:46 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=1769178050; cv=none; d=zohomail.com; s=zohoarc; b=aWzRlgvudnowtrc3GnY5Xm6KNxbjPdz3DHs0teqQTacp1V29IycmeGQv1X1m1g4x+276qgx3KbAQBiqxgnJFv1TWGRuEWn8mDfo4s6eXOpguFbgcAKcTY/fO8/iqMQumvTXOjFH3MlAmXHmbcjjAo248ord7SKknIN7KYj3bnkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178050; 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=4Flwt09D6NLiFZ/6G0DH/eusslGop8Mijsv2auE6Flw=; b=PuqWAa43wGv69e60w/WpFYxF8RBSbTyCA0t5+GYXOUN2hk2KndJ3w5b8VN16LcnCzbR5QU8xs9qT5NFYERgIV4oQ2piJf6XkkBcu9YYrSBSfWYoyGWu5drDvO/N+lZyK1Nirru0g1NNjlgaL3C3/WTG3uaWC0LeD2iCIbGkPPYk= 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 1769178050165163.88631951644481; Fri, 23 Jan 2026 06:20:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzX-0001Uy-FL; Fri, 23 Jan 2026 09:18:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHzE-0000pO-Hc for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:08 -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 1vjHzC-0003iw-Oz for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:08 -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 769513380B; Fri, 23 Jan 2026 14:17:49 +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 9D0461395E; Fri, 23 Jan 2026 14:17: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 wC5jFwuDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177869; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Flwt09D6NLiFZ/6G0DH/eusslGop8Mijsv2auE6Flw=; b=SAxVf8Xtdo9TI+H/2sqjDHNBiIeonAfol+gI5htrok+pQRjIngc0hBhOax6zBxljdHvIFJ LG0TYtuTzOzmV3vcA7+4If6LOpr4amtkjPVV7VNvpcbTsr7MLFeR37CBVO4rjARgZtDj98 /jHlykBzrvBiRiKM/I6J+XKZrvaWPl4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177869; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Flwt09D6NLiFZ/6G0DH/eusslGop8Mijsv2auE6Flw=; b=V4v3DZwTLYSJ9qCRRK/ri7jN6CLejf0DEE0JioXUwIPzwBUqDMnvShSx+4IfHGDm3MWMBj oO2X9hZRvrmHqRDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177869; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Flwt09D6NLiFZ/6G0DH/eusslGop8Mijsv2auE6Flw=; b=SAxVf8Xtdo9TI+H/2sqjDHNBiIeonAfol+gI5htrok+pQRjIngc0hBhOax6zBxljdHvIFJ LG0TYtuTzOzmV3vcA7+4If6LOpr4amtkjPVV7VNvpcbTsr7MLFeR37CBVO4rjARgZtDj98 /jHlykBzrvBiRiKM/I6J+XKZrvaWPl4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177869; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Flwt09D6NLiFZ/6G0DH/eusslGop8Mijsv2auE6Flw=; b=V4v3DZwTLYSJ9qCRRK/ri7jN6CLejf0DEE0JioXUwIPzwBUqDMnvShSx+4IfHGDm3MWMBj oO2X9hZRvrmHqRDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 20/25] migration: Move channel parsing to channel.c Date: Fri, 23 Jan 2026 11:16:50 -0300 Message-ID: <20260123141656.6765-21-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; 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)[fedoraproject.org:email,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_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178052111154101 Content-Type: text/plain; charset="utf-8" Encapsulate the MigrationChannelList parsing in a new migrate_channels_parse() located at channel.c. This also makes the memory management of the MigrationAddress more uniform. Previously, half the parsing code (uri parsing) would allocate memory for the address while the other half (channel parsing) would instead pass the original QAPI object along. After this patch, the MigrationAddress is always QAPI_CLONEd, so the callers can use g_autoptr(MigrationAddress) in all cases. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 49 +++++++++++++++++++++++++++++++++++++++ migration/channel.h | 5 ++++ migration/migration.c | 53 +++++++++++-------------------------------- 3 files changed, 67 insertions(+), 40 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 56c80b5cdf..433d67fba0 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "channel.h" #include "exec.h" #include "fd.h" @@ -20,7 +21,9 @@ #include "migration.h" #include "multifd.h" #include "options.h" +#include "qapi/clone-visitor.h" #include "qapi/qapi-types-migration.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/error.h" #include "qemu-file.h" #include "qemu/yank.h" @@ -280,3 +283,49 @@ int migration_channel_read_peek(QIOChannel *ioc, =20 return 0; } + +bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) +{ + MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; + + if (!cpr_channelp && channels->next) { + error_setg(errp, "Channel list must have only one entry, " + "for type 'main'"); + return false; + } + + for ( ; channels; channels =3D channels->next) { + MigrationChannelType type; + + type =3D channels->value->channel_type; + if (channelv[type]) { + error_setg(errp, "Channel list has more than one %s entry", + MigrationChannelType_str(type)); + return false; + } + channelv[type] =3D channels->value; + } + + if (cpr_channelp) { + *cpr_channelp =3D QAPI_CLONE(MigrationChannel, + channelv[MIGRATION_CHANNEL_TYPE_CPR]); + + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !*cpr_channelp)= { + error_setg(errp, "missing 'cpr' migration channel"); + return false; + } + } + + *main_channelp =3D QAPI_CLONE(MigrationChannel, + channelv[MIGRATION_CHANNEL_TYPE_MAIN]); + + if (!(*main_channelp)->addr) { + error_setg(errp, "Channel list has no main entry"); + return false; + } + + return true; +} diff --git a/migration/channel.h b/migration/channel.h index 8264fe327d..5110fb45a4 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -42,4 +42,9 @@ bool migration_has_all_channels(void); void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, Error **errp); void migration_connect_incoming(MigrationAddress *addr, Error **errp); + +bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index c941cde29f..09dfc27323 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -741,8 +741,7 @@ static void qemu_setup_incoming_migration(const char *u= ri, bool has_channels, MigrationChannelList *channels, Error **errp) { - g_autoptr(MigrationChannel) channel =3D NULL; - MigrationAddress *addr =3D NULL; + g_autoptr(MigrationChannel) main_ch =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 /* @@ -754,25 +753,20 @@ static void qemu_setup_incoming_migration(const char = *uri, bool has_channels, } =20 if (channels) { - /* To verify that Migrate channel list has only item */ - if (channels->next) { - error_setg(errp, "Channel list must have only one entry, " - "for type 'main'"); + if (!migrate_channels_parse(channels, &main_ch, NULL, errp)) { return; } - addr =3D channels->value->addr; } =20 if (uri) { /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &channel, errp)) { + if (!migrate_uri_parse(uri, &main_ch, errp)) { return; } - addr =3D channel->addr; } =20 /* transport mechanism not suitable for migration? */ - if (!migration_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(main_ch->addr, errp)) { return; } =20 @@ -780,7 +774,7 @@ static void qemu_setup_incoming_migration(const char *u= ri, bool has_channels, return; } =20 - migration_connect_incoming(addr, errp); + migration_connect_incoming(main_ch->addr, errp); =20 /* Close cpr socket to tell source that we are listening */ cpr_state_close(); @@ -2114,10 +2108,8 @@ void qmp_migrate(const char *uri, bool has_channels, bool has_resume, bool resume, Error **errp) { MigrationState *s =3D migrate_get_current(); - g_autoptr(MigrationChannel) channel =3D NULL; - MigrationAddress *addr =3D NULL; - MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; - MigrationChannel *cpr_channel =3D NULL; + g_autoptr(MigrationChannel) main_ch =3D NULL; + g_autoptr(MigrationChannel) cpr_ch =3D NULL; =20 /* * Having preliminary checks for uri and channel @@ -2128,39 +2120,20 @@ void qmp_migrate(const char *uri, bool has_channels, } =20 if (channels) { - for ( ; channels; channels =3D channels->next) { - MigrationChannelType type =3D channels->value->channel_type; - - if (channelv[type]) { - error_setg(errp, "Channel list has more than one %s entry", - MigrationChannelType_str(type)); - return; - } - channelv[type] =3D channels->value; - } - cpr_channel =3D channelv[MIGRATION_CHANNEL_TYPE_CPR]; - addr =3D channelv[MIGRATION_CHANNEL_TYPE_MAIN]->addr; - if (!addr) { - error_setg(errp, "Channel list has no main entry"); + if (!migrate_channels_parse(channels, &main_ch, &cpr_ch, errp)) { return; } } =20 if (uri) { /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &channel, errp)) { + if (!migrate_uri_parse(uri, &main_ch, errp)) { return; } - addr =3D channel->addr; } =20 /* transport mechanism not suitable for migration? */ - if (!migration_transport_compatible(addr, errp)) { - return; - } - - if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { - error_setg(errp, "missing 'cpr' migration channel"); + if (!migration_transport_compatible(main_ch->addr, errp)) { return; } =20 @@ -2176,7 +2149,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 @@ -2192,10 +2165,10 @@ void qmp_migrate(const char *uri, bool has_channels, */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, - QAPI_CLONE(MigrationAddress, addr)); + QAPI_CLONE(MigrationAddress, main_ch->addr)); =20 } else { - qmp_migrate_finish(addr, errp); + qmp_migrate_finish(main_ch->addr, errp); } =20 out: --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769177952; cv=none; d=zohomail.com; s=zohoarc; b=Ga0FsM3+GUasqXixatuVfl6jrp/X+V3/47BXMlSlvsPr9plweQxWVRwjI2OZNEH1Bp0B+N7M5OIYwU2faPRCpe+8Uzn6sn6g0JSxZJK/AJ0i6ttdUydrncmUdbmtwh3eUWX2+A/IaPnAa5lAxb2Xw2OpcASqjjkWmozRri3rPWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769177952; 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=juq5rqgwVkbNkLwCcrdqt1RPQcNkTZVsPjQMORVfBiQ=; b=glrOMKDHjnBgzz3EWR8UWuI5x7R2z40udWlZ7qHPKT7lk99om/EjMI3FYDnV8ahtaltWHau/bRMov8UUoihbCqIf4Iq/1k6cFx4QVT9Hov8CNjaUaNclY+1nuDWeouUoE5mPR6rFZfw5B1LFT8hs/QkVz58m4kFiOus2+SyZXuc= 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 1769177952003538.7134882248835; Fri, 23 Jan 2026 06:19:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjHzZ-0001fR-2S; Fri, 23 Jan 2026 09:18: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 1vjHzK-000164-Md for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:20 -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 1vjHzI-0003jk-1j for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18: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-out1.suse.de (Postfix) with ESMTPS id C4B2333810; Fri, 23 Jan 2026 14:17: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 EDD031395E; Fri, 23 Jan 2026 14:17:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YH0fKw2Dc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177871; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juq5rqgwVkbNkLwCcrdqt1RPQcNkTZVsPjQMORVfBiQ=; b=YsngfzNgpx8Pu1NIqrJX5ThzF9yVZ9Ns3PPzCZD4eDzGkk4/HI22OfrxkaaSWIKOdO42Q+ 4wrOE9ARwC9+0W0b7oYLrUOImWwTKldrwf+y2boagn+CIysitNm/If0YvgQjlKkJSmBvGw BX64cXZuvZyzC6E22AveWIpX8O4abuo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177871; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juq5rqgwVkbNkLwCcrdqt1RPQcNkTZVsPjQMORVfBiQ=; b=q695qmer293vhrsB8npyMLUnn9TTtFKOXnopHdFTGB/t/1DnMqriqi+Egokow0xMMDTkwU Ezpy8IvCiVdEMZDQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=YsngfzNg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=q695qmer DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177871; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juq5rqgwVkbNkLwCcrdqt1RPQcNkTZVsPjQMORVfBiQ=; b=YsngfzNgpx8Pu1NIqrJX5ThzF9yVZ9Ns3PPzCZD4eDzGkk4/HI22OfrxkaaSWIKOdO42Q+ 4wrOE9ARwC9+0W0b7oYLrUOImWwTKldrwf+y2boagn+CIysitNm/If0YvgQjlKkJSmBvGw BX64cXZuvZyzC6E22AveWIpX8O4abuo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177871; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juq5rqgwVkbNkLwCcrdqt1RPQcNkTZVsPjQMORVfBiQ=; b=q695qmer293vhrsB8npyMLUnn9TTtFKOXnopHdFTGB/t/1DnMqriqi+Egokow0xMMDTkwU Ezpy8IvCiVdEMZDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 21/25] migration: Move URI parsing to channel.c Date: Fri, 23 Jan 2026 11:16:51 -0300 Message-ID: <20260123141656.6765-22-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_RATELIMIT(0.00)[to_ip_from(RL3zxdrj4h6o64essgck3rrntz)]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:dkim, suse.de:email, fedoraproject.org:email, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: C4B2333810 X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769177954638154100 Content-Type: text/plain; charset="utf-8" The migrate_uri_parse function is responsible for converting the URI string into a MigrationChannel for consumption by the rest of the code. Move it to channel.c and add a wrapper that calls both URI and channels parsing. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 82 +++++++++++++++++++++++++++++++++++-- migration/channel.h | 9 ++-- migration/migration.c | 95 ++----------------------------------------- 3 files changed, 86 insertions(+), 100 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 433d67fba0..1e4778455d 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -284,10 +284,10 @@ int migration_channel_read_peek(QIOChannel *ioc, return 0; } =20 -bool migrate_channels_parse(MigrationChannelList *channels, - MigrationChannel **main_channelp, - MigrationChannel **cpr_channelp, - Error **errp) +static bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) { MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; =20 @@ -329,3 +329,77 @@ bool migrate_channels_parse(MigrationChannelList *chan= nels, =20 return true; } + +bool migrate_uri_parse(const char *uri, MigrationChannel **channel, + Error **errp) +{ + g_autoptr(MigrationChannel) val =3D g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); + InetSocketAddress *isock =3D &addr->u.rdma; + strList **tail =3D &addr->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_EXEC; +#ifdef WIN32 + QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); + QAPI_LIST_APPEND(tail, g_strdup("/c")); +#else + QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); + QAPI_LIST_APPEND(tail, g_strdup("-c")); +#endif + QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); + } else if (strstart(uri, "rdma:", NULL)) { + if (inet_parse(isock, uri + strlen("rdma:"), errp)) { + qapi_free_InetSocketAddress(isock); + return false; + } + addr->transport =3D MIGRATION_ADDRESS_TYPE_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_SOCKET; + SocketAddress *saddr =3D socket_parse(uri, errp); + if (!saddr) { + return false; + } + addr->u.socket.type =3D saddr->type; + addr->u.socket.u =3D saddr->u; + /* Don't free the objects inside; their ownership moved to "addr" = */ + g_free(saddr); + } else if (strstart(uri, "file:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_FILE; + addr->u.file.filename =3D g_strdup(uri + strlen("file:")); + if (file_parse_offset(addr->u.file.filename, &addr->u.file.offset, + errp)) { + return false; + } + } else { + error_setg(errp, "unknown migration protocol: %s", uri); + return false; + } + + val->channel_type =3D MIGRATION_CHANNEL_TYPE_MAIN; + val->addr =3D g_steal_pointer(&addr); + *channel =3D g_steal_pointer(&val); + return true; +} + +bool migration_channel_parse_input(const char *uri, + MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) +{ + if (!uri =3D=3D !channels) { + error_setg(errp, "need either 'uri' or 'channels' argument"); + return false; + } + + if (channels) { + return migrate_channels_parse(channels, main_channelp, cpr_channel= p, + errp); + } else { + return migrate_uri_parse(uri, main_channelp, errp); + } +} diff --git a/migration/channel.h b/migration/channel.h index 5110fb45a4..a7d0d29058 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -43,8 +43,9 @@ void migration_connect_outgoing(MigrationState *s, Migrat= ionAddress *addr, Error **errp); void migration_connect_incoming(MigrationAddress *addr, Error **errp); =20 -bool migrate_channels_parse(MigrationChannelList *channels, - MigrationChannel **main_channelp, - MigrationChannel **cpr_channelp, - Error **errp); +bool migration_channel_parse_input(const char *uri, + MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index 09dfc27323..ebe4222640 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; @@ -2111,27 +2038,11 @@ void qmp_migrate(const char *uri, bool has_channels, g_autoptr(MigrationChannel) main_ch =3D NULL; g_autoptr(MigrationChannel) cpr_ch =3D NULL; =20 - /* - * Having preliminary checks for uri and channel - */ - if (!uri =3D=3D !channels) { - error_setg(errp, "need either 'uri' or 'channels' argument"); + if (!migration_channel_parse_input(uri, channels, &main_ch, &cpr_ch, + errp)) { return; } =20 - if (channels) { - if (!migrate_channels_parse(channels, &main_ch, &cpr_ch, errp)) { - return; - } - } - - if (uri) { - /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &main_ch, errp)) { - return; - } - } - /* transport mechanism not suitable for migration? */ if (!migration_transport_compatible(main_ch->addr, errp)) { return; --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769178125; cv=none; d=zohomail.com; s=zohoarc; b=I3pvIysKXir6Vx48//eCQJgX6Fz7eFe49q4Uu4FZrwp9NqmA7AxKR5Ehr/SAW3WllLlWpe09ezzhT2uwCBIrqV9T+392ZV9e+1/ey/m8VkV1U/fHkwrGJ9Gqdaj23K9IpVqIxeyBDFh3i4eKm4NXZI2MMts9x5zPQ41jqgbu6V0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178125; 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=rZPri9XOeHmUVpMrjSl9jQ8mol01bo5xt+DxFR+zAaA=; b=P9QnoOvhaoBWrcFmb73+dxv2Hxf2jhtgotv2ynuplogIMmJwCR0mBZdWGzTJ1Hbao4QE2gExGC1JpUdBcse/tSJl+kiMvnErVaaw2V58OyxYxgnjScgSmJEBhco9nX1poTdVHZxzLzxEw0GhkLRaxaZ5ANp2wWf+1E9xTomoCjU= 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 1769178125062752.7033921117455; Fri, 23 Jan 2026 06:22:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjI0d-0003Pw-JA; Fri, 23 Jan 2026 09:19:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjHzR-00018V-OS for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:24 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjHzQ-0003kY-4V for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18: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 9615F33812; Fri, 23 Jan 2026 14:17:54 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 473261395E; Fri, 23 Jan 2026 14:17:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WOOpARCDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177874; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rZPri9XOeHmUVpMrjSl9jQ8mol01bo5xt+DxFR+zAaA=; b=xTUQiJjoXqpX1F7TUbYJo7pd3xkdAmbO9x+n8JKUsMJjklB8z7krwuoP1pfL6vqHNShc+X P7dTsaiJwTBDJ46VDDaCu2kjrXvrXsYct6fl7ZBWPmVyS3BT89OcPZdyULwQAr/ZEsb6IO mKXVdT7vsSHGJO40piFZyRIFbCssQwY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177874; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rZPri9XOeHmUVpMrjSl9jQ8mol01bo5xt+DxFR+zAaA=; b=SnM9TlDc6TzeiTCwrhEFhXYNDXaHAOWpL5ThX6SKGO4lvdUfcUOuaBNuzdAlvt9SnqbSUW KcU+JlqjNXotKfBw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xTUQiJjo; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=SnM9TlDc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177874; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rZPri9XOeHmUVpMrjSl9jQ8mol01bo5xt+DxFR+zAaA=; b=xTUQiJjoXqpX1F7TUbYJo7pd3xkdAmbO9x+n8JKUsMJjklB8z7krwuoP1pfL6vqHNShc+X P7dTsaiJwTBDJ46VDDaCu2kjrXvrXsYct6fl7ZBWPmVyS3BT89OcPZdyULwQAr/ZEsb6IO mKXVdT7vsSHGJO40piFZyRIFbCssQwY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177874; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rZPri9XOeHmUVpMrjSl9jQ8mol01bo5xt+DxFR+zAaA=; b=SnM9TlDc6TzeiTCwrhEFhXYNDXaHAOWpL5ThX6SKGO4lvdUfcUOuaBNuzdAlvt9SnqbSUW KcU+JlqjNXotKfBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Mark Kanda , Ben Chaney , Prasad Pandit Subject: [PATCH v4 22/25] migration: Free cpr-transfer MigrationAddress along with gsource Date: Fri, 23 Jan 2026 11:16:52 -0300 Message-ID: <20260123141656.6765-23-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-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%]; 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)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_SEVEN(0.00)[7]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,oracle.com:email,fedoraproject.org:email]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 9615F33812 X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178127209154100 Content-Type: text/plain; charset="utf-8" When setting a callback on a Glib source and giving it a data pointer, it's natural to also provide the destructor for the data in question. Since migrate_hup_add() already needs to clone the MigrationAddress when setting the qmp_migrate_finish_cb callback, also pass the qapi_free_MigrationAddress as the GDestroyNotify callback. With this the address doesn't need to be freed at the callback body, making the management of that memory slightly simpler. Cc: Mark Kanda Cc: Ben Chaney Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ebe4222640..2b8e916066 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2005,9 +2005,11 @@ static void qmp_migrate_finish(MigrationAddress *add= r, Error **errp); static void migrate_hup_add(MigrationState *s, QIOChannel *ioc, GSourceFun= c cb, void *opaque) { - s->hup_source =3D qio_channel_create_watch(ioc, G_IO_HUP); - g_source_set_callback(s->hup_source, cb, opaque, NULL); - g_source_attach(s->hup_source, NULL); + s->hup_source =3D qio_channel_create_watch(ioc, G_IO_HUP); + g_source_set_callback(s->hup_source, cb, + QAPI_CLONE(MigrationAddress, opaque), + (GDestroyNotify)qapi_free_MigrationAddress); + g_source_attach(s->hup_source, NULL); } =20 static void migrate_hup_delete(MigrationState *s) @@ -2026,7 +2028,6 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, MigrationAddress *addr =3D opaque; =20 qmp_migrate_finish(addr, NULL); - qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } =20 @@ -2076,7 +2077,7 @@ void qmp_migrate(const char *uri, bool has_channels, */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, - QAPI_CLONE(MigrationAddress, main_ch->addr)); + main_ch->addr); =20 } else { qmp_migrate_finish(main_ch->addr, errp); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769178080; cv=none; d=zohomail.com; s=zohoarc; b=NSMfSkaUbWDjxRzuulTTETIGxtb7ja0lUXHKRJKI6Wqj2Wqguu73NCnTkXIlddiW0VEf/igdTlXFnTRlu5YDnMqSvJt7tXThJddePNxz7IMVCT5dQEzLBPCzXVz+cxduWH6E9EDvbhlmC323oaGbTOROthBPknRK7D8ZvojPzuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178080; 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=vcvRMAfoRcaWjRR+0bAYhK0HPmdr75Rc6H3jkHkKIfw=; b=mw9b73uIn41QD4Ic9h8fHmB7ABoOMrvYxaj2P06GF/b+cfU/4PiywOh86YdYvbORydcuVqzH5yEhFkK56JrHvf4x5g+tb1IaqEYl34Medep8uQ7K0F3414VwbbtbNoHFFZ1+92I+iPo2b6IZRTt/vtxJNQhQi8gnDWVxb4B8Xsw= 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 1769178080257284.00012199688285; Fri, 23 Jan 2026 06: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 1vjHzg-0002Wx-Uy; Fri, 23 Jan 2026 09:18:37 -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 1vjHzS-00018W-3c for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:24 -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 1vjHzQ-0003kk-A4 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:21 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 681C65BCCE; Fri, 23 Jan 2026 14:17: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 177F61395E; Fri, 23 Jan 2026 14:17:54 +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 0Ml+MhKDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177877; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vcvRMAfoRcaWjRR+0bAYhK0HPmdr75Rc6H3jkHkKIfw=; b=fUFzvdblnnkdMWG/a4NVHhN0M+GzYc4Sz78vcwZAlZ+KUOO4T+azwvUvF80jhCSh0lOB3R vegfUSLpnhN66YIOQIK1OsTtQY6lRIUO+Ztx+msjESK3AybUzoviqZZTrDAWvRP4o5+z8a ipc5JZ4QiHRO1LhnDibS1Oj4QEgeC7M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177877; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vcvRMAfoRcaWjRR+0bAYhK0HPmdr75Rc6H3jkHkKIfw=; b=wmhl6ZPhquHbwhP65lLCV+7KNr4poAAbdxaPRLKtBS8cQH7Vbaa4E5irQB7hnLlKPL8DfR EazAJS9iS6Z2xUBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177877; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vcvRMAfoRcaWjRR+0bAYhK0HPmdr75Rc6H3jkHkKIfw=; b=fUFzvdblnnkdMWG/a4NVHhN0M+GzYc4Sz78vcwZAlZ+KUOO4T+azwvUvF80jhCSh0lOB3R vegfUSLpnhN66YIOQIK1OsTtQY6lRIUO+Ztx+msjESK3AybUzoviqZZTrDAWvRP4o5+z8a ipc5JZ4QiHRO1LhnDibS1Oj4QEgeC7M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177877; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vcvRMAfoRcaWjRR+0bAYhK0HPmdr75Rc6H3jkHkKIfw=; b=wmhl6ZPhquHbwhP65lLCV+7KNr4poAAbdxaPRLKtBS8cQH7Vbaa4E5irQB7hnLlKPL8DfR EazAJS9iS6Z2xUBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit , Mark Kanda , Ben Chaney Subject: [PATCH v4 23/25] migration: Move CPR HUP watch to cpr-transfer.c Date: Fri, 23 Jan 2026 11:16:53 -0300 Message-ID: <20260123141656.6765-24-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[fedoraproject.org:email,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(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 client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178082509154100 Content-Type: text/plain; charset="utf-8" Move this CPR-specific code into a cpr file. While here, give the functions more significant names. This makes the new idea (after cpr-transfer) of having two parts to qmp_migrate slightly more obvious: either wait for the hangup or continue directly. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- include/migration/cpr.h | 5 +++++ migration/cpr-transfer.c | 23 +++++++++++++++++++++++ migration/migration.c | 27 +++------------------------ 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/include/migration/cpr.h b/include/migration/cpr.h index 027cb98073..5850fd1788 100644 --- a/include/migration/cpr.h +++ b/include/migration/cpr.h @@ -9,6 +9,7 @@ #define MIGRATION_CPR_H =20 #include "qapi/qapi-types-migration.h" +#include "io/channel.h" #include "qemu/queue.h" =20 #define MIG_MODE_NONE -1 @@ -53,6 +54,10 @@ int cpr_get_fd_param(const char *name, const char *fdnam= e, int index, QEMUFile *cpr_transfer_output(MigrationChannel *channel, Error **errp); QEMUFile *cpr_transfer_input(MigrationChannel *channel, Error **errp); =20 +void cpr_transfer_add_hup_watch(MigrationState *s, QIOChannelFunc func, + void *opaque); +void cpr_transfer_source_destroy(MigrationState *s); + void cpr_exec_init(void); QEMUFile *cpr_exec_output(Error **errp); QEMUFile *cpr_exec_input(Error **errp); diff --git a/migration/cpr-transfer.c b/migration/cpr-transfer.c index 00371d17c3..61d5c9dce2 100644 --- a/migration/cpr-transfer.c +++ b/migration/cpr-transfer.c @@ -6,7 +6,10 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/clone-visitor.h" #include "qapi/error.h" +#include "qapi/qapi-visit-migration.h" +#include "io/channel.h" #include "io/channel-file.h" #include "io/channel-socket.h" #include "io/net-listener.h" @@ -72,3 +75,23 @@ QEMUFile *cpr_transfer_input(MigrationChannel *channel, = Error **errp) return NULL; } } + +void cpr_transfer_add_hup_watch(MigrationState *s, QIOChannelFunc func, + void *opaque) +{ + s->hup_source =3D qio_channel_create_watch(cpr_state_ioc(), G_IO_HUP); + g_source_set_callback(s->hup_source, + (GSourceFunc)func, + QAPI_CLONE(MigrationAddress, opaque), + (GDestroyNotify)qapi_free_MigrationAddress); + g_source_attach(s->hup_source, NULL); +} + +void cpr_transfer_source_destroy(MigrationState *s) +{ + if (s->hup_source) { + g_source_destroy(s->hup_source); + g_source_unref(s->hup_source); + s->hup_source =3D NULL; + } +} diff --git a/migration/migration.c b/migration/migration.c index 2b8e916066..eb755ac59c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -100,7 +100,6 @@ static bool migration_object_check(MigrationState *ms, = Error **errp); static bool migration_switchover_start(MigrationState *s, Error **errp); static bool close_return_path_on_source(MigrationState *s); static void migration_completion_end(MigrationState *s); -static void migrate_hup_delete(MigrationState *s); =20 static void migration_downtime_start(MigrationState *s) { @@ -1297,7 +1296,7 @@ static void migration_cleanup(MigrationState *s) =20 qemu_savevm_state_cleanup(); cpr_state_close(); - migrate_hup_delete(s); + cpr_transfer_source_destroy(s); =20 close_return_path_on_source(s); =20 @@ -1478,7 +1477,7 @@ void migration_cancel(void) migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED); cpr_state_close(); - migrate_hup_delete(s); + cpr_transfer_source_destroy(s); } } =20 @@ -2002,25 +2001,6 @@ static bool migrate_prepare(MigrationState *s, bool = resume, Error **errp) =20 static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); =20 -static void migrate_hup_add(MigrationState *s, QIOChannel *ioc, GSourceFun= c cb, - void *opaque) -{ - s->hup_source =3D qio_channel_create_watch(ioc, G_IO_HUP); - g_source_set_callback(s->hup_source, cb, - QAPI_CLONE(MigrationAddress, opaque), - (GDestroyNotify)qapi_free_MigrationAddress); - g_source_attach(s->hup_source, NULL); -} - -static void migrate_hup_delete(MigrationState *s) -{ - if (s->hup_source) { - g_source_destroy(s->hup_source); - g_source_unref(s->hup_source); - s->hup_source =3D NULL; - } -} - static gboolean qmp_migrate_finish_cb(QIOChannel *channel, GIOCondition cond, void *opaque) @@ -2076,8 +2056,7 @@ void qmp_migrate(const char *uri, bool has_channels, * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { - migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, - main_ch->addr); + cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, main_ch->addr= ); =20 } else { qmp_migrate_finish(main_ch->addr, errp); --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769178113; cv=none; d=zohomail.com; s=zohoarc; b=GdOR94p/BlmB7ghD5bK5+vhrOczMdsUmVzhonzyjgnp3zUSbLZprTZhfKCosCdl/jxkwtkups9mvzjujNKF05uBYjHRCkdGdURmu7f4vbwR1+rVMRet7aQ+6i0y0cWYTklVC7e7CBw4DoxSYS8jgzHEfC+lq4wlv7MylbqDUQOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178113; 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=Xg3nH2VvsYRln5tA8MxnJUSTZ9avJZU4ulARReYGG1A=; b=I4zbkc5PgWUmAS4eCUGAYaTFKLyGe2fXUebbcAI7ZoP1owomXdMw47OugYC2DGPgl+j7V8T0EN9i2RzMFBnBh+JZUGFRHJSdzvFPBm04s9R0xCigov437QjLds90eaANEh7FIkExwVKj3PIDyBRWe35P2a5BOi+5GcynYiee1ps= 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 1769178113597789.8478430290942; Fri, 23 Jan 2026 06: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 1vjHzc-0002An-4b; Fri, 23 Jan 2026 09:18:32 -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 1vjHzX-0001VE-Di for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:27 -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 1vjHzV-0003lY-P9 for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:27 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B30A133815; Fri, 23 Jan 2026 14:17:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DB0531395E; Fri, 23 Jan 2026 14:17: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 MLycJhWDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:17:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xg3nH2VvsYRln5tA8MxnJUSTZ9avJZU4ulARReYGG1A=; b=XTRYjMjdrdIZhLFCBAQ0dBiHxnnR4g2jLgFOUrX8gtJMvf1tdeUfRAwNVRU/i9rrqc3D79 j/tjglOi9qamreUZF80E2ZxE34I5BIgTv+NAuY470OCWDuTtcYTD2VkSEq4VOpHEceCrXN ddYM8MOR66VyoLoJo3NSgJBia3EFTT8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xg3nH2VvsYRln5tA8MxnJUSTZ9avJZU4ulARReYGG1A=; b=t9UOpgAHmOpQJdBqE9V3uc9pVbt2fV2vw3Ehp9vHGqUSc3STEo8VvkUtE5d+A37WVNFUX0 MYJHzHAzmX1CSxCQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xg3nH2VvsYRln5tA8MxnJUSTZ9avJZU4ulARReYGG1A=; b=XTRYjMjdrdIZhLFCBAQ0dBiHxnnR4g2jLgFOUrX8gtJMvf1tdeUfRAwNVRU/i9rrqc3D79 j/tjglOi9qamreUZF80E2ZxE34I5BIgTv+NAuY470OCWDuTtcYTD2VkSEq4VOpHEceCrXN ddYM8MOR66VyoLoJo3NSgJBia3EFTT8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xg3nH2VvsYRln5tA8MxnJUSTZ9avJZU4ulARReYGG1A=; b=t9UOpgAHmOpQJdBqE9V3uc9pVbt2fV2vw3Ehp9vHGqUSc3STEo8VvkUtE5d+A37WVNFUX0 MYJHzHAzmX1CSxCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit Subject: [PATCH v4 24/25] migration: Remove qmp_migrate_finish Date: Fri, 23 Jan 2026 11:16:54 -0300 Message-ID: <20260123141656.6765-25-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,fedoraproject.org: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_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178117329154100 Content-Type: text/plain; charset="utf-8" After cleanups, the qmp_migrate_finish function is now just a call to migration_connect_outgoing(). Remove qmp_migrate_finish() and rename the qmp_migrate_finish_cb callback. This also allows the function's error handling to be removed as it now receives &local_err like the rest of the callees of qmp_migrate(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/migration.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index eb755ac59c..7086c9e1d2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1999,15 +1999,18 @@ static bool migrate_prepare(MigrationState *s, bool= resume, Error **errp) return true; } =20 -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); - -static gboolean qmp_migrate_finish_cb(QIOChannel *channel, - GIOCondition cond, - void *opaque) +static gboolean migration_connect_outgoing_cb(QIOChannel *channel, + GIOCondition cond, void *opa= que) { - MigrationAddress *addr =3D opaque; + MigrationState *s =3D migrate_get_current(); + Error *local_err =3D NULL; + + migration_connect_outgoing(s, opaque, &local_err); + + if (local_err) { + migration_connect_error_propagate(s, local_err); + } =20 - qmp_migrate_finish(addr, NULL); return G_SOURCE_REMOVE; } =20 @@ -2056,10 +2059,11 @@ void qmp_migrate(const char *uri, bool has_channels, * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { - cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, main_ch->addr= ); + cpr_transfer_add_hup_watch(s, migration_connect_outgoing_cb, + main_ch->addr); =20 } else { - qmp_migrate_finish(main_ch->addr, errp); + migration_connect_outgoing(s, main_ch->addr, &local_err); } =20 out: @@ -2069,19 +2073,6 @@ out: } } =20 -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - Error *local_err =3D NULL; - - migration_connect_outgoing(s, addr, &local_err); - - if (local_err) { - migration_connect_error_propagate(s, error_copy(local_err)); - error_propagate(errp, local_err); - } -} - void qmp_migrate_cancel(Error **errp) { /* --=20 2.51.0 From nobody Sun Jan 25 10:13:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1769178129; cv=none; d=zohomail.com; s=zohoarc; b=lDGVvF7XWx2HiTNUdrexAx5iNyOODvBrTK/rX1p+ZIzgcTh/Qz1QnaTWzWzH3kuF5Pe0CncGtPaOlXEJP6bLGVmu2FIa1AQonbVsBYDkhOEJIuCMA8gs7/UFyYfzaRcgCjmzwR93v00OU60ACD0FOmSxTxL/RItQ0stVNrSZNEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769178129; 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=81VHRIXcx1x0YC/RsTOBX9/YTB66Vtw5nabQAD1eRQA=; b=hM291QqCkFsbzJZ6O9k4K3Qv2xxIm1NMMPBxa9eA7+Eyrx2X8/KxNPNX5pDTL+hkMb6tTvU9aBz4+fQXk/LJIEARag9axjSOtZ0BghD+bHb3k5COTb/CghBaurV++Gmp0n6VLGQNHL6einvN8/vf1H/+QlMe7XhtzefVi2Djmhg= 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 1769178129036747.9620003257638; Fri, 23 Jan 2026 06:22:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjI0o-0003l0-GN; Fri, 23 Jan 2026 09:19:49 -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 1vjHze-0002Sj-3g for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:34 -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 1vjHzb-0003n7-EG for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:18:33 -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 4E82033816; Fri, 23 Jan 2026 14:18: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 402731395E; Fri, 23 Jan 2026 14:18:00 +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 6DC0ABiDc2m8HAAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 14:18:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177882; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=81VHRIXcx1x0YC/RsTOBX9/YTB66Vtw5nabQAD1eRQA=; b=bx+/KvtmV8PEz/JDoJmImOiiXEFYGztlSfKfBtjniDuzQZ7cBjCsIhyeesA8lAryUAoqzp e+3FE8CJ0t5MvOf18Tbesr8tzuoPYQKqfD9oYKrdzcK4Af3vs4otXMDUlFrpYoy1ye13ch 4RSH9iI04cRefW5V5rVTwmky0M+cUKE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177882; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=81VHRIXcx1x0YC/RsTOBX9/YTB66Vtw5nabQAD1eRQA=; b=lUeR1Av3QHuRpUVxW46ObR0OLPDd9z+9irPaHajRMum6X5aAfGf3Fg6amJcHFT6cJ6FIbW P62mK5LRRPthOZDQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769177882; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=81VHRIXcx1x0YC/RsTOBX9/YTB66Vtw5nabQAD1eRQA=; b=bx+/KvtmV8PEz/JDoJmImOiiXEFYGztlSfKfBtjniDuzQZ7cBjCsIhyeesA8lAryUAoqzp e+3FE8CJ0t5MvOf18Tbesr8tzuoPYQKqfD9oYKrdzcK4Af3vs4otXMDUlFrpYoy1ye13ch 4RSH9iI04cRefW5V5rVTwmky0M+cUKE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769177882; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=81VHRIXcx1x0YC/RsTOBX9/YTB66Vtw5nabQAD1eRQA=; b=lUeR1Av3QHuRpUVxW46ObR0OLPDd9z+9irPaHajRMum6X5aAfGf3Fg6amJcHFT6cJ6FIbW P62mK5LRRPthOZDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, ppandit@redhat.com, Prasad Pandit , Li Zhijian Subject: [PATCH v4 25/25] migration/channel: Centralize calling migration_channel_connect_outgoing Date: Fri, 23 Jan 2026 11:16:55 -0300 Message-ID: <20260123141656.6765-26-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260123141656.6765-1-farosas@suse.de> References: <20260123141656.6765-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[fedoraproject.org:email,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_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1769178129720158500 Content-Type: text/plain; charset="utf-8" Make the synchronous calls evident by not hiding the call to migration_channel_connect_outgoing() in the transport code. Have those functions return and call the function at the upper level. This helps with navigation: the transport code returns the ioc, there's no need to look into them when browsing the code. It also allows RDMA in the source side to use the same path as the rest of the transports. While here, document the async calls which are the exception. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/channel.c | 28 ++++++++++++++++++++++++---- migration/exec.c | 8 ++++---- migration/exec.h | 5 ++++- migration/fd.c | 13 +++++++------ migration/fd.h | 7 +++++-- migration/file.c | 18 ++++++++++-------- migration/file.h | 5 +++-- migration/rdma.c | 11 +++++------ migration/rdma.h | 4 ++-- 9 files changed, 64 insertions(+), 35 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 1e4778455d..1e2935f926 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -37,26 +37,40 @@ void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, Error **errp) { + g_autoptr(QIOChannel) ioc =3D NULL; + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { SocketAddress *saddr =3D &addr->u.socket; if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { socket_connect_outgoing(s, saddr, errp); + /* + * async: after the socket is connected, calls + * migration_channel_connect_outgoing() directly. + */ + return; + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { - fd_connect_outgoing(s, saddr->u.fd.str, errp); + ioc =3D fd_connect_outgoing(s, saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_connect_outgoing(s, &addr->u.rdma, errp); + ioc =3D rdma_connect_outgoing(s, &addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_connect_outgoing(s, addr->u.exec.args, errp); + ioc =3D exec_connect_outgoing(s, addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_connect_outgoing(s, &addr->u.file, errp); + ioc =3D file_connect_outgoing(s, &addr->u.file, errp); } else { error_setg(errp, "uri is not a valid migration protocol"); } + + if (ioc) { + migration_channel_connect_outgoing(s, ioc); + } + + return; } =20 void migration_connect_incoming(MigrationAddress *addr, Error **errp) @@ -81,6 +95,12 @@ void migration_connect_incoming(MigrationAddress *addr, = Error **errp) } else { error_setg(errp, "unknown migration protocol"); } + + /* + * async: the above routines all wait for the incoming connection + * and call back to migration_channel_process_incoming() to start + * the migration. + */ } =20 bool migration_has_main_and_multifd_channels(void) diff --git a/migration/exec.c b/migration/exec.c index c3085e803e..a1a7ede3b4 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -40,7 +40,8 @@ const char *exec_get_cmd_path(void) } #endif =20 -void exec_connect_outgoing(MigrationState *s, strList *command, Error **er= rp) +QIOChannel *exec_connect_outgoing(MigrationState *s, strList *command, + Error **errp) { QIOChannel *ioc =3D NULL; g_auto(GStrv) argv =3D strv_from_str_list(command); @@ -50,12 +51,11 @@ void exec_connect_outgoing(MigrationState *s, strList *= command, Error **errp) trace_migration_exec_outgoing(new_command); ioc =3D QIO_CHANNEL(qio_channel_command_new_spawn(args, O_RDWR, errp)); if (!ioc) { - return; + return NULL; } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect_outgoing(s, ioc); - object_unref(OBJECT(ioc)); + return ioc; } =20 static gboolean exec_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/exec.h b/migration/exec.h index e7e8e475ac..3e39270dce 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -20,10 +20,13 @@ #ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H =20 +#include "io/channel.h" + #ifdef WIN32 const char *exec_get_cmd_path(void); #endif void exec_connect_incoming(strList *host_port, Error **errp); =20 -void exec_connect_outgoing(MigrationState *s, strList *host_port, Error **= errp); +QIOChannel *exec_connect_outgoing(MigrationState *s, strList *host_port, + Error **errp); #endif diff --git a/migration/fd.c b/migration/fd.c index b689426ad4..bbf380d1a0 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -49,12 +49,13 @@ static bool migration_fd_valid(int fd) return false; } =20 -void fd_connect_outgoing(MigrationState *s, const char *fdname, Error **er= rp) +QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname, + Error **errp) { - QIOChannel *ioc; + QIOChannel *ioc =3D NULL; int fd =3D monitor_get_fd(monitor_cur(), fdname, errp); if (fd =3D=3D -1) { - return; + goto out; } =20 if (!migration_fd_valid(fd)) { @@ -66,12 +67,12 @@ void fd_connect_outgoing(MigrationState *s, const char = *fdname, Error **errp) ioc =3D qio_channel_new_fd(fd, errp); if (!ioc) { close(fd); - return; + goto out; } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect_outgoing(s, ioc); - object_unref(OBJECT(ioc)); +out: + return ioc; } =20 static gboolean fd_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/fd.h b/migration/fd.h index 7211629270..ce0b751273 100644 --- a/migration/fd.h +++ b/migration/fd.h @@ -16,8 +16,11 @@ =20 #ifndef QEMU_MIGRATION_FD_H #define QEMU_MIGRATION_FD_H + +#include "io/channel.h" + void fd_connect_incoming(const char *fdname, Error **errp); =20 -void fd_connect_outgoing(MigrationState *s, const char *fdname, - Error **errp); +QIOChannel *fd_connect_outgoing(MigrationState *s, const char *fdname, + Error **errp); #endif diff --git a/migration/file.c b/migration/file.c index b7b0fb5194..5618aced49 100644 --- a/migration/file.c +++ b/migration/file.c @@ -93,36 +93,38 @@ out: return ret; } =20 -void file_connect_outgoing(MigrationState *s, - FileMigrationArgs *file_args, Error **errp) +QIOChannel *file_connect_outgoing(MigrationState *s, + FileMigrationArgs *file_args, Error **er= rp) { - g_autoptr(QIOChannelFile) fioc =3D NULL; + QIOChannelFile *fioc =3D NULL; g_autofree char *filename =3D g_strdup(file_args->filename); uint64_t offset =3D file_args->offset; - QIOChannel *ioc; + QIOChannel *ioc =3D NULL; =20 trace_migration_file_outgoing(filename); =20 fioc =3D qio_channel_file_new_path(filename, O_CREAT | O_WRONLY, 0600,= errp); if (!fioc) { - return; + goto out; } =20 if (ftruncate(fioc->fd, offset)) { error_setg_errno(errp, errno, "failed to truncate migration file to offset %" P= RIx64, offset); - return; + goto out; } =20 outgoing_args.fname =3D g_strdup(filename); =20 ioc =3D QIO_CHANNEL(fioc); if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) { - return; + ioc =3D NULL; + goto out; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect_outgoing(s, ioc); +out: + return ioc; } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/file.h b/migration/file.h index 9b1e874bb7..5936c64fea 100644 --- a/migration/file.h +++ b/migration/file.h @@ -9,14 +9,15 @@ #define QEMU_MIGRATION_FILE_H =20 #include "qapi/qapi-types-migration.h" +#include "io/channel.h" #include "io/task.h" #include "channel.h" #include "multifd.h" =20 void file_connect_incoming(FileMigrationArgs *file_args, Error **errp); =20 -void file_connect_outgoing(MigrationState *s, - FileMigrationArgs *file_args, Error **errp); +QIOChannel *file_connect_outgoing(MigrationState *s, + FileMigrationArgs *file_args, Error **er= rp); int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp); void file_cleanup_outgoing_migration(void); bool file_send_channel_create(gpointer opaque, Error **errp); diff --git a/migration/rdma.c b/migration/rdma.c index e628a20aec..55ab85650a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3933,8 +3933,8 @@ err: g_free(rdma); } =20 -void rdma_connect_outgoing(void *opaque, - InetSocketAddress *host_port, Error **errp) +QIOChannel *rdma_connect_outgoing(void *opaque, + InetSocketAddress *host_port, Error **er= rp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; @@ -3944,7 +3944,7 @@ void rdma_connect_outgoing(void *opaque, /* Avoid ram_block_discard_disable(), cannot change during migration. = */ if (ram_block_discard_is_required()) { error_setg(errp, "RDMA: cannot disable RAM discard"); - return; + return NULL; } =20 rdma =3D qemu_rdma_data_init(host_port, errp); @@ -3994,12 +3994,11 @@ void rdma_connect_outgoing(void *opaque, trace_rdma_connect_outgoing_after_rdma_connect(); =20 s->rdma_migration =3D true; - migration_outgoing_setup(rdma_new_output(rdma)); - migration_start_outgoing(s); - return; + return rdma_new_output(rdma); return_path_err: qemu_rdma_cleanup(rdma); err: g_free(rdma); g_free(rdma_return_path); + return NULL; } diff --git a/migration/rdma.h b/migration/rdma.h index 170c25cf44..8a6515f130 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,8 +21,8 @@ =20 #include "system/memory.h" =20 -void rdma_connect_outgoing(void *opaque, InetSocketAddress *host_port, - Error **errp); +QIOChannel *rdma_connect_outgoing(void *opaque, InetSocketAddress *host_po= rt, + Error **errp); =20 void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 --=20 2.51.0