From nobody Sun Feb 8 20:23:39 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=1767962473; cv=none; d=zohomail.com; s=zohoarc; b=LrhQGKmHhxYy8EfONAWg4QHiGXCRhHfOpfXCmfjlepV8youVGDHJBENjy8bNb95aNnYuByYS9GHAVWzGnXN7YAwSeFok7KFd0cggPeUsUxcr8SYYJ+RvpaeEoAYBCytGkp2F6ohSz0SzCIg/MuIjFzFuuD/ACx3aNdxLHREUUmg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962473; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=dKLPrczffiYFXD4C2rdc6RdraWyvt9epaXzqaYebnwqrDgd8zT9PhG259zQ6ustjy9HJAqRr12/XQtc57sWy2WYAzqrE3EnrraEyIwBXVr1lATJxI2LsxXsVw/c3OUvQzvVX133m1Uw8RhDif5wN0ohX/BgC7F8FcqqbYu33knY= 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 1767962473010336.3317554489395; Fri, 9 Jan 2026 04:41:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBnT-0003Jp-BY; Fri, 09 Jan 2026 07:40:56 -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 1veBnQ-0003Iz-UX for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:40:53 -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 1veBnP-0007EA-AS for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:40:52 -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 A38205BD06; Fri, 9 Jan 2026 12:40: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 5460C3EA63; Fri, 9 Jan 2026 12:40:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QJQNBVD3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:40:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=UwwyqNwdvyjyqaqsh55uW4J75Tz5zW4A6ggioz7dh/FV1DgnkfREl0JLSHuV8x11YoHbPJ g+ow+IJX0A2GfjWFrsIbCYcuLJNM+OFpyZ07EnTo/OXIP+kr5wfVy7U5c6liqDR4ahRi4J WmTOuDtuMieg9/kpn14lWcd8nMtkUzM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=dQS8UKWrcZXA2dc6329ztZ/sUZIcbNq1CN2rlV5KeI3J7eonsPj/0luQN3O8VKxAFlqGmF fo4VdsTupkAk5KAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=UwwyqNwd; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=dQS8UKWr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=UwwyqNwdvyjyqaqsh55uW4J75Tz5zW4A6ggioz7dh/FV1DgnkfREl0JLSHuV8x11YoHbPJ g+ow+IJX0A2GfjWFrsIbCYcuLJNM+OFpyZ07EnTo/OXIP+kr5wfVy7U5c6liqDR4ahRi4J WmTOuDtuMieg9/kpn14lWcd8nMtkUzM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MsJGFF8VOKFlAUQA5zQYG147+Oe5oJOK9GND8kTEtS0=; b=dQS8UKWrcZXA2dc6329ztZ/sUZIcbNq1CN2rlV5KeI3J7eonsPj/0luQN3O8VKxAFlqGmF fo4VdsTupkAk5KAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 01/25] migration: Remove redundant state change Date: Fri, 9 Jan 2026 09:40:17 -0300 Message-ID: <20260109124043.25019-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: A38205BD06 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962475540158500 Content-Type: text/plain; charset="utf-8" If local_err is set, migration_connect_error_propagate() will be called and that function already has a state transtion from SETUP to FAILED. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9d1bf5d276..c45393f40e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2326,8 +2326,6 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { error_setg(&local_err, "uri is not a valid migration protocol"); - migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); } =20 if (local_err) { --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962478; cv=none; d=zohomail.com; s=zohoarc; b=l/K71USA4iQGT3gEOV1hWkJyxhjWokzJPufLmzlGpoX1C/fCsLBgo3fgC57gb3Q7agvBccWoOy7aqYG1cxSsWIMdXlsL0LQcNCb68FYxyOLHxrSNXzb0zxs2oNcXIRySQiiCII0fRJZ/O+dL8uEL9B/Kz8xE/NeWyY1idGRRz54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962478; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=LWz885pf7aVZADdsOzQuIyZYVUI5x+HA/fasCsEadpU3/UZkxEJHqgeXPbksVn+X3vlBLGgWeSceuQpAH6G7PBMEJHOqk0zXqNkYqxnLiiraeIsIbcjL2XcuEoscMbez0k2vWOnR9jbPMMCsjXTlnZxLdcHWUS4YMNwd7hsqG44= 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 176796247817660.52693909251229; Fri, 9 Jan 2026 04:41:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBnY-0003Kr-Gr; Fri, 09 Jan 2026 07:41:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnU-0003KJ-Kr for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:40:58 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBnT-0007ET-3z for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:40:56 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 82894337E0; Fri, 9 Jan 2026 12:40: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 336A43EA63; Fri, 9 Jan 2026 12:40: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 8CNZOFH3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:40:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962451; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=TZROB4Ksdd8ZwBz0n/VpHeRM7SWBDJhiGyUxH2XW8k4YQ8QxIGduJzTGB4v9DFi3FabJS0 GmClqbd4kwI/EWcPpKu64RDopni10MfYyF8t7siQH+US/TIc9H7Vd5iGKmnxADZZtazRQ4 QXUCz8wFQrzJ0F7LYB3hwDNR+UZnmy8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962451; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=T0BKyC2TG2i5dZMVOsQF+EU1kiWnKVSdLvMnZ+M4IQslYPvpd4NqARW8vSKvmSiJ9Er7Qv oDx881uQPEw4G/DA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962451; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=TZROB4Ksdd8ZwBz0n/VpHeRM7SWBDJhiGyUxH2XW8k4YQ8QxIGduJzTGB4v9DFi3FabJS0 GmClqbd4kwI/EWcPpKu64RDopni10MfYyF8t7siQH+US/TIc9H7Vd5iGKmnxADZZtazRQ4 QXUCz8wFQrzJ0F7LYB3hwDNR+UZnmy8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962451; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TL+uCIHm4IMLJvAke8wrvDvZqP++O5z0LD5bYx6kqZs=; b=T0BKyC2TG2i5dZMVOsQF+EU1kiWnKVSdLvMnZ+M4IQslYPvpd4NqARW8vSKvmSiJ9Er7Qv oDx881uQPEw4G/DA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 02/25] migration: Fix state change at migration_channel_process_incoming Date: Fri, 9 Jan 2026 09:40:18 -0300 Message-ID: <20260109124043.25019-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962479376158500 Content-Type: text/plain; charset="utf-8" When the incoming migration fails during the channel connection phase, the state transition to FAILED is currently being done in the MigrationState->state, but the MigrationIncomingState->state is the one that should be used. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 Feb 8 20:23:39 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=1767962800; cv=none; d=zohomail.com; s=zohoarc; b=FoUP1UpRDt8tyKXnqgpeZZ4hlLNKAWa3OKHiYm+Z5CiJ0lFAJaTYRQVwaexlq8OXfKo7moyr52/ib8Xebob9B3k37lTlyuEl4lVf35MqgtjafgnaPtfq0LwYOsvMtkHkuCcKgOQ/nrSV0osnDnucu7fXFHdn67ofv6z4z3tXRbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962800; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=LxEzBFEMWa21oFnb57dv8DrnhzgF+YFSIIq8NrBr5P7B/lAX8alCcrgf6vEEj51UWxZNhlJ+SZhLJKwWJkngdQbrcKHiMNR5qJFyEUmj5VIAV+izUyNxOu7WFphttUalQU1+z18xqkgBrWt6DY4QPQUKKnlPjH8G3L519kRHBO0= 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 1767962800730429.13545832315197; Fri, 9 Jan 2026 04:46:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBnZ-0003LL-56; Fri, 09 Jan 2026 07:41:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnW-0003Kg-Me for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:40: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 1veBnU-0007EX-CO for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:40:57 -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 7033E5BCE7; Fri, 9 Jan 2026 12:40:53 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 152053EA63; Fri, 9 Jan 2026 12:40:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0At6MVP3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:40:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=TtxJCBB9SUfW3/+Wx2C4bpV/Tz3w2x5Qm80c30uZ4dJQU3NQZQS6/lk/3Rds5EM64TZDnA Ngs0NqRfxyOgvSfbr2KNaY+YPLeSdQ5odYSwCbnlk911N7p9kbGTjjKqWmVDfFlrXxcKtf l5hEegBcQTVBBEf4nYiZGMn5n9VCaoA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=bLqXckmvQ99Nw5ZwUul3oxXObhTJv2k+KNZdIi7Eo8swR329uua7z8lCXEPmoq+ST2zfbl 2+Ne9GrwAahQGNCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=TtxJCBB9SUfW3/+Wx2C4bpV/Tz3w2x5Qm80c30uZ4dJQU3NQZQS6/lk/3Rds5EM64TZDnA Ngs0NqRfxyOgvSfbr2KNaY+YPLeSdQ5odYSwCbnlk911N7p9kbGTjjKqWmVDfFlrXxcKtf l5hEegBcQTVBBEf4nYiZGMn5n9VCaoA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ouegjPaIXPNlZBPjPZQ3F6sYL+t5Zt0l/1IkKb+791Y=; b=bLqXckmvQ99Nw5ZwUul3oxXObhTJv2k+KNZdIi7Eo8swR329uua7z8lCXEPmoq+ST2zfbl 2+Ne9GrwAahQGNCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 03/25] migration/tls: Remove unused parameter Date: Fri, 9 Jan 2026 09:40:19 -0300 Message-ID: <20260109124043.25019-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962802743158500 Content-Type: text/plain; charset="utf-8" MigrationState is not used at migration_tls_channel_process_incoming(). The last usage was removed by commit 3f461a0c0b ("migration: Drop unused parameter for migration_tls_get_creds()") Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 Feb 8 20:23:39 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=1767962774; cv=none; d=zohomail.com; s=zohoarc; b=ZiUhWCZ+WtbS1qItlTozUaKFhfNYotBYpED7oj2y7wqDPnq780moZKgaBJx4d+pcNTxDiHdD+7xN5/o4Zl398qiYmmYj4KSP/nAXcmULvDL90tn/e/xr7jcicyfnGh1jrk/dvQz30WADOi15nFTHlm6ZtWfEUAFHmyA5fgBqNvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962774; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=VqOiqtjfQ/pY5Mo2Slram92IzimimjNdOiV26Pia+6unvKsupiacj8DnEtA5wn7PU6Fuw0qJzm16nz8AUZ1v2ZBeqny3+xvEWD43hgPbxy2X7bt7Wdj1qPfkfi+ftskoWFMEwUxZcauRBpVTSXPRjCaWaYB0HVGufM8/Lt/KeQM= 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 1767962774279253.11290924530954; Fri, 9 Jan 2026 04:46:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBnf-0003Mf-7f; Fri, 09 Jan 2026 07:41:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnd-0003MB-C2 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:05 -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 1veBnb-0007F2-1i for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:05 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CB8CD5BD06; Fri, 9 Jan 2026 12:40:55 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2AAFD3EA63; Fri, 9 Jan 2026 12:40:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0KtrNlX3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:40:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=GWTSY9b3VL8xFvHF70HXLO7wTQuVS6oe98hYrqnnMgQxCIXzKms+UugoXD1H1YLLsZrUrM 1adVXqC75XjXk1zvgwH7rIOjgXHqOQ/szneRSd4xdiqSGvZWdeQ3UKfvPWm3VY4QsPsoQ2 bsbWWT1ntV6p5ddW82wu0/VGQZf198A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=3vpthjdP+hI7xXKFudiRZI3BuqSBbfujDoSe66HEM8ZJgkAZKJUBCvRiyfwnxIwKMXlfwS wjZAArKpg4ECWZAw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GWTSY9b3; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=3vpthjdP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=GWTSY9b3VL8xFvHF70HXLO7wTQuVS6oe98hYrqnnMgQxCIXzKms+UugoXD1H1YLLsZrUrM 1adVXqC75XjXk1zvgwH7rIOjgXHqOQ/szneRSd4xdiqSGvZWdeQ3UKfvPWm3VY4QsPsoQ2 bsbWWT1ntV6p5ddW82wu0/VGQZf198A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wgz9YTAwzwBE/+gB4R5d3V4PEvGgqQ4qvQjF6rEGz3M=; b=3vpthjdP+hI7xXKFudiRZI3BuqSBbfujDoSe66HEM8ZJgkAZKJUBCvRiyfwnxIwKMXlfwS wjZAArKpg4ECWZAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 04/25] migration: Cleanup TLS handshake hostname passing Date: Fri, 9 Jan 2026 09:40:20 -0300 Message-ID: <20260109124043.25019-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: CB8CD5BD06 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962774757158500 Content-Type: text/plain; charset="utf-8" The TLS hostname is doing a tour around the world just to be cached into s->hostname. We're already abusing MigrationState by doing that, so incorporate the s->hostname into migration_tls_hostname() and stop passing the string around. The old route was roughly: -transport code (socket.c, fd.c, etc): if (SOCKET_ADDRESS_TYPE_INET) hostname =3D saddr->u.inet.host else hostname =3D NULL migration_channel_connect(..., hostname) s->hostname =3D hostname; migration_tls_client_create(..., hostname) if (migrate_tls_hostname()) qio_channel_tls_new_client(migrate_tls_hostname()) else qio_channel_tls_new_client(hostname) -postcopy_preempt_setup: postcopy_preempt_send_channel_new migration_tls_client_create(..., s->hostname) New route is: -socket.c only: if SOCKET_ADDRESS_TYPE_INET s->hostname =3D saddr->u.inet.host migration_channel_connect() migration_tls_client_create() qio_channel_tls_new_client(migrate_tls_hostname()) -postcopy_preempt_setup: postcopy_preempt_send_channel_new migration_tls_client_create() qio_channel_tls_new_client(migrate_tls_hostname()) Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/channel.c | 6 ++---- migration/channel.h | 1 - migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/multifd.c | 9 +++------ migration/options.c | 5 +++++ migration/postcopy-ram.c | 2 +- migration/socket.c | 9 +++------ migration/tls.c | 17 ++++------------- migration/tls.h | 2 -- migration/trace-events | 10 +++++----- 12 files changed, 26 insertions(+), 41 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index b4ab676048..ba14f66d85 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,20 +60,18 @@ void migration_channel_process_incoming(QIOChannel *ioc) * * @s: Current migration state * @ioc: Channel to which we are connecting - * @hostname: Where we want to connect * @error: Error indicating failure to connect, free'd here */ void migration_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error *error) { trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), hostname, error); + ioc, object_get_typename(OBJECT(ioc)), error); =20 if (!error) { if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc, hostname, &error); + migration_tls_channel_connect(s, ioc, &error); =20 if (!error) { /* tls_channel_connect will call back to this diff --git a/migration/channel.h b/migration/channel.h index 5bdb8208a7..2215091323 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -22,7 +22,6 @@ void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error *error_in); =20 int migration_channel_read_peek(QIOChannel *ioc, diff --git a/migration/exec.c b/migration/exec.c index 20e6cccf8c..78fe0fff13 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index 9bf9be6acb..c956b260a4 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index bb8031e3c7..c490f2b219 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc, NULL, NULL); + migration_channel_connect(s, ioc, NULL); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/multifd.c b/migration/multifd.c index bf6da85af8..3fb1a07ba9 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -814,12 +814,10 @@ static bool multifd_tls_channel_connect(MultiFDSendPa= rams *p, QIOChannel *ioc, Error **errp) { - MigrationState *s =3D migrate_get_current(); - const char *hostname =3D s->hostname; MultiFDTLSThreadArgs *args; QIOChannelTLS *tioc; =20 - tioc =3D migration_tls_client_create(ioc, hostname, errp); + tioc =3D migration_tls_client_create(ioc, errp); if (!tioc) { return false; } @@ -829,7 +827,7 @@ static bool multifd_tls_channel_connect(MultiFDSendPara= ms *p, * created TLS channel, which has already taken a reference. */ object_unref(OBJECT(ioc)); - trace_multifd_tls_outgoing_handshake_start(ioc, tioc, hostname); + trace_multifd_tls_outgoing_handshake_start(ioc, tioc); qio_channel_set_name(QIO_CHANNEL(tioc), "multifd-tls-outgoing"); =20 args =3D g_new0(MultiFDTLSThreadArgs, 1); @@ -876,8 +874,7 @@ static void multifd_new_send_channel_async(QIOTask *tas= k, gpointer opaque) goto out; } =20 - trace_multifd_set_outgoing_channel(ioc, object_get_typename(OBJECT(ioc= )), - migrate_get_current()->hostname); + trace_multifd_set_outgoing_channel(ioc, object_get_typename(OBJECT(ioc= ))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { ret =3D multifd_tls_channel_connect(p, ioc, &local_err); diff --git a/migration/options.c b/migration/options.c index 9a5a39c886..881034c289 100644 --- a/migration/options.c +++ b/migration/options.c @@ -956,6 +956,11 @@ const char *migrate_tls_hostname(void) return s->parameters.tls_hostname->u.s; } =20 + /* hostname saved from a previously connected channel */ + if (s->hostname) { + return s->hostname; + } + return NULL; } =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 98a98138be..7afb42bd27 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1966,7 +1966,7 @@ postcopy_preempt_send_channel_new(QIOTask *task, gpoi= nter opaque) } =20 if (migrate_channel_requires_tls_upgrade(ioc)) { - tioc =3D migration_tls_client_create(ioc, s->hostname, &local_err); + tioc =3D migration_tls_client_create(ioc, &local_err); if (!tioc) { goto out; } diff --git a/migration/socket.c b/migration/socket.c index 9e379bf56f..426f363b99 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -44,7 +44,6 @@ void socket_send_channel_create(QIOTaskFunc f, void *data) =20 struct SocketConnectData { MigrationState *s; - char *hostname; }; =20 static void socket_connect_data_free(void *opaque) @@ -53,7 +52,6 @@ static void socket_connect_data_free(void *opaque) if (!data) { return; } - g_free(data->hostname); g_free(data); } =20 @@ -69,7 +67,7 @@ static void socket_outgoing_migration(QIOTask *task, goto out; } =20 - trace_migration_socket_outgoing_connected(data->hostname); + trace_migration_socket_outgoing_connected(); =20 if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { @@ -77,7 +75,7 @@ static void socket_outgoing_migration(QIOTask *task, } =20 out: - migration_channel_connect(data->s, sioc, data->hostname, err); + migration_channel_connect(data->s, sioc, err); object_unref(OBJECT(sioc)); } =20 @@ -96,7 +94,7 @@ void socket_start_outgoing_migration(MigrationState *s, outgoing_args.saddr =3D addr; =20 if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET) { - data->hostname =3D g_strdup(saddr->u.inet.host); + s->hostname =3D g_strdup(saddr->u.inet.host); } =20 qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing"); @@ -180,4 +178,3 @@ void socket_start_incoming_migration(SocketAddress *sad= dr, qapi_free_SocketAddress(address); } } - diff --git a/migration/tls.c b/migration/tls.c index 1df31bdcbb..82f58cbc78 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -112,12 +112,11 @@ static void migration_tls_outgoing_handshake(QIOTask = *task, } else { trace_migration_tls_outgoing_handshake_complete(); } - migration_channel_connect(s, ioc, NULL, err); + migration_channel_connect(s, ioc, err); object_unref(OBJECT(ioc)); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, - const char *hostname, Error **errp) { QCryptoTLSCreds *creds; @@ -127,29 +126,21 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel= *ioc, return NULL; } =20 - const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname) { - hostname =3D tls_hostname; - } - - return qio_channel_tls_new_client(ioc, creds, hostname, errp); + return qio_channel_tls_new_client(ioc, creds, migrate_tls_hostname(), = errp); } =20 void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error **errp) { QIOChannelTLS *tioc; =20 - tioc =3D migration_tls_client_create(ioc, hostname, errp); + tioc =3D migration_tls_client_create(ioc, errp); if (!tioc) { return; } =20 - /* Save hostname into MigrationState for handshake */ - s->hostname =3D g_strdup(hostname); - trace_migration_tls_outgoing_handshake_start(hostname); + trace_migration_tls_outgoing_handshake_start(); qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing"); =20 if (migrate_postcopy_ram() || migrate_return_path()) { diff --git a/migration/tls.h b/migration/tls.h index 7607cfe803..7cd9c76013 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -27,12 +27,10 @@ void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp); =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, - const char *hostname, Error **errp); =20 void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, - const char *hostname, Error **errp); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ diff --git a/migration/trace-events b/migration/trace-events index bf11b62b17..da8f909cac 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -149,10 +149,10 @@ multifd_send_sync_main_wait(uint8_t id) "channel %u" multifd_send_terminate_threads(void) "" multifd_send_thread_end(uint8_t id, uint64_t packets) "channel %u packets = %" PRIu64 multifd_send_thread_start(uint8_t id) "%u" -multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *ho= stname) "ioc=3D%p tioc=3D%p hostname=3D%s" +multifd_tls_outgoing_handshake_start(void *ioc, void *tioc) "ioc=3D%p tioc= =3D%p" multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=3D%p= err=3D%s" multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=3D%p" -multifd_set_outgoing_channel(void *ioc, const char *ioctype, const char *h= ostname) "ioc=3D%p ioctype=3D%s hostname=3D%s" +multifd_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p io= ctype=3D%s" =20 # migration.c migrate_set_state(const char *new_state) "new state %s" @@ -204,7 +204,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype, const char = *hostname, void *err) "ioc=3D%p ioctype=3D%s hostname=3D%s err=3D%p" +migration_set_outgoing_channel(void *ioc, const char *ioctype, void *err) = "ioc=3D%p ioctype=3D%s err=3D%p" =20 # global_state.c migrate_state_too_big(void) "" @@ -328,11 +328,11 @@ migration_file_incoming(const char *filename) "filena= me=3D%s" =20 # socket.c migration_socket_incoming_accepted(void) "" -migration_socket_outgoing_connected(const char *hostname) "hostname=3D%s" +migration_socket_outgoing_connected(void) "" migration_socket_outgoing_error(const char *err) "error=3D%s" =20 # tls.c -migration_tls_outgoing_handshake_start(const char *hostname) "hostname=3D%= s" +migration_tls_outgoing_handshake_start(void) "" migration_tls_outgoing_handshake_error(const char *err) "err=3D%s" migration_tls_outgoing_handshake_complete(void) "" migration_tls_incoming_handshake_start(void) "" --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962574; cv=none; d=zohomail.com; s=zohoarc; b=R41SOHVEAepfhbVge52MHEfpYz/SG7HUUz5nik8yESsjniodXEc7KX3pjDtHtcLv9DRjRixd/Ok0ra/GQSEmYwcI8LeFtqgxf1C6LDx+GAD0IeQpjhc8vcAIreYzvyCeKT8sfkp5xW/F3n6KaXVf+Zf7VPbZVndIAEHBTywymEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962574; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=NVlsLraZtSoVoBjSqIW+3+wlJIeea/FQv4has/7dXfHOR5vGBcrBxUKRvxnWVnxWrFoYwJCzRdNkPmdC0mPFbcFJct3nY9iMEuzTRrvxa6AEz7obS6iZKr+CJaTrQsPNzb6UdOztba4S2yYlnpjb4sTpNND8DOhBLwxktKbrdh8= 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 176796257464181.51730395252832; Fri, 9 Jan 2026 04:42:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBns-0003Wk-Lh; Fri, 09 Jan 2026 07:41:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnk-0003Ok-9P for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:13 -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 1veBnh-0007Fz-VZ for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:11 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EE9C95BE9E; Fri, 9 Jan 2026 12:40: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 66F973EA63; Fri, 9 Jan 2026 12:40:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yE7pCVj3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:40:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962458; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=j1kQ5RMr0YeYCZVWR3Kip33Z0X/V1b2opF6U+oqo//cQ6Yzc3Vyjs3B5vO5uS9XVZLS+fi sy7NA4wrKUMSUollq06EkJgeVVnv8qYioXiubsPlXjva8qto0DSBIYqZugA2K7LD2qAqXS XJ2+QhPjysZyJXTgkRhf/wNyDWRIyhk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962458; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=0QQpLIacZ5A6ZKfv/i0vqX6ecchI5dPqO94KVISXGGvN4knNzBigIlrOAAjfGkTe65Kl8e Mq4kctburVBaXCCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962457; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=Oo0sr2+UUGwKZpAP1u8k2ykviBgK9gNyU8p55zhWAc5gA9ZSOAo6T+XaPYzNqOstvFW+1U OTSC07O/pqOrKWXRWkTAW6wm7VjUZZUGKriwpDER9DXDQ0yDuJktXru5eAGvAS77x/dFT/ UB1Kben1ZttB8VvHfa98Igb7qmxlJw0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962457; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mVHzD7zmFjhne5W/RXbNpwoFhZs/1TzOjF6NKcxgmNE=; b=ykK3NtgTBHMOTOpP9pWrQ1a80h1BttGhaw23MkdhPy/ii3ywXjKXGFp6gH5Wzr41irInBc KlAg7lkK9rB1kyCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 05/25] migration: Move postcopy_try_recover into migration_incoming_process Date: Fri, 9 Jan 2026 09:40:21 -0300 Message-ID: <20260109124043.25019-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1767962575666158500 Content-Type: text/plain; charset="utf-8" The postcopy_try_recover() call doesn't need to be duplicated, move it into migration_incoming_process(). This removes code from migration_fd_process_incoming() so it can be removed in the near future. (the diff is a bit strange because migration_incoming_process() was moved after postcopy_try_recover()) Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c45393f40e..4af5baad59 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -943,12 +943,6 @@ static void migration_incoming_setup(QEMUFile *f) qemu_file_set_blocking(f, false, &error_abort); } =20 -void migration_incoming_process(void) -{ - Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); - qemu_coroutine_enter(co); -} - /* Returns true if recovered from a paused migration, otherwise false */ static bool postcopy_try_recover(void) { @@ -982,12 +976,19 @@ static bool postcopy_try_recover(void) return false; } =20 +void migration_incoming_process(void) +{ + if (postcopy_try_recover()) { + return; + } + + Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); + qemu_coroutine_enter(co); +} + void migration_fd_process_incoming(QEMUFile *f) { migration_incoming_setup(f); - if (postcopy_try_recover()) { - return; - } migration_incoming_process(); } =20 @@ -1087,10 +1088,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc,= Error **errp) } =20 if (migration_has_main_and_multifd_channels()) { - /* If it's a recovery, we're done */ - if (postcopy_try_recover()) { - return; - } migration_incoming_process(); } } --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962519; cv=none; d=zohomail.com; s=zohoarc; b=MV/ne68kYsJl9oG9pqLx+fqAVH8QQ3UtccWx/FXTG2+4CuiUfgjFSk9HCmTgAkFE00Pzhu9f8yzq4yStmVIdC2CUu+BJcMzSqZDyBwr/jl+UjSpSdLxt7qEsBCPwQlpfwXlcHqmlqmi1B3QU3p0fmynmlakOacygi2txmBD0HUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962519; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=FfXbBzcaD19dxcmHTCKeuBWj6rkk85hmRREvFvn/HRnwynYC0wFG2+Nmznme2jH32mH/GP3vtt24MeKuQJnR/x4FfAl0DnPEoHM8aFcAToQUsgwOQ5nDU0uu78kBkZnbe8598U5z7T30+PrGGgSCZV26OsS1SYA8P6xgniSKnvI= 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 1767962519744473.3769611426043; Fri, 9 Jan 2026 04:41:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBne-0003MO-Mo; Fri, 09 Jan 2026 07:41: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 1veBnc-0003M3-Ss for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:05 -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 1veBnb-0007F4-1o for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41: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-out1.suse.de (Postfix) with ESMTPS id 4D903337BA; Fri, 9 Jan 2026 12:41:00 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 76DE13EA63; Fri, 9 Jan 2026 12:40:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aEfADVr3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:40:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962461; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=IvIBL2wDnUH1ZVgfwWXZUGQJOVXIdw/nto2uBxG3uCXgljAkzxzMgwkrdUuE5E+l6i2Pwp KZp+R4zQViBSwNd4gPmcD/lHZPMvBUjP+P56oHicgcO7N1gSuStPrTQsTFrsZYysmnIfLq 1qW1lFlwXY5R6ao7Um7tTCYDHJMej+w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962461; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=FACjYZjbUDKyQOQzEFLmEJMP0EOTsbv/zf+sgodlmoS8Hu/3teU3FES3yH8o+NeXsQA2b+ W1+kM6R/RiPXVIBQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=g+Ifxvue; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UmvYDI6M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962460; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=g+Ifxvuemk43JK+GstAEJZZsFHUrBEj7M02RrqdW806YV2UvR/jcnTeqFH2kjghMh9ib2E 2werIM6DlIPRTTQDFLyLsjWORGwY4zPzRdFY+VhJTzxV1H0yJmnS3Rqrr0Xxbj6V9WKnY8 ZbW4osON5nLUwpLEISxMid5C90h/E14= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962460; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFGOeHScnw8iEsCunXW8i4HluIN89SgF28fJkpUUecc=; b=UmvYDI6MW1O5WblOPx4Kty745lkSwbHsK0fAKYYmA1lfTnQ9zP+1dQ6mSTSt2zrDTwj4/I TQFpRc7At8OA9OBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Mark Kanda , Ben Chaney Subject: [PATCH v3 06/25] migration: Use migrate_mode() to query for cpr-transfer Date: Fri, 9 Jan 2026 09:40:22 -0300 Message-ID: <20260109124043.25019-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; 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]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 4D903337BA 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1767962521499158500 Content-Type: text/plain; charset="utf-8" cpr_set_incoming_mode() is only called on the target side, so migrate_mode() on the source side is the same as s->parameters.mode. Use the function to reduce explicit access to s->parameters, we have options.c for that. Cc: Mark Kanda Cc: Ben Chaney Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/cpr-exec.c | 2 +- migration/migration.c | 27 +++++++++++++-------------- migration/migration.h | 5 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index da287d8031..e315a30f92 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -164,7 +164,7 @@ static void cpr_exec_cb(void *opaque) err =3D NULL; =20 /* Note, we can go from state COMPLETED to FAILED */ - migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); =20 if (!migration_block_activate(&err)) { /* error was already reported */ diff --git a/migration/migration.c b/migration/migration.c index 4af5baad59..388e0be5a2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1534,7 +1534,7 @@ static void migration_cleanup(MigrationState *s) } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; - migration_call_notifiers(s, type, NULL); + migration_call_notifiers(type, NULL); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 @@ -1696,10 +1696,9 @@ void migration_remove_notifier(NotifierWithReturn *n= otify) } } =20 -int migration_call_notifiers(MigrationState *s, MigrationEventType type, - Error **errp) +int migration_call_notifiers(MigrationEventType type, Error **errp) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D migrate_mode(); MigrationEvent e; NotifierWithReturn *notifier; GSList *elem, *next; @@ -1780,9 +1779,9 @@ bool migration_thread_is_self(void) return qemu_thread_is_self(&s->thread); } =20 -bool migrate_mode_is_cpr(MigrationState *s) +bool migrate_mode_is_cpr(void) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D migrate_mode(); return mode =3D=3D MIG_MODE_CPR_REBOOT || mode =3D=3D MIG_MODE_CPR_TRANSFER || mode =3D=3D MIG_MODE_CPR_EXEC; @@ -2136,7 +2135,7 @@ static bool migrate_prepare(MigrationState *s, bool r= esume, Error **errp) } } =20 - if (migrate_mode_is_cpr(s)) { + if (migrate_mode_is_cpr()) { const char *conflict =3D NULL; =20 if (migrate_postcopy()) { @@ -2252,7 +2251,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - if (s->parameters.mode =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { error_setg(errp, "missing 'cpr' migration channel"); return; } @@ -2277,7 +2276,7 @@ void qmp_migrate(const char *uri, bool has_channels, * in which case the target will not listen for the incoming migration * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ - if (s->parameters.mode =3D=3D MIG_MODE_CPR_TRANSFER) { + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, QAPI_CLONE(MigrationAddress, addr)); =20 @@ -2852,7 +2851,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) * at the transition to postcopy and after the device state; in partic= ular * spice needs to trigger a transition now */ - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_DONE, NULL); =20 migration_downtime_end(ms); =20 @@ -2901,7 +2900,7 @@ fail: migrate_set_state(&ms->state, ms->state, MIGRATION_STATUS_FAILED); } migration_block_activate(NULL); - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_FAILED, NULL); + migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); bql_unlock(); return -1; } @@ -3003,7 +3002,7 @@ static int migration_completion_precopy(MigrationStat= e *s) =20 bql_lock(); =20 - if (!migrate_mode_is_cpr(s)) { + if (!migrate_mode_is_cpr()) { ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { goto out_unlock; @@ -4049,7 +4048,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) rate_limit =3D migrate_max_bandwidth(); =20 /* Notify before starting migration thread */ - if (migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP, &local_er= r)) { + if (migration_call_notifiers(MIG_EVENT_PRECOPY_SETUP, &local_err))= { goto fail; } } @@ -4085,7 +4084,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) return; } =20 - if (migrate_mode_is_cpr(s)) { + if (migrate_mode_is_cpr()) { ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { error_setg(&local_err, "migration_stop_vm failed, error %d", -= ret); diff --git a/migration/migration.h b/migration/migration.h index ccc4e536a5..8b55d4741a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -538,8 +538,7 @@ bool migrate_has_error(MigrationState *s); =20 void migration_connect(MigrationState *s, Error *error_in); =20 -int migration_call_notifiers(MigrationState *s, MigrationEventType type, - Error **errp); +int migration_call_notifiers(MigrationEventType type, Error **errp); =20 int migrate_init(MigrationState *s, Error **errp); bool migration_is_blocked(Error **errp); @@ -548,7 +547,7 @@ bool migration_in_postcopy(void); bool migration_postcopy_is_alive(MigrationStatus state); MigrationState *migrate_get_current(void); bool migration_has_failed(MigrationState *); -bool migrate_mode_is_cpr(MigrationState *); +bool migrate_mode_is_cpr(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962593; cv=none; d=zohomail.com; s=zohoarc; b=VQzbsZyKMbrDMQYRZujpBvcTBInLGY0Wp1f0Cn7x62BQrlI2iWkbmA7GCz7TR8BCFAqaOM4PgipqkuX+2H2MkTUi88NfAexKBPs4mg6DStM8R7pU+z1Txo+922iH3HQ8r5yjw4sv8LbSCzlQ+JRjToOh388aGikczeCy/he0W38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962593; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=Pa7oVxh3Wz/goSA9Su8v4z7u1Lh0Q1FIIRGSE8RR7jjbAMUxQrcoT7+SbfaZKG/pqD1PtDVtf4ModOrxEys6hSBy6Mb3ujiOaO6rnjxXj+YoGDDIVN+6hnaTZNOat+91SfMXwojJEm6gW8/k0/e/nIarMB+vLX/64st8xsf96ig= 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 176796259303037.68712234635177; Fri, 9 Jan 2026 04:43:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBnl-0003Oo-TM; Fri, 09 Jan 2026 07:41:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBni-0003N7-L8 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:10 -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 1veBnh-0007Ft-7O for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:10 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 277F0337E0; Fri, 9 Jan 2026 12:41: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 CE1FB3EA65; Fri, 9 Jan 2026 12:41: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 WPbFIlz3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=hXNzHYXfLT1PcWt5gCkgZZv2Ih4jPWMw0El0R+YaRP5NseRJi4IszAqXtEtK5SqZyyymOW +YRMHh51JDT0JSolxaWHJjSM7SE/g9O3/k+4F9inO5WzV/5/gSpbE/jXOH+yL3HeluyBxJ kTWqf1M8RSKBRQ3pcCJdbtsyf7eEoCs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=t9yhvEoEf0I9FqluPdUxpi63OjmqK/Chm7JLl2s3VufRs0dwgkG2Z6uzXhCaMgFgrFk7Yy BFkyafgBnuiOQyCA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hXNzHYXf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=t9yhvEoE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=hXNzHYXfLT1PcWt5gCkgZZv2Ih4jPWMw0El0R+YaRP5NseRJi4IszAqXtEtK5SqZyyymOW +YRMHh51JDT0JSolxaWHJjSM7SE/g9O3/k+4F9inO5WzV/5/gSpbE/jXOH+yL3HeluyBxJ kTWqf1M8RSKBRQ3pcCJdbtsyf7eEoCs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wFinIpEiQX2ucufqSxxH6/ojsKQaF480Lvpp4gBS564=; b=t9yhvEoEf0I9FqluPdUxpi63OjmqK/Chm7JLl2s3VufRs0dwgkG2Z6uzXhCaMgFgrFk7Yy BFkyafgBnuiOQyCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 07/25] migration: Free the error earlier in the resume case Date: Fri, 9 Jan 2026 09:40:23 -0300 Message-ID: <20260109124043.25019-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 277F0337E0 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962593738158500 Content-Type: text/plain; charset="utf-8" Freeing the error at migration_connect() is redundant in the normal migration case. The freeing already happened at migrate_init(): qmp_migrate() -> migrate_prepare() -> migrate_init() -> qmp_migrate_finish() -> *_start_outgoing_migration() -> migration_channel_connect() -> migration_connect() For the resume case, migrate_prepare() returns early and doesn't reach migrate_init(). Move the extra migrate_error_free() call to migrate_prepare() along with the resume check. Also change migrate_init() to use migrate_error_free(), so it's easier to see where are the places the error gets freed. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 388e0be5a2..9204029c88 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1811,8 +1811,8 @@ int migrate_init(MigrationState *s, Error **errp) s->setup_time =3D 0; s->start_postcopy =3D false; s->migration_thread_running =3D false; - error_free(s->error); - s->error =3D NULL; + + migrate_error_free(s); =20 if (should_send_vmdesc()) { s->vmdesc =3D json_writer_new(false); @@ -2087,6 +2087,13 @@ static bool migrate_prepare(MigrationState *s, bool = resume, Error **errp) migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_PAUSED, MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP); =20 + /* + * If there's a previous error, free it and prepare for + * another one. For the non-resume case, this happens at + * migrate_init() below. + */ + migrate_error_free(s); + /* This is a resume, skip init status */ return true; } @@ -4015,13 +4022,6 @@ void migration_connect(MigrationState *s, Error *err= or_in) bool resume =3D (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP); int ret; =20 - /* - * If there's a previous error, free it and prepare for another one. - * Meanwhile if migration completes successfully, there won't have an = error - * dumped when calling migration_cleanup(). - */ - migrate_error_free(s); - s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962622; cv=none; d=zohomail.com; s=zohoarc; b=ObZzvkaFF9w5r/4pYxPzJ2WTyA0O1XcDmcoRwHfNz75S7EHd2LDftK29TJZdE+ylpqB9+MIxEMxyt6IKdCuDAQeQtNWWPg09K7wX/+rZrqbfZDE0Gcob8kydPKHxF5sCsdiHTF1LYVZkSF4H8BF8wNw8xGhBHElyUnudx8tliUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962622; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=jm/IsWthdHn0NKZ+xt5NLM3XqPEwmKNV8ofIvgXedtkfmSCKMJ0Og/XTd8YyfI0AqQsVZtwbIWBQ3Xu9wVD/p/VrfjDKwVkuX1ybm+VhQ55Su/arUjb7HMb9pt+BA5x/QR9Bao4jIgCVMXMTSoBxRTeJRcnpIDahhmIWa7OUF2I= 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 1767962622274746.1691130034355; Fri, 9 Jan 2026 04:43:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoG-0003ty-JA; Fri, 09 Jan 2026 07:41:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnp-0003St-H8 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:18 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBno-0007J8-1Q for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:17 -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 121A75BCE7; Fri, 9 Jan 2026 12:41:04 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A979C3EA63; Fri, 9 Jan 2026 12:41:02 +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 OO4ZGl73YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962464; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=q99WOhS0ydTQX9ym+PRArxSKC/8qax/8M5rpYY4xjZA9Wqad4nKxzx5bbfAS68iTtQSZLO PY5PukaFFCyBdAs1ApTiV27zYXWNuPCJHbR7pyrpXqJU8InuqhEAlOvsDuoBRLS1/jkOcl AQAtrC0xKXt+F/u+IglePZwXEQjjYek= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962464; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=WvRf5pzHR0s87ILTpRyOIyRdo/qxayEdHmk3x6292QVkpD/+ct8e0Yk9cUq5R1w1j0vM7b 1KPoWdahwEM+epBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962464; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=q99WOhS0ydTQX9ym+PRArxSKC/8qax/8M5rpYY4xjZA9Wqad4nKxzx5bbfAS68iTtQSZLO PY5PukaFFCyBdAs1ApTiV27zYXWNuPCJHbR7pyrpXqJU8InuqhEAlOvsDuoBRLS1/jkOcl AQAtrC0xKXt+F/u+IglePZwXEQjjYek= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962464; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbSLZ9QhwAjXPEa9qpVMFQF4TU/S+KhLumEOYL6so0E=; b=WvRf5pzHR0s87ILTpRyOIyRdo/qxayEdHmk3x6292QVkpD/+ct8e0Yk9cUq5R1w1j0vM7b 1KPoWdahwEM+epBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 08/25] migration: Move error reporting out of migration_cleanup Date: Fri, 9 Jan 2026 09:40:24 -0300 Message-ID: <20260109124043.25019-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962623920158500 Content-Type: text/plain; charset="utf-8" In the next patches migration_cleanup() will be used in qmp_migrate(), which currently does not show an error message. Move the error reporting out of migration_cleanup() to avoid duplicated messages. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9204029c88..7bef787f00 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1528,10 +1528,6 @@ static void migration_cleanup(MigrationState *s) MIGRATION_STATUS_CANCELLED); } =20 - if (s->error) { - /* It is used on info migrate. We can't free it */ - error_report_err(error_copy(s->error)); - } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; migration_call_notifiers(type, NULL); @@ -1540,7 +1536,12 @@ static void migration_cleanup(MigrationState *s) =20 static void migration_cleanup_bh(void *opaque) { - migration_cleanup(opaque); + MigrationState *s =3D opaque; + + migration_cleanup(s); + if (s->error) { + error_report_err(error_copy(s->error)); + } } =20 /* @@ -4025,18 +4026,12 @@ void migration_connect(MigrationState *s, Error *er= ror_in) s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); - if (resume) { - /* - * Don't do cleanup for resume if channel is invalid, but only= dump - * the error. We wait for another channel connect from the us= er. - * The error_report still gives HMP user a hint on what failed. - * It's normally done in migration_cleanup(), but call it here - * explicitly. - */ - error_report_err(error_copy(s->error)); - } else { + if (!resume) { migration_cleanup(s); } + if (s->error) { + error_report_err(error_copy(s->error)); + } return; } =20 @@ -4115,8 +4110,10 @@ fail: if (s->state !=3D MIGRATION_STATUS_CANCELLING) { migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); } - error_report_err(local_err); migration_cleanup(s); + if (s->error) { + error_report_err(error_copy(s->error)); + } } =20 static void migration_class_init(ObjectClass *klass, const void *data) --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962549; cv=none; d=zohomail.com; s=zohoarc; b=kbl3HjlBw/XObPCamSEGQrQF7uuoutGrDbYUn3fqfRA34gOyMqitHAmLAaNWy2u03nlHSRQoVqXjaqzxJGoJi7YMGTJhqZPkjJ5o67d5Gp0LTJgGeUnua+JmbrGpnfM3HL9qtI9vEFwdnjbCqCGvQzWZ/1pqWsScnqGUEnmywZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962549; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=Vnl0gPOpMfM90SEOn/SNYS12zGZ+J3W/o2vimHRduvnFbTIE6htM95v5YNXzh5ULbPULD58IqW4Ig0ohqmmCmGyV1/e0Gf3BvRNLkNkgWOzhuB5VEOI/PG+gkmswppASsMw3nF35UAnMQrIQ0EM0gDXpMKBBCT8QVavUxmxRA/Y= 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 1767962549919205.5391172112063; Fri, 9 Jan 2026 04:42:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBnx-0003ae-7u; Fri, 09 Jan 2026 07:41: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 1veBnn-0003PP-VG for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:16 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBnm-0007Ho-2N for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:15 -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 D72BC337BA; Fri, 9 Jan 2026 12:41: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 8881C3EA63; Fri, 9 Jan 2026 12:41:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aJYDEmD3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962465; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=sNUXpqscbhZdHLcWoMq/p+yBF6BNOERLrTylv7ai78+yIAwsk9lzqnIv+wxCpSY8YemQg+ IdVngJIJaVOeZ4E/uyDHRzNZQZTSaZkN5gTJYaUUD6QyyqcGXyjfXKiULfkSv4fbACxZHi ElbghGhAJ3WkoN/0kq9eNBJ92CTsAVc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962465; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=blH8NPfN06FSZKtL/w/vLMFfr1Pz1SMIQsr0y0TRAuOMJmUuwRXrZ7V7FIHxhHWKf1iRIO FlmF51hh2JRwPUBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962465; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=sNUXpqscbhZdHLcWoMq/p+yBF6BNOERLrTylv7ai78+yIAwsk9lzqnIv+wxCpSY8YemQg+ IdVngJIJaVOeZ4E/uyDHRzNZQZTSaZkN5gTJYaUUD6QyyqcGXyjfXKiULfkSv4fbACxZHi ElbghGhAJ3WkoN/0kq9eNBJ92CTsAVc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962465; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I48TAE/xOk1nyMvRWHsE2sVDHDMfT/YwQ7tRGYv4E04=; b=blH8NPfN06FSZKtL/w/vLMFfr1Pz1SMIQsr0y0TRAuOMJmUuwRXrZ7V7FIHxhHWKf1iRIO FlmF51hh2JRwPUBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 09/25] migration: Expand migration_connect_error_propagate to cover cancelling Date: Fri, 9 Jan 2026 09:40:25 -0300 Message-ID: <20260109124043.25019-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962551550158500 Content-Type: text/plain; charset="utf-8" Cover the CANCELLING state in migration_connect_error_propagate() and use it to funnel errors from migrate_prepare() until the end of migration_connect(). (add some line breaks for legibility) Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 7bef787f00..259b60af04 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1575,18 +1575,25 @@ static void migrate_error_free(MigrationState *s) static void migration_connect_error_propagate(MigrationState *s, Error *er= ror) { MigrationStatus current =3D s->state; - MigrationStatus next; - - assert(s->to_dst_file =3D=3D NULL); + MigrationStatus next =3D MIGRATION_STATUS_NONE; =20 switch (current) { case MIGRATION_STATUS_SETUP: next =3D MIGRATION_STATUS_FAILED; break; + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: /* Never fail a postcopy migration; switch back to PAUSED instead = */ next =3D MIGRATION_STATUS_POSTCOPY_PAUSED; break; + + case MIGRATION_STATUS_CANCELLING: + /* + * Don't move out of CANCELLING, the only valid transition is to + * CANCELLED, at migration_cleanup(). + */ + break; + default: /* * This really shouldn't happen. Just be careful to not crash a VM @@ -1597,7 +1604,10 @@ static void migration_connect_error_propagate(Migrat= ionState *s, Error *error) return; } =20 - migrate_set_state(&s->state, current, next); + if (next) { + migrate_set_state(&s->state, current, next); + } + migrate_error_propagate(s, error); } =20 @@ -4106,10 +4116,7 @@ void migration_connect(MigrationState *s, Error *err= or_in) return; =20 fail: - migrate_error_propagate(s, error_copy(local_err)); - if (s->state !=3D MIGRATION_STATUS_CANCELLING) { - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); - } + migration_connect_error_propagate(s, local_err); migration_cleanup(s); if (s->error) { error_report_err(error_copy(s->error)); --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962700; cv=none; d=zohomail.com; s=zohoarc; b=Yg8I6dkBbRHZrB+Q7mrXZLqGsWfzuvzu3vQcUXBBjMfrAldfuPLyQ4Mwm9eQ+ym/SsB+CWUv6LcnCtpbWhw2OQ6AvecNmPIGIUwgXE9BCpeVRXCiv9s61zDq44F+idz/QEluVmAuzXBeeaU+lyrckxtnzR2uc7ePL9U8TwkOnkg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962700; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=Hed8NE16dNPEZe6dj2z3LjAm2r4D0f7Z6O3sOmpW5qQ8mKxPM4dZlajxTiuk9F2xpl6eW/i9aDxPlwwQ/cBgH0Tk8aV5kQesf3CPkl3u2g/QGcaXi71csBObZRoamGs1+4jeMNiB+WH6YP1d3Mi7NNWOhsSrEG0/4oIq7+xXPbc= 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 1767962700375517.9447551136734; Fri, 9 Jan 2026 04:45:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoI-00045F-7X; Fri, 09 Jan 2026 07:41:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnw-0003ao-Li for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:25 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBnt-0007Jo-5s for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:23 -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 B04425BD06; Fri, 9 Jan 2026 12:41:07 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 654713EA63; Fri, 9 Jan 2026 12:41: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 +Hg6CWL3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962467; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=EoZRsYHdRnZs/EwYZehfr0b+qCZJ+T4iij9lL7BIBzUCfn6r6ITDnCCcC8jFS44N+aBnm5 Qvs67nPSiVp1P7jgrPVc0PrR5jb7G7MntZ+2eOqZk6BVIvy5uMKZYWBJq0vStpltYbtUSl s9glx7i1DPpW9OycRAxBhj1DC7EKT3E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962467; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=XKoU52U28KgShwlKooisTSA1yG48zcvrS+f+F9vnZVpcORGJIWralj0L/udJ5OilCh8QpP ChZeI10mWcomELBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962467; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=EoZRsYHdRnZs/EwYZehfr0b+qCZJ+T4iij9lL7BIBzUCfn6r6ITDnCCcC8jFS44N+aBnm5 Qvs67nPSiVp1P7jgrPVc0PrR5jb7G7MntZ+2eOqZk6BVIvy5uMKZYWBJq0vStpltYbtUSl s9glx7i1DPpW9OycRAxBhj1DC7EKT3E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962467; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8Cg35PALIzMlNaP40i0YpKV/WkztClLnp/5FtGNUdQ=; b=XKoU52U28KgShwlKooisTSA1yG48zcvrS+f+F9vnZVpcORGJIWralj0L/udJ5OilCh8QpP ChZeI10mWcomELBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 10/25] migration: yank: Move register instance earlier Date: Fri, 9 Jan 2026 09:40:26 -0300 Message-ID: <20260109124043.25019-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962702293158500 Content-Type: text/plain; charset="utf-8" Move the register_instance call to migrate_prepare() so it can be paired with the unregister_instance at migration_cleanup(). Otherwise, the cleanup cannot be run when cpr_state_save() fails because the instance is registered only after it. When resuming from a paused postcopy migration, migrate_prepare() returns early, but migration_cleanup() doesn't run, so the yank will remain paired. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 259b60af04..164cb26c48 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2180,11 +2180,12 @@ static bool migrate_prepare(MigrationState *s, bool= resume, Error **errp) return false; } =20 + yank_register_instance(MIGRATION_YANK_INSTANCE, &error_abort); + return true; } =20 -static void qmp_migrate_finish(MigrationAddress *addr, bool resume_request= ed, - Error **errp); +static void qmp_migrate_finish(MigrationAddress *addr, Error **errp); =20 static void migrate_hup_add(MigrationState *s, QIOChannel *ioc, GSourceFun= c cb, void *opaque) @@ -2209,7 +2210,7 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, { MigrationAddress *addr =3D opaque; =20 - qmp_migrate_finish(addr, false, NULL); + qmp_migrate_finish(addr, NULL); =20 cpr_state_close(); migrate_hup_delete(migrate_get_current()); @@ -2221,7 +2222,6 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_detach, bool det= ach, bool has_resume, bool resume, Error **errp) { - bool resume_requested; Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationChannel) channel =3D NULL; @@ -2274,8 +2274,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - resume_requested =3D has_resume && resume; - if (!migrate_prepare(s, resume_requested, errp)) { + if (!migrate_prepare(s, has_resume && resume, errp)) { /* Error detected, put into errp */ return; } @@ -2299,28 +2298,22 @@ void qmp_migrate(const char *uri, bool has_channels, QAPI_CLONE(MigrationAddress, addr)); =20 } else { - qmp_migrate_finish(addr, resume_requested, errp); + qmp_migrate_finish(addr, errp); } =20 out: if (local_err) { + yank_unregister_instance(MIGRATION_YANK_INSTANCE); migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); } } =20 -static void qmp_migrate_finish(MigrationAddress *addr, bool resume_request= ed, - Error **errp) +static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) { MigrationState *s =3D migrate_get_current(); Error *local_err =3D NULL; =20 - if (!resume_requested) { - if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) { - return; - } - } - if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { SocketAddress *saddr =3D &addr->u.socket; if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || @@ -2343,9 +2336,6 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, } =20 if (local_err) { - if (!resume_requested) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); - } migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); return; --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962963; cv=none; d=zohomail.com; s=zohoarc; b=NC5yQLEUxpUF0/9Fm9emIDfkISzv9WAOo5SEFn5hH7cG9H8H1ahphSD5YO6hhYp1ALO5RzR9ohv/LkGi9sBWTc7cgpLZ9eLzNHnpYY2PW1nUd0Fz+mIkhopmZjMS7S6i8YLwIKtfYiLmwXWl3X7OH3I9Y7ssRAKP4/8G7TG6Ehw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962963; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=ni/Sd+sFR/5XQDVYdcBslFCItvztcNrOYZflMr2MbWSfegzE/lZoVf0L2EfnYU3x0fErN4Mc+103gNtcjgJHxRTh+3borXQJxxmYmQNn7ukZAD9uyeAWAedi2BG+rgYQsbXE6QkMRML58msHyJ5Rgw7xoY2ukWgmLxCC71am7Ws= 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 1767962963797432.34962214278926; Fri, 9 Jan 2026 04:49:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoA-0003qN-AI; Fri, 09 Jan 2026 07:41:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBnt-0003YH-E2 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:22 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBnr-0007Ja-Nn for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41: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 8B25A33808; Fri, 9 Jan 2026 12:41:09 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 40A2B3EA63; Fri, 9 Jan 2026 12:41:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kJLPOmP3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=rI1h8r3RjMUuvaf31cs2m3CryiestgVA67wEeX2mU9ReGI33FnRZjgcJyXMOogIrEnCWRI 5VCssG7SleJrCBUBPct8FzUEmibRVqZ0greMFdkpLSdomxzUHtNFo/79gOkK0Z90+X36tt wGLdrSoY7HCjdttXcgZgnGJkXXyfRdQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=AxqZ/j+72CEQQi/Q6i+H8ZQC/tzTRrZY0wL7gIGEF8sZnX2o/kofKXcsZlJF99e4f0DxUa OKV3W6zwv9/BsBAA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=rI1h8r3R; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="AxqZ/j+7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=rI1h8r3RjMUuvaf31cs2m3CryiestgVA67wEeX2mU9ReGI33FnRZjgcJyXMOogIrEnCWRI 5VCssG7SleJrCBUBPct8FzUEmibRVqZ0greMFdkpLSdomxzUHtNFo/79gOkK0Z90+X36tt wGLdrSoY7HCjdttXcgZgnGJkXXyfRdQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6g2z5WvcN+x0DrLLM0CsHxCOuixvhNc2LRVtbIoPM+Q=; b=AxqZ/j+72CEQQi/Q6i+H8ZQC/tzTRrZY0wL7gIGEF8sZnX2o/kofKXcsZlJF99e4f0DxUa OKV3W6zwv9/BsBAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 11/25] migration: Fold migration_cleanup() into migration_connect_error_propagate() Date: Fri, 9 Jan 2026 09:40:27 -0300 Message-ID: <20260109124043.25019-12-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; 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]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 8B25A33808 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962965566158500 Content-Type: text/plain; charset="utf-8" Whenever an error occurs between migrate_init() and the start of migration_thread, do cleanup immediately after. This allows the special casing for resume to be removed from migration_connect(), that check is now done at migration_connect_error_propagate() which already had a case for resume. The cleanup at qmp_migrate_finish_cb can also be removed because it will always be reached wither via the error path at qmp_migrate_finish->migration_connect_error_propagate or via the migrate_cleanup_bh. The yank_unregister_instance at qmp_migrate() is now replaced by the one at migration_cleanup(). Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 164cb26c48..d57cc2dc3b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1576,15 +1576,21 @@ static void migration_connect_error_propagate(Migra= tionState *s, Error *error) { MigrationStatus current =3D s->state; MigrationStatus next =3D MIGRATION_STATUS_NONE; + bool resume =3D false; =20 switch (current) { case MIGRATION_STATUS_SETUP: next =3D MIGRATION_STATUS_FAILED; break; =20 + case MIGRATION_STATUS_POSTCOPY_PAUSED: + resume =3D true; + break; + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: /* Never fail a postcopy migration; switch back to PAUSED instead = */ next =3D MIGRATION_STATUS_POSTCOPY_PAUSED; + resume =3D true; break; =20 case MIGRATION_STATUS_CANCELLING: @@ -1609,6 +1615,10 @@ static void migration_connect_error_propagate(Migrat= ionState *s, Error *error) } =20 migrate_error_propagate(s, error); + + if (!resume) { + migration_cleanup(s); + } } =20 void migration_cancel(void) @@ -2211,9 +2221,6 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, MigrationAddress *addr =3D opaque; =20 qmp_migrate_finish(addr, NULL); - - cpr_state_close(); - migrate_hup_delete(migrate_get_current()); qapi_free_MigrationAddress(addr); return G_SOURCE_REMOVE; } @@ -2222,7 +2229,6 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList *channels, bool has_detach, bool det= ach, bool has_resume, bool resume, Error **errp) { - Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationChannel) channel =3D NULL; MigrationAddress *addr =3D NULL; @@ -2279,6 +2285,13 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 + /* + * The migrate_prepare() above calls migrate_init(). From this + * point on, until the end of migration, make sure any failures + * eventually result in a call to migration_cleanup(). + */ + Error *local_err =3D NULL; + if (!cpr_state_save(cpr_channel, &local_err)) { goto out; } @@ -2303,7 +2316,6 @@ void qmp_migrate(const char *uri, bool has_channels, =20 out: if (local_err) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); } @@ -4026,9 +4038,6 @@ void migration_connect(MigrationState *s, Error *erro= r_in) s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { migration_connect_error_propagate(s, error_in); - if (!resume) { - migration_cleanup(s); - } if (s->error) { error_report_err(error_copy(s->error)); } @@ -4107,7 +4116,6 @@ void migration_connect(MigrationState *s, Error *erro= r_in) =20 fail: migration_connect_error_propagate(s, local_err); - migration_cleanup(s); if (s->error) { error_report_err(error_copy(s->error)); } --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962529; cv=none; d=zohomail.com; s=zohoarc; b=oMDjUReM0IM3CNL8vxaCD6pj8vnCnzURQTd5y4bR8aAtQ4sMbJu6WweJLb3SMdc4k/EDAU2s78jEF5+7tPs40PEvq+kmgH2ha1OfhBj3wKAxAkB/ZuSNGGbAN6sKE4uAGDi1zuU69JkyXtaA0FibSB8c04vOzorfLcI0pHvGphI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962529; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=ntlD40kzO2FZHWn71/dPqOy0AEqdyRplpq00WR6pnkEzxs89wB5ARm/B58Vx35NHNlnDzkwyro3bKleVxIpRDOpHQP8MpH98NhjpmAOtsqmKdBBwlaIkE1/0tOj+3FEqkBFkuHdxRbCTOrzv047GhIMcCtiJZMXd4OUfBnuZbJc= 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 1767962529772814.5980833172367; Fri, 9 Jan 2026 04:42:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoH-0003zE-11; Fri, 09 Jan 2026 07:41:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBo0-0003hO-KK for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:30 -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 1veBny-0007KG-8S for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:28 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BBCDD337E0; Fri, 9 Jan 2026 12:41:11 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2BB5F3EA63; Fri, 9 Jan 2026 12:41:09 +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 oDX9NmX3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=0cZ3B79DpYztg7GBbbBfD4PRCG34w5r5cNi7MhFPwHWjpwvl4CJWVeKJSS2e64Q8ZIzNHk 3oevPK6okwzH43j7oWidp2QVo4S/dCBWZSNz0K84Mu/+FiXXbbyn5XakqvaJlv383iof4S uXw2oiHSqcWD3FfzrOA0xizzjCHJG5k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=JiASzCzJYYvRTTDSye6kgLY4cMjkxskm9WhEyStAanViOzrcDVA04KkZuPPdCWlhWA0X8q Zh8rTeXrgou4KHDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=0cZ3B79D; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=JiASzCzJ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=0cZ3B79DpYztg7GBbbBfD4PRCG34w5r5cNi7MhFPwHWjpwvl4CJWVeKJSS2e64Q8ZIzNHk 3oevPK6okwzH43j7oWidp2QVo4S/dCBWZSNz0K84Mu/+FiXXbbyn5XakqvaJlv383iof4S uXw2oiHSqcWD3FfzrOA0xizzjCHJG5k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Hl/L3HrVf/3rE5M+8zvDGNNqrWVgAJar0eEqntxcP8=; b=JiASzCzJYYvRTTDSye6kgLY4cMjkxskm9WhEyStAanViOzrcDVA04KkZuPPdCWlhWA0X8q Zh8rTeXrgou4KHDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v3 12/25] migration: Handle error in the early async paths Date: Fri, 9 Jan 2026 09:40:28 -0300 Message-ID: <20260109124043.25019-13-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[]; 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]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: BBCDD337E0 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962531455158500 Content-Type: text/plain; charset="utf-8" Simplify migration_channel_connect() and migration_connect() to not take an error as input. Move the error handling into the paths that generate the error. To achieve this, call migration_connect_error_propagate() from socket.c and tls.c, which are the async paths. For the sync paths, the handling is done as normal by returning all the way to qmp_migrate_finish(), except that now the sync paths don't pass the error forward into migration_connect() anymore. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/channel.c | 49 ++++++++++++++++++++---------------------- migration/channel.h | 4 +--- migration/exec.c | 2 +- migration/fd.c | 2 +- migration/file.c | 2 +- migration/migration.c | 11 ++-------- migration/migration.h | 3 ++- migration/rdma.c | 2 +- migration/socket.c | 17 ++++++++------- migration/tls.c | 14 ++++++------ migration/tls.h | 3 +-- migration/trace-events | 2 +- 12 files changed, 50 insertions(+), 61 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index ba14f66d85..26cb7bf059 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -60,38 +60,35 @@ void migration_channel_process_incoming(QIOChannel *ioc) * * @s: Current migration state * @ioc: Channel to which we are connecting - * @error: Error indicating failure to connect, free'd here */ -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - Error *error) +void migration_channel_connect(MigrationState *s, QIOChannel *ioc) { - trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), error); + trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); =20 - if (!error) { - if (migrate_channel_requires_tls_upgrade(ioc)) { - migration_tls_channel_connect(s, ioc, &error); + if (migrate_channel_requires_tls_upgrade(ioc)) { + Error *local_err =3D NULL; =20 - if (!error) { - /* tls_channel_connect will call back to this - * function after the TLS handshake, - * so we mustn't call migration_connect until then - */ - - return; - } - } else { - QEMUFile *f =3D qemu_file_new_output(ioc); - - migration_ioc_register_yank(ioc); - - qemu_mutex_lock(&s->qemu_file_lock); - s->to_dst_file =3D f; - qemu_mutex_unlock(&s->qemu_file_lock); + migration_tls_channel_connect(s, ioc, &local_err); + if (local_err) { + migration_connect_error_propagate(s, local_err); } + + /* + * async: the above will call back to this function after + * the TLS handshake is successfully completed. + */ + return; } - migration_connect(s, error); + + QEMUFile *f =3D qemu_file_new_output(ioc); + + migration_ioc_register_yank(ioc); + + qemu_mutex_lock(&s->qemu_file_lock); + s->to_dst_file =3D f; + qemu_mutex_unlock(&s->qemu_file_lock); + + migration_connect(s); } =20 =20 diff --git a/migration/channel.h b/migration/channel.h index 2215091323..ccfeaaef18 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -20,9 +20,7 @@ =20 void migration_channel_process_incoming(QIOChannel *ioc); =20 -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - Error *error_in); +void migration_channel_connect(MigrationState *s, QIOChannel *ioc); =20 int migration_channel_read_peek(QIOChannel *ioc, const char *buf, diff --git a/migration/exec.c b/migration/exec.c index 78fe0fff13..d83a07435a 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -55,7 +55,7 @@ void exec_start_outgoing_migration(MigrationState *s, str= List *command, } =20 qio_channel_set_name(ioc, "migration-exec-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/fd.c b/migration/fd.c index c956b260a4..0144a70742 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -70,7 +70,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** } =20 qio_channel_set_name(ioc, "migration-fd-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); object_unref(OBJECT(ioc)); } =20 diff --git a/migration/file.c b/migration/file.c index c490f2b219..7bb9c1c79f 100644 --- a/migration/file.c +++ b/migration/file.c @@ -122,7 +122,7 @@ void file_start_outgoing_migration(MigrationState *s, return; } qio_channel_set_name(ioc, "migration-file-outgoing"); - migration_channel_connect(s, ioc, NULL); + migration_channel_connect(s, ioc); } =20 static gboolean file_accept_incoming_migration(QIOChannel *ioc, diff --git a/migration/migration.c b/migration/migration.c index d57cc2dc3b..1ea6125454 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1572,7 +1572,7 @@ static void migrate_error_free(MigrationState *s) } } =20 -static void migration_connect_error_propagate(MigrationState *s, Error *er= ror) +void migration_connect_error_propagate(MigrationState *s, Error *error) { MigrationStatus current =3D s->state; MigrationStatus next =3D MIGRATION_STATUS_NONE; @@ -4028,7 +4028,7 @@ fail_setup: return NULL; } =20 -void migration_connect(MigrationState *s, Error *error_in) +void migration_connect(MigrationState *s) { Error *local_err =3D NULL; uint64_t rate_limit; @@ -4036,13 +4036,6 @@ void migration_connect(MigrationState *s, Error *err= or_in) int ret; =20 s->expected_downtime =3D migrate_downtime_limit(); - if (error_in) { - migration_connect_error_propagate(s, error_in); - if (s->error) { - error_report_err(error_copy(s->error)); - } - return; - } =20 if (resume) { /* This is a resumed migration */ diff --git a/migration/migration.h b/migration/migration.h index 8b55d4741a..d134881eaf 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -533,10 +533,11 @@ void migration_incoming_process(void); =20 bool migration_has_all_channels(void); =20 +void migration_connect_error_propagate(MigrationState *s, Error *error); void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 -void migration_connect(MigrationState *s, Error *error_in); +void migration_connect(MigrationState *s); =20 int migration_call_notifiers(MigrationEventType type, Error **errp); =20 diff --git a/migration/rdma.c b/migration/rdma.c index 337b415889..596a1aba0b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3997,7 +3997,7 @@ void rdma_start_outgoing_migration(void *opaque, =20 s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; - migration_connect(s, NULL); + migration_connect(s); return; return_path_err: qemu_rdma_cleanup(rdma); diff --git a/migration/socket.c b/migration/socket.c index 426f363b99..298bac30cc 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -59,24 +59,25 @@ static void socket_outgoing_migration(QIOTask *task, gpointer opaque) { struct SocketConnectData *data =3D opaque; - QIOChannel *sioc =3D QIO_CHANNEL(qio_task_get_source(task)); + g_autoptr(QIOChannel) sioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { - trace_migration_socket_outgoing_error(error_get_pretty(err)); - goto out; + goto err; } =20 - trace_migration_socket_outgoing_connected(); - if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { error_setg(&err, "Zero copy send feature not detected in host kern= el"); + goto err; } =20 -out: - migration_channel_connect(data->s, sioc, err); - object_unref(OBJECT(sioc)); + trace_migration_socket_outgoing_connected(); + migration_channel_connect(data->s, sioc); + return; +err: + trace_migration_socket_outgoing_error(error_get_pretty(err)); + migration_connect_error_propagate(data->s, err); } =20 void socket_start_outgoing_migration(MigrationState *s, diff --git a/migration/tls.c b/migration/tls.c index 82f58cbc78..837b08294f 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -104,16 +104,17 @@ static void migration_tls_outgoing_handshake(QIOTask = *task, gpointer opaque) { MigrationState *s =3D opaque; - QIOChannel *ioc =3D QIO_CHANNEL(qio_task_get_source(task)); + g_autoptr(QIOChannel) ioc =3D QIO_CHANNEL(qio_task_get_source(task)); Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { trace_migration_tls_outgoing_handshake_error(error_get_pretty(err)= ); - } else { - trace_migration_tls_outgoing_handshake_complete(); + migration_connect_error_propagate(s, err); + return; } - migration_channel_connect(s, ioc, err); - object_unref(OBJECT(ioc)); + + trace_migration_tls_outgoing_handshake_complete(); + migration_channel_connect(s, ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, @@ -129,8 +130,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, return qio_channel_tls_new_client(ioc, creds, migrate_tls_hostname(), = errp); } =20 -void migration_tls_channel_connect(MigrationState *s, - QIOChannel *ioc, +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, Error **errp) { QIOChannelTLS *tioc; diff --git a/migration/tls.h b/migration/tls.h index 7cd9c76013..0e86d38862 100644 --- a/migration/tls.h +++ b/migration/tls.h @@ -29,8 +29,7 @@ void migration_tls_channel_process_incoming(QIOChannel *i= oc, Error **errp); QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, Error **errp); =20 -void migration_tls_channel_connect(MigrationState *s, - QIOChannel *ioc, +void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, Error **errp); void migration_tls_channel_end(QIOChannel *ioc, Error **errp); /* Whether the QIO channel requires further TLS handshake? */ diff --git a/migration/trace-events b/migration/trace-events index da8f909cac..cbf10d0b63 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -204,7 +204,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype, void *err) = "ioc=3D%p ioctype=3D%s err=3D%p" +migration_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" =20 # global_state.c migrate_state_too_big(void) "" --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962700; cv=none; d=zohomail.com; s=zohoarc; b=dAgI9I1mzO8hdYeQPQAxQf/UvOEEVOd5O0YTpP8LR590qw6v+x/NVVgMTF3W9l59sJ3wD6J3l8Mz/DPOTaNRNHxB80fMoQnKsXQXBnFhcNhBDv1TtFdbXa3GKd+SBXQ+izqDU/TCDqluqNLCQXdNqYb96wvNj01ZHpSEyNDA4iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962700; 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=46j6GdTSUH1mUriHJOqiSSwjebPQzt3r+0b1REwVHJc=; b=HgNVFrhh5fCG5jvQAUMbKhzqBIj51FxNcC75CLm8mhfd4LOpBAWrgls+XFjcDJmDKcyRqZqniqe07a/M6ZgUY4RvHtDwcqk9E63oqNAOevB8fWkYhh7xeoo1XBgGD3jptE3lmJETIAchwZgUX1M77tOu7zqEnJzXlE+lT0qwzOk= 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 1767962700158346.368355282058; Fri, 9 Jan 2026 04:45:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoJ-0004Ff-9S; Fri, 09 Jan 2026 07:41: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 1veBo2-0003iy-Ld for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:34 -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 1veBo0-0007KL-Co for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41: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-out2.suse.de (Postfix) with ESMTPS id 9F3F05BE9E; Fri, 9 Jan 2026 12:41: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 51B8D3EA63; Fri, 9 Jan 2026 12:41:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CAczBGj3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=46j6GdTSUH1mUriHJOqiSSwjebPQzt3r+0b1REwVHJc=; b=AFlQFJGSE+sOaBkeTAuqRGjDPEWpJaQNw8i3vdiB7BetHgphoph2PkQDCwTb2+cAQUP+ZV sQmtRnawjtcNsAba6fi9vNyNJYnYFJQ+6It5cT8ujFNKxatG8VNY2dBEId71ozAYe3Xwpi WOrVRlzlXvz1jOW7wuhS2T4mn5s5EqQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=46j6GdTSUH1mUriHJOqiSSwjebPQzt3r+0b1REwVHJc=; b=pE6aLa2cDK2Bt2QoOXu9hAoUotlQntqZKXQm8fXItx/WdVmyLYnQPPmZPVWIxdybSJ6vaU i585hTOLD6mcGzBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=AFlQFJGS; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=pE6aLa2c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=46j6GdTSUH1mUriHJOqiSSwjebPQzt3r+0b1REwVHJc=; b=AFlQFJGSE+sOaBkeTAuqRGjDPEWpJaQNw8i3vdiB7BetHgphoph2PkQDCwTb2+cAQUP+ZV sQmtRnawjtcNsAba6fi9vNyNJYnYFJQ+6It5cT8ujFNKxatG8VNY2dBEId71ozAYe3Xwpi WOrVRlzlXvz1jOW7wuhS2T4mn5s5EqQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=46j6GdTSUH1mUriHJOqiSSwjebPQzt3r+0b1REwVHJc=; b=pE6aLa2cDK2Bt2QoOXu9hAoUotlQntqZKXQm8fXItx/WdVmyLYnQPPmZPVWIxdybSJ6vaU i585hTOLD6mcGzBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 13/25] migration: Move setting of QEMUFile into migration_outgoing|incoming_setup Date: Fri, 9 Jan 2026 09:40:29 -0300 Message-ID: <20260109124043.25019-14-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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_DN_NONE(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(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]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 9F3F05BE9E 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962702219158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 1ea6125454..b7367eb5cf 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 3fb1a07ba9..4980ed4f04 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1521,7 +1521,7 @@ bool multifd_recv_all_channels_created(void) * Try to receive all multifd channels to get ready for the migration. * Sets @errp when failing to receive the current channel. */ -void multifd_recv_new_channel(QIOChannel *ioc, Error **errp) +bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp) { MultiFDRecvParams *p; Error *local_err =3D NULL; @@ -1536,7 +1536,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) "failed to receive packet" " via multifd channel %d: ", qatomic_read(&multifd_recv_state->coun= t)); - return; + return false; } trace_multifd_recv_new_channel(id); } else { @@ -1549,7 +1549,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) id); multifd_recv_terminate_threads(error_copy(local_err)); error_propagate(errp, local_err); - return; + return false; } p->c =3D ioc; object_ref(OBJECT(ioc)); @@ -1558,4 +1558,6 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p, QEMU_THREAD_JOINABLE); qatomic_inc(&multifd_recv_state->count); + + return true; } diff --git a/migration/multifd.h b/migration/multifd.h index 9b6d81e7ed..89a395aef2 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -42,7 +42,7 @@ int multifd_recv_setup(Error **errp); void multifd_recv_cleanup(void); void multifd_recv_shutdown(void); bool multifd_recv_all_channels_created(void); -void multifd_recv_new_channel(QIOChannel *ioc, Error **errp); +bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp); void multifd_recv_sync_main(void); int multifd_send_sync_main(MultiFDSyncReq req); bool multifd_queue_page(RAMBlock *block, ram_addr_t offset); --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962511; cv=none; d=zohomail.com; s=zohoarc; b=jiCUzJ37CW9Jk44EuJ9TFmKZRT2qfV1g+KGwxvvybbSpDMcNYqWs8OY3M1nbl+VXKFGX4VP0XAvQvCvUMMc5nnGxpmYYtMJDObXvkhaftco3Ks4K7PMPBGAhpGujsDkaYUXUKrr8B2XrPtCWSUiiSpXzdKKGfw6v1ynzA6eUAV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962511; 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=8qy1DjkeEORYRSEcMmgmXenr31cqnrvlXJtfontzKfE=; b=UERaj6RGra1pv2NsGhTduRvOjZMMhHRAj/Ko38+P4WUjtSZshM8/98hRhS7cVlFXyqRAu5CskRVY5U1d99qrisiocR2K33qeMxcPOUaqpZAACv5dBPc2QbvLD1ebHQA0A52HTanGamZTWLVyaW7eSTUgcSUxiCuirKyzEjVHix8= 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 1767962511509690.3956017414503; Fri, 9 Jan 2026 04:41:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoJ-0004FW-6e; Fri, 09 Jan 2026 07:41: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 1veBoA-0003uC-DU for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:40 -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 1veBo7-0007Kd-EK for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:37 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BE0263380D; Fri, 9 Jan 2026 12:41: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 314053EA63; Fri, 9 Jan 2026 12:41: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 eG47OGn3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962475; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8qy1DjkeEORYRSEcMmgmXenr31cqnrvlXJtfontzKfE=; b=YB7h67OOSPhZQBhJDBhgmZYn5+7/udaTa3r2i0045qDZs+9NAHrH7FZ1fT+K6e3QyK05kC +l51ix+fpzbaopxyVot3b/N4HKOEigowS5dxgnaXETnp10H7Tp6UD+j5lf/8GqG/u+zsi8 LqQA4h4JVC6wE2h25U5LLsjVPjLZ1oo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962475; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8qy1DjkeEORYRSEcMmgmXenr31cqnrvlXJtfontzKfE=; b=EU1huKeheZs5iiihmuzz0/jzt4QkHGk9xjPPu2m7zY6+HSATLLGp6tfjmm417KihY/fnzD a26rWUn1/mNG6vCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962475; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8qy1DjkeEORYRSEcMmgmXenr31cqnrvlXJtfontzKfE=; b=YB7h67OOSPhZQBhJDBhgmZYn5+7/udaTa3r2i0045qDZs+9NAHrH7FZ1fT+K6e3QyK05kC +l51ix+fpzbaopxyVot3b/N4HKOEigowS5dxgnaXETnp10H7Tp6UD+j5lf/8GqG/u+zsi8 LqQA4h4JVC6wE2h25U5LLsjVPjLZ1oo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962475; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8qy1DjkeEORYRSEcMmgmXenr31cqnrvlXJtfontzKfE=; b=EU1huKeheZs5iiihmuzz0/jzt4QkHGk9xjPPu2m7zY6+HSATLLGp6tfjmm417KihY/fnzD a26rWUn1/mNG6vCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v3 14/25] migration/rdma: Use common connection paths Date: Fri, 9 Jan 2026 09:40:30 -0300 Message-ID: <20260109124043.25019-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962513526158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 b7367eb5cf..7d56d73769 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 596a1aba0b..d902c8669c 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "channel.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "exec/target_page.h" @@ -384,7 +385,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdmain; RDMAContext *rdmaout; - QEMUFile *file; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -3836,32 +3836,30 @@ static void qio_channel_rdma_register_types(void) =20 type_init(qio_channel_rdma_register_types); =20 -static QEMUFile *rdma_new_input(RDMAContext *rdma) +static QIOChannel *rdma_new_input(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); rioc->rdmain =3D rdma; rioc->rdmaout =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 -static QEMUFile *rdma_new_output(RDMAContext *rdma) +static QIOChannel *rdma_new_output(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); rioc->rdmaout =3D rdma; rioc->rdmain =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 static void rdma_accept_incoming_migration(void *opaque) { RDMAContext *rdma =3D opaque; - QEMUFile *f; + QIOChannel *ioc; =20 trace_qemu_rdma_accept_incoming_migration(); if (qemu_rdma_accept(rdma) < 0) { @@ -3875,15 +3873,16 @@ static void rdma_accept_incoming_migration(void *op= aque) return; } =20 - f =3D rdma_new_input(rdma); - if (f =3D=3D NULL) { + ioc =3D rdma_new_input(rdma); + if (ioc =3D=3D NULL) { error_report("RDMA ERROR: could not open RDMA for input"); qemu_rdma_cleanup(rdma); return; } =20 rdma->migration_started_on_destination =3D 1; - migration_fd_process_incoming(f); + migration_incoming_setup(ioc, CH_MAIN, &error_abort); + migration_incoming_process(); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, @@ -3995,8 +3994,8 @@ void rdma_start_outgoing_migration(void *opaque, =20 trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 - s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; + migration_outgoing_setup(rdma_new_output(rdma)); migration_connect(s); return; return_path_err: --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962515; cv=none; d=zohomail.com; s=zohoarc; b=Au4JMzM/gPCYtf1nzJEYdcSvy3klXzkFKxvi9kSlHWPMVJ97KQebViuNZQRyUGyFm9oJhG31c/9lNzsoWM/hLm8p6njl6hEx7ReNq47UJPkmoYvR4Yc8w8hl7u3FynLjpCfC2yboLTRJFuoqPls2tSNJH1Py5avjiOsX1cb0iPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962515; 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=ivwXwIkvjOm0smjHDsnACFt7oN8qCf3a7Ve8f0KmueA=; b=dx6YDb7+DfoE+Bb8FLrRSNUVio1iLMhc9+HZV9j3/yxY4oeVwcLdDWxZuQUjMvRdt99zIQkS9IPVwQqwq0PXjPbdv2G1iBDi/5k8BSAs4oOqIqZYdfnhp1j+afRDvhkcb1voRnlIMwBkMAbj/QnAMtBHuC5YPS8goGsFgO1n6WQ= 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 17679625154330.38434011266167545; Fri, 9 Jan 2026 04:41:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoM-0004cd-S9; Fri, 09 Jan 2026 07:41: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 1veBoA-0003uD-Df for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:40 -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 1veBo8-0007Kj-5u for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:37 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9F6FA5BCE7; Fri, 9 Jan 2026 12:41:17 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 51D853EA63; Fri, 9 Jan 2026 12:41: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 wJhwBGz3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962477; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ivwXwIkvjOm0smjHDsnACFt7oN8qCf3a7Ve8f0KmueA=; b=Cagw1y9CJ0yR7zl8rtL6SpJB20Iz2YPjh/EbDEdDytmgt12JZLDnzLyLkylGxUpQoWf+o9 mfaYEOu4EtR1wu5LLKVZmBV4dtAbUMzjepZJRr45xaS1fO7+pNyWJowKyJFtzjcLrQzuYe dKgwQRyWMLhdwcbZ4Hx6zhDG5zPIbGI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962477; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ivwXwIkvjOm0smjHDsnACFt7oN8qCf3a7Ve8f0KmueA=; b=G1uSF1WEnexJvDD0NgIdYZfWl3Mbe/N81C75C99VARC4Fl20jnIqnO4X/F4mxQKSiPMocs uv46pH+j1IYahEAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962477; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ivwXwIkvjOm0smjHDsnACFt7oN8qCf3a7Ve8f0KmueA=; b=Cagw1y9CJ0yR7zl8rtL6SpJB20Iz2YPjh/EbDEdDytmgt12JZLDnzLyLkylGxUpQoWf+o9 mfaYEOu4EtR1wu5LLKVZmBV4dtAbUMzjepZJRr45xaS1fO7+pNyWJowKyJFtzjcLrQzuYe dKgwQRyWMLhdwcbZ4Hx6zhDG5zPIbGI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962477; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ivwXwIkvjOm0smjHDsnACFt7oN8qCf3a7Ve8f0KmueA=; b=G1uSF1WEnexJvDD0NgIdYZfWl3Mbe/N81C75C99VARC4Fl20jnIqnO4X/F4mxQKSiPMocs uv46pH+j1IYahEAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 15/25] migration: Start incoming from channel.c Date: Fri, 9 Jan 2026 09:40:31 -0300 Message-ID: <20260109124043.25019-16-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962517565158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 7d56d73769..a052b99a19 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 Feb 8 20:23:39 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=1767962528; cv=none; d=zohomail.com; s=zohoarc; b=ZV5KwMPgBHX1xyxKKZX0TFpC7KuYXlVTCwi6CZGqVG9bL3WAlFhct6aaelR2Xe1ER2Mht1akJ4SiEvo7Ha0HRMIFLUsvUpPWNnrtMhMW2znOYMqzRxF3+crSTd3h7+bxr4GbxAajAI3HYe3nXzqIbjJZ5sexvfURsI480cpe8qQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962528; 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=2dsS8vqKFkAf1sbThWipwqySx5momWhA0MEufMmchTQ=; b=d0eNQs3wgtRNRxXpWn084uScyQuYIRAd2JKh82qIbz90RgqqhNsWlRmGx/sffphgCv7K4PGn59QrW3gpEyQYU6xmDpCWIZbn7EGFM88XZtfD1MHhuoRxpNbALf7t0hhiKFkNY9C7JpP6g+ASDP6hG4dsLdoE1d6hbZRp4ftFcoE= 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 1767962527991496.02923935481465; Fri, 9 Jan 2026 04:42:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoM-0004Zf-BL; Fri, 09 Jan 2026 07:41: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 1veBoI-00045O-46 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:46 -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 1veBoG-0007MI-14 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41: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-out1.suse.de (Postfix) with ESMTPS id 85E91337BA; Fri, 9 Jan 2026 12:41:19 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 387FE3EA63; Fri, 9 Jan 2026 12:41:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2O+FOW33YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dsS8vqKFkAf1sbThWipwqySx5momWhA0MEufMmchTQ=; b=LhULWgkzTpdK8b3cSwZv2fpg9U3ndf/d65CGh7gXJx/F6wRreR0VCTSiROJ8Q8pWkhiwTe Ds2oSgOECBGiEsblGrcTITZtvBXEx8TlBaQYApCN5JEhcEccTkSSwjr9zXB02rrKjKV1pu M8TuNJA2lvKHy5zlqUZ0AYnCMr19X8E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dsS8vqKFkAf1sbThWipwqySx5momWhA0MEufMmchTQ=; b=Dui8vFRG7YK/exb5XDZiw5fIGeSjrYLufeICsMbbCTjwK1aPaagZ6qfmIv0q8Z8J7R4WVV 8L1oACF7pU9s0UAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=LhULWgkz; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Dui8vFRG DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dsS8vqKFkAf1sbThWipwqySx5momWhA0MEufMmchTQ=; b=LhULWgkzTpdK8b3cSwZv2fpg9U3ndf/d65CGh7gXJx/F6wRreR0VCTSiROJ8Q8pWkhiwTe Ds2oSgOECBGiEsblGrcTITZtvBXEx8TlBaQYApCN5JEhcEccTkSSwjr9zXB02rrKjKV1pu M8TuNJA2lvKHy5zlqUZ0AYnCMr19X8E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dsS8vqKFkAf1sbThWipwqySx5momWhA0MEufMmchTQ=; b=Dui8vFRG7YK/exb5XDZiw5fIGeSjrYLufeICsMbbCTjwK1aPaagZ6qfmIv0q8Z8J7R4WVV 8L1oACF7pU9s0UAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 16/25] migration/channel: Rename migration_channel_connect Date: Fri, 9 Jan 2026 09:40:32 -0300 Message-ID: <20260109124043.25019-17-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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_DN_NONE(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(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]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 85E91337BA 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962529525158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 298bac30cc..611915f84d 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -73,7 +73,7 @@ static void socket_outgoing_migration(QIOTask *task, } =20 trace_migration_socket_outgoing_connected(); - migration_channel_connect(data->s, sioc); + migration_channel_connect_outgoing(data->s, sioc); return; err: trace_migration_socket_outgoing_error(error_get_pretty(err)); diff --git a/migration/tls.c b/migration/tls.c index 837b08294f..89ba52de02 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -114,7 +114,7 @@ static void migration_tls_outgoing_handshake(QIOTask *t= ask, } =20 trace_migration_tls_outgoing_handshake_complete(); - migration_channel_connect(s, ioc); + migration_channel_connect_outgoing(s, ioc); } =20 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc, --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962803; cv=none; d=zohomail.com; s=zohoarc; b=Ub84QV4R2Oq2XIjZqsiMVGH0zbcSbnA+lWKmTFcw2R2R2YrF0ACRWNTlLsRhrNg6iCwju73cZAjQ3VQpj6aoQXNY7DuHScdM7VnY1pXNuYBcRBH+2EFkDTCHgwD9KAMJCBgTrDhSsfRCAkRn4lAfiRAgfH0XzWCq3pKs7LFUWoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962803; 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=xp64qGakvLo4/o/hYAzIKd5FeTo0ff1dThZ4RT2AjSY=; b=Lb6oFqm9LhmChFVfaYak7PIr3Y2MhBbLZlQZ9WdIUeZauHPOeMSVMbkbTm/Rw6EeZVUQzHWFqufboQv/aikc7B1rWifCGb9FOPLedpoI9C0bm4YJ2cVqGtsmhfEhHDFF2eFIhdQ20H32Ir8qD2AGIZ5QI1vqMt0Se+dTF6nWOuI= 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 1767962803932246.7148639869007; Fri, 9 Jan 2026 04:46:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoR-0005EI-Bl; Fri, 09 Jan 2026 07:41:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBoP-0004tK-0D for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:53 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBoM-0007N2-71 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:52 -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 BFC0B33808; Fri, 9 Jan 2026 12:41:21 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2A3CD3EA63; Fri, 9 Jan 2026 12:41:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +L+sNm/3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962481; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xp64qGakvLo4/o/hYAzIKd5FeTo0ff1dThZ4RT2AjSY=; b=WabOiRcSJ4otj7VGm3LqpUq546f4977D1clTjecVZjIOzCTOiIl5m/xbsjM/n2hRYN0a+m HpcfQTAar8gxi6Uhddhr3Gk//QiiSybb0r7XppTCanfIiH4DjR6rGWNXa3jJ054IfJLTp8 9FMctn/YnNLKuhdU93DNeZt7X3deHO8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962481; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xp64qGakvLo4/o/hYAzIKd5FeTo0ff1dThZ4RT2AjSY=; b=Gp2lN44ip+D2Ja4c2FBIbvxN+OF1yKbN1SkT6glwq97086v/X/A4np3Dxe2SYr0Qn+0he1 FW1zz9pGMAwmkIDw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962481; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xp64qGakvLo4/o/hYAzIKd5FeTo0ff1dThZ4RT2AjSY=; b=WabOiRcSJ4otj7VGm3LqpUq546f4977D1clTjecVZjIOzCTOiIl5m/xbsjM/n2hRYN0a+m HpcfQTAar8gxi6Uhddhr3Gk//QiiSybb0r7XppTCanfIiH4DjR6rGWNXa3jJ054IfJLTp8 9FMctn/YnNLKuhdU93DNeZt7X3deHO8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962481; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xp64qGakvLo4/o/hYAzIKd5FeTo0ff1dThZ4RT2AjSY=; b=Gp2lN44ip+D2Ja4c2FBIbvxN+OF1yKbN1SkT6glwq97086v/X/A4np3Dxe2SYr0Qn+0he1 FW1zz9pGMAwmkIDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v3 17/25] migration: Rename instances of start Date: Fri, 9 Jan 2026 09:40:33 -0300 Message-ID: <20260109124043.25019-18-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962804890158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 a052b99a19..83b85b20f9 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; @@ -1971,7 +1971,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); @@ -2018,7 +2018,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) @@ -2335,18 +2335,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"); } @@ -4032,7 +4032,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 d902c8669c..a23843bdc4 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3882,17 +3882,16 @@ static void rdma_accept_incoming_migration(void *op= aque) =20 rdma->migration_started_on_destination =3D 1; migration_incoming_setup(ioc, CH_MAIN, &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()) { @@ -3910,7 +3909,7 @@ void rdma_start_incoming_migration(InetSocketAddress = *host_port, goto err; } =20 - trace_rdma_start_incoming_migration_after_dest_init(); + trace_rdma_connect_incoming_after_dest_init(); =20 ret =3D rdma_listen(rdma->listen_id, 5); =20 @@ -3919,7 +3918,7 @@ void rdma_start_incoming_migration(InetSocketAddress = *host_port, goto cleanup_rdma; } =20 - trace_rdma_start_incoming_migration_after_rdma_listen(); + trace_rdma_connect_incoming_after_rdma_listen(); s->rdma_migration =3D true; qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration, NULL, (void *)(intptr_t)rdma); @@ -3934,8 +3933,8 @@ err: g_free(rdma); } =20 -void rdma_start_outgoing_migration(void *opaque, - InetSocketAddress *host_port, Error **errp) +void rdma_connect_outgoing(void *opaque, + InetSocketAddress *host_port, Error **errp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; @@ -3959,7 +3958,7 @@ void rdma_start_outgoing_migration(void *opaque, goto err; } =20 - trace_rdma_start_outgoing_migration_after_rdma_source_init(); + trace_rdma_connect_outgoing_after_rdma_source_init(); ret =3D qemu_rdma_connect(rdma, false, errp); =20 if (ret < 0) { @@ -3992,11 +3991,11 @@ void rdma_start_outgoing_migration(void *opaque, rdma_return_path->is_return_path =3D true; } =20 - trace_rdma_start_outgoing_migration_after_rdma_connect(); + trace_rdma_connect_outgoing_after_rdma_connect(); =20 s->rdma_migration =3D true; migration_outgoing_setup(rdma_new_output(rdma)); - migration_connect(s); + migration_start_outgoing(s); return; return_path_err: qemu_rdma_cleanup(rdma); diff --git a/migration/rdma.h b/migration/rdma.h index f74f16a459..170c25cf44 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,10 +21,10 @@ =20 #include "system/memory.h" =20 -void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_p= ort, - Error **errp); +void rdma_connect_outgoing(void *opaque, InetSocketAddress *host_port, + Error **errp); =20 -void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **e= rrp); +void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 /* * Constants used by rdma return codes diff --git a/migration/socket.c b/migration/socket.c index 611915f84d..ac3183d5d5 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -80,9 +80,8 @@ err: migration_connect_error_propagate(data->s, err); } =20 -void socket_start_outgoing_migration(MigrationState *s, - SocketAddress *saddr, - Error **errp) +void socket_connect_outgoing(MigrationState *s, SocketAddress *saddr, + Error **errp) { QIOChannelSocket *sioc =3D qio_channel_socket_new(); struct SocketConnectData *data =3D g_new0(struct SocketConnectData, 1); @@ -140,8 +139,7 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } =20 -void socket_start_incoming_migration(SocketAddress *saddr, - Error **errp) +void socket_connect_incoming(SocketAddress *saddr, Error **errp) { QIONetListener *listener =3D qio_net_listener_new(); MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/socket.h b/migration/socket.h index 04ebbe95a1..f0c89b64c7 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -23,10 +23,10 @@ =20 void socket_send_channel_create(QIOTaskFunc f, void *data); =20 -void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); +void socket_connect_incoming(SocketAddress *saddr, Error **errp); =20 -void socket_start_outgoing_migration(MigrationState *s, - SocketAddress *saddr, Error **errp); +void socket_connect_outgoing(MigrationState *s, + SocketAddress *saddr, Error **errp); void socket_cleanup_outgoing_migration(void); =20 #endif diff --git a/migration/trace-events b/migration/trace-events index cbf10d0b63..91d7506634 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -271,11 +271,11 @@ rdma_registration_handle_wait(void) "" rdma_registration_start(uint64_t flags) "%" PRIu64 rdma_registration_stop(uint64_t flags) "%" PRIu64 rdma_registration_stop_ram(void) "" -rdma_start_incoming_migration(void) "" -rdma_start_incoming_migration_after_dest_init(void) "" -rdma_start_incoming_migration_after_rdma_listen(void) "" -rdma_start_outgoing_migration_after_rdma_connect(void) "" -rdma_start_outgoing_migration_after_rdma_source_init(void) "" +rdma_connect_incoming(void) "" +rdma_connect_incoming_after_dest_init(void) "" +rdma_connect_incoming_after_rdma_listen(void) "" +rdma_connect_outgoing_after_rdma_connect(void) "" +rdma_connect_outgoing_after_rdma_source_init(void) "" =20 # postcopy-ram.c postcopy_discard_send_finish(const char *ramblock, int nwords, int ncmds) = "%s mask words sent=3D%d in %d commands" --=20 2.51.0 From nobody Sun Feb 8 20:23:39 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=1767962935; cv=none; d=zohomail.com; s=zohoarc; b=bX0s/VR37v5CCMc3VviETuKn6jlQnpzgyiw1qEMfbuEg8RtzOKe8GaX4DRcSEHeU1KhMKhcUPewxDCNf/aYq291zBo9NN0G/1tCi2Cf2G9AMXDY8fBCi9Ff3QCcbYZI5PVPt++ZsZ0i5hLA8iBqkfPr5R0k1ERGTwcu8iod24Bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962935; 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=NP55gRJfKuyt72Kup2980k4Hgk8ixWn+bjaEcT1rQGA=; b=X6EuDxUMwieWdWYwAhIgq7fTi3G1vDmjXCmeihG54985YIJVQTzsqyYXs1JfX2botllIDQ6oZRSiPHttQKkfxmNKZQWICTDJwje3S93fCSnjOs5lTxaHvNBAdFhJh5XW/y+QxuBGM7eC5VYLESG1E0SDUgORfj/71up+GmohYYQ= 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 176796293571326.285955521139954; Fri, 9 Jan 2026 04:48:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoX-0005hu-3M; Fri, 09 Jan 2026 07:42:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBoU-0005Ug-Ps for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:58 -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 1veBoS-0007NM-J8 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:58 -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 D83D233954; Fri, 9 Jan 2026 12:41:23 +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 4A8C53EA63; Fri, 9 Jan 2026 12:41:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QKJwAnL3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962483; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NP55gRJfKuyt72Kup2980k4Hgk8ixWn+bjaEcT1rQGA=; b=f0SqTLdGyNcYeNgX0TXPwJX6SEa//xokYoDZTw8aB4tN8uVjYa4Spb2MfMO6xlq4h51j+Z F1K5ewXABGg9KkfQYZwWolYNyfZSfwQ686YordPgXXR3SErHg5b6rgelcGebb/oCzF5jOM epbJhZcDf72fmCvecT+QkeRKf4OpxX0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962483; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NP55gRJfKuyt72Kup2980k4Hgk8ixWn+bjaEcT1rQGA=; b=+9gI183D0jp/a0ZvXeOH1U0s09YB4kWBqF6Ziqfo70gewR1SdCYpQ/BPMq+TeCGVqxwr6B dfEYj2LzfQxSNuAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962483; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NP55gRJfKuyt72Kup2980k4Hgk8ixWn+bjaEcT1rQGA=; b=f0SqTLdGyNcYeNgX0TXPwJX6SEa//xokYoDZTw8aB4tN8uVjYa4Spb2MfMO6xlq4h51j+Z F1K5ewXABGg9KkfQYZwWolYNyfZSfwQ686YordPgXXR3SErHg5b6rgelcGebb/oCzF5jOM epbJhZcDf72fmCvecT+QkeRKf4OpxX0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962483; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NP55gRJfKuyt72Kup2980k4Hgk8ixWn+bjaEcT1rQGA=; b=+9gI183D0jp/a0ZvXeOH1U0s09YB4kWBqF6Ziqfo70gewR1SdCYpQ/BPMq+TeCGVqxwr6B dfEYj2LzfQxSNuAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v3 18/25] migration: Move channel code to channel.c Date: Fri, 9 Jan 2026 09:40:34 -0300 Message-ID: <20260109124043.25019-19-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962937437158500 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 83b85b20f9..aa291f1fed 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 a23843bdc4..b726392097 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 Feb 8 20:23:39 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=1767962700; cv=none; d=zohomail.com; s=zohoarc; b=N1w5m+ZRVJySChdE62nrr0vJAo36T3cDLboClMmdhnup19so/9l9eNyBpQEyY1XBJTkPbysjEkErZkcei/vRLX+nLB2jm0FoPv9MqhvzgM4ETXk6kKxQ3mMc4+H3FBB6dM4oBDayYsRhvKDVlbi7XY8NuKiQ9y+oDdIUDSaG7Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962700; 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=FMdQNPk5WyzN5r4e9et6p+zXdoV4Yjw/TtVPf3kCJ8s=; b=n/7R+NKD513U7m5g5OKMoMrfYWySbSQ8CdwzW+MME4Xo0N4/RusozEMdQmMa3GuXxxGMn7zSY/yZBWNve9g/N8JMq0qvdVv14PNuCSBDx3vmDYV//+rd50bpKE3htaPFGOBPM0Ys1cqfqKkTyhHuVl/WR4k/zcX/fylYmgUcCW8= 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 1767962700308347.873697106211; Fri, 9 Jan 2026 04:45:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoc-00066d-WA; Fri, 09 Jan 2026 07:42:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBob-00061X-3T for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:05 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBoZ-0007Nk-0s for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:04 -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 B66E633957; Fri, 9 Jan 2026 12:41: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 6A36B3EA63; Fri, 9 Jan 2026 12:41:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4COrCnT3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FMdQNPk5WyzN5r4e9et6p+zXdoV4Yjw/TtVPf3kCJ8s=; b=glR6MGsFlooE2fqZ0Tgw4lu9XLKJf5amUgHCrKWpTcKPJPNUfyd2+sq370TWsZ3HCcrfnh 0FHRi28I6wUjxK8Rk0ShqhgtkDvb1ph+9ZQ/Jb/4A3jH1purPWgcFphcKZFWDnAVZPcl8B f/h65s1itQ7DCyAM1Fm2hISuf99jf3o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FMdQNPk5WyzN5r4e9et6p+zXdoV4Yjw/TtVPf3kCJ8s=; b=CuoPBiWLp2gsouGoYebyTCcoHYwzWrjDNYQn+rO4qSBA2DW79lksf8woUiibNKlJf9hrnY Zmv7ha+UbKJGw8Dw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FMdQNPk5WyzN5r4e9et6p+zXdoV4Yjw/TtVPf3kCJ8s=; b=glR6MGsFlooE2fqZ0Tgw4lu9XLKJf5amUgHCrKWpTcKPJPNUfyd2+sq370TWsZ3HCcrfnh 0FHRi28I6wUjxK8Rk0ShqhgtkDvb1ph+9ZQ/Jb/4A3jH1purPWgcFphcKZFWDnAVZPcl8B f/h65s1itQ7DCyAM1Fm2hISuf99jf3o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FMdQNPk5WyzN5r4e9et6p+zXdoV4Yjw/TtVPf3kCJ8s=; b=CuoPBiWLp2gsouGoYebyTCcoHYwzWrjDNYQn+rO4qSBA2DW79lksf8woUiibNKlJf9hrnY Zmv7ha+UbKJGw8Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 19/25] migration: Move transport connection code into channel.c Date: Fri, 9 Jan 2026 09:40:35 -0300 Message-ID: <20260109124043.25019-20-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962702336158500 Content-Type: text/plain; charset="utf-8" Move the _connect_incoming|outgoing functions to channel.c. It leaves migration.c to deal with the established connection only. (I sorted the includes) Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 aa291f1fed..3c93fb23cc 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(); @@ -2234,31 +2212,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 Feb 8 20:23:39 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=1767962954; cv=none; d=zohomail.com; s=zohoarc; b=EoUo55oX2I0AJDwm2lCRDP3x8plrJrqNP2MP7Q0SHi0YeXQtg/TH22t6LbBQrJnWkHdHbivfgYtFzf75QhBrgkRg7ujxAoLOzZNo1AyzApiky2/BBrezywKyGasbkuNz34l76sl8l0ONFrdr8ryvUc3qbF26TFylyaMXLRnoP6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962954; 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=TcmSyHB43deUahwSZW6lzq1LJs9toIb0Ne+XSt4duUc=; b=oKiuAKFFzKgIuwbglSl2tOV/ZQTD9juopp2/JRv5YiFJZ/y1gAJOR8FEfY1J/tyfVk0o3Tm+driYvVOMPJMm9wFXIJewhVfvjiaW9FeCfvNb0m0udM3XzHn9cAV/WPpgQCzzjcDoJtTIS4kilRLLd9ByGDQy7mfEFb9MU7ULwD0= 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 1767962954450179.87971828387674; Fri, 9 Jan 2026 04:49:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBor-0006Qn-5d; Fri, 09 Jan 2026 07:42:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBog-0006It-VY for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:11 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBoe-0007O3-Ry for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:10 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9701533A1D; Fri, 9 Jan 2026 12:41: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 47D693EA63; Fri, 9 Jan 2026 12:41:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QJkzAnb3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcmSyHB43deUahwSZW6lzq1LJs9toIb0Ne+XSt4duUc=; b=SlfLRXNNUKJ+uDdUEBD4pTblAyGHjO03PfqEQMA1+LCV1mldPkeMgJALEYRKXcNsrYBk+d 02S85/GlQvSRwizPPwcaST/BAdstfza0V8z8Bt5XamoEqdeiTzD82truJZUxV7YZWSa5CF t5qnReWKn9V7KidYOTa3/qo+KyXvoBA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcmSyHB43deUahwSZW6lzq1LJs9toIb0Ne+XSt4duUc=; b=z2yI/RwGgl6Y8fTT7ZKZ4q5AVD4nbuo51hmHI4KATamUuJ6QW7c8UO9lhlJcZbsqj638TH QVnWRM9uYzwP4dCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=SlfLRXNN; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="z2yI/RwG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcmSyHB43deUahwSZW6lzq1LJs9toIb0Ne+XSt4duUc=; b=SlfLRXNNUKJ+uDdUEBD4pTblAyGHjO03PfqEQMA1+LCV1mldPkeMgJALEYRKXcNsrYBk+d 02S85/GlQvSRwizPPwcaST/BAdstfza0V8z8Bt5XamoEqdeiTzD82truJZUxV7YZWSa5CF t5qnReWKn9V7KidYOTa3/qo+KyXvoBA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcmSyHB43deUahwSZW6lzq1LJs9toIb0Ne+XSt4duUc=; b=z2yI/RwGgl6Y8fTT7ZKZ4q5AVD4nbuo51hmHI4KATamUuJ6QW7c8UO9lhlJcZbsqj638TH QVnWRM9uYzwP4dCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 20/25] migration: Move channel parsing to channel.c Date: Fri, 9 Jan 2026 09:40:36 -0300 Message-ID: <20260109124043.25019-21-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_TRACE(0.00)[suse.de:+]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; 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] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 9701533A1D 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962955619158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/channel.c | 45 ++++++++++++++++++++++++++++++++++++++ migration/channel.h | 5 +++++ migration/migration.c | 50 ++++++++++++------------------------------- 3 files changed, 64 insertions(+), 36 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 56c80b5cdf..8b71b3f430 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "channel.h" #include "exec.h" #include "fd.h" @@ -20,7 +21,9 @@ #include "migration.h" #include "multifd.h" #include "options.h" +#include "qapi/clone-visitor.h" #include "qapi/qapi-types-migration.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/error.h" #include "qemu-file.h" #include "qemu/yank.h" @@ -280,3 +283,45 @@ int migration_channel_read_peek(QIOChannel *ioc, =20 return 0; } + +bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) +{ + MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; + bool single_channel =3D cpr_channelp ? false : true; + + if (single_channel && channels->next) { + error_setg(errp, "Channel list must have only one entry, " + "for type 'main'"); + return false; + } + + for ( ; channels; channels =3D channels->next) { + MigrationChannelType type; + + type =3D channels->value->channel_type; + if (channelv[type]) { + error_setg(errp, "Channel list has more than one %s entry", + MigrationChannelType_str(type)); + return false; + } + channelv[type] =3D channels->value; + } + + if (cpr_channelp) { + *cpr_channelp =3D QAPI_CLONE(MigrationChannel, + channelv[MIGRATION_CHANNEL_TYPE_CPR]); + } + + *main_channelp =3D QAPI_CLONE(MigrationChannel, + channelv[MIGRATION_CHANNEL_TYPE_MAIN]); + + if (!(*main_channelp)->addr) { + error_setg(errp, "Channel list has no main entry"); + return false; + } + + return true; +} diff --git a/migration/channel.h b/migration/channel.h index 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 3c93fb23cc..98c1f38e8e 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(); @@ -2116,10 +2110,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 @@ -2130,38 +2122,24 @@ void qmp_migrate(const char *uri, bool has_channels, } =20 if (channels) { - for ( ; channels; channels =3D channels->next) { - MigrationChannelType type =3D channels->value->channel_type; - - if (channelv[type]) { - error_setg(errp, "Channel list has more than one %s entry", - MigrationChannelType_str(type)); - return; - } - channelv[type] =3D channels->value; - } - cpr_channel =3D channelv[MIGRATION_CHANNEL_TYPE_CPR]; - addr =3D channelv[MIGRATION_CHANNEL_TYPE_MAIN]->addr; - if (!addr) { - error_setg(errp, "Channel list has no main entry"); + if (!migrate_channels_parse(channels, &main_ch, &cpr_ch, errp)) { return; } } =20 if (uri) { /* caller uses the old URI syntax */ - if (!migrate_uri_parse(uri, &channel, errp)) { + if (!migrate_uri_parse(uri, &main_ch, errp)) { return; } - addr =3D channel->addr; } =20 /* transport mechanism not suitable for migration? */ - if (!migration_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(main_ch->addr, errp)) { return; } =20 - if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { + if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_ch) { error_setg(errp, "missing 'cpr' migration channel"); return; } @@ -2178,7 +2156,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 @@ -2194,10 +2172,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 Feb 8 20:23:39 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=1767962648; cv=none; d=zohomail.com; s=zohoarc; b=W+xwIQDlOwhX7JWktpe9AvzlBKaeh4/1dabUIt1a+XjBc0sBCU1ozdtpnVqpjiv/7r4DHbvfJ/WygBqSpUseXaihjrNKZ9C+Xz9ZOTRKODVPxVmrz9tDtG4PzaPuRx940gaq0BDnhFlVlC3WFLkanuOivB85zjs7rEWrYVgHZE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962648; 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=iX8khRyd67IY+/lzUJlDAoAUTCKpl9uRkYwJv3FEI9k=; b=bgQW6pddQPBxEMe0IMNA6GUrFPXx1F3+l54oSzuVsbyhjpkkdBICpV7FFXsqRDTJk/x3Zmk2omOIkcrntPaIj+Ce9AvXBkKWoaZpraV0AxAxuP260ERP7wfDSr+h2pEawRTw/EoqTKN5hK9LU/5PoWoDlEEvHUz1Q4L5t1Co2KA= 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 1767962648000676.8095301158428; Fri, 9 Jan 2026 04:44:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBp3-0006bd-N7; Fri, 09 Jan 2026 07:42: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 1veBom-0006QW-Ml for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:19 -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 1veBok-0007OY-Oz for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42: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-out1.suse.de (Postfix) with ESMTPS id C0B03337E0; Fri, 9 Jan 2026 12:41:29 +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 387563EA63; Fri, 9 Jan 2026 12:41: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 YJyxOHf3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iX8khRyd67IY+/lzUJlDAoAUTCKpl9uRkYwJv3FEI9k=; b=xkWNAyy2UAZ6DDgZh9bgcSdGHabb2vfFscVnrpjxyN+5XZiYYoRPfQpbTKdl8sj4QMOh7n WfYi9TTL6aMoOBTDHojVojgGSLln3Qwl7ISkE5VRDIcMY3GU6o7bWYjP1BNe/fLr4XNj7T nL57znb5ZjWkcSJFsXjHaOy056CdGwQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iX8khRyd67IY+/lzUJlDAoAUTCKpl9uRkYwJv3FEI9k=; b=AH1EDxoYcVx5Ef1KmhIElxrpPmgigWS83VI1jTfrhEltzl7+r53tHRAWcMkVmr7sebLlGk WAJOgzybbNLV3tDA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xkWNAyy2; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=AH1EDxoY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iX8khRyd67IY+/lzUJlDAoAUTCKpl9uRkYwJv3FEI9k=; b=xkWNAyy2UAZ6DDgZh9bgcSdGHabb2vfFscVnrpjxyN+5XZiYYoRPfQpbTKdl8sj4QMOh7n WfYi9TTL6aMoOBTDHojVojgGSLln3Qwl7ISkE5VRDIcMY3GU6o7bWYjP1BNe/fLr4XNj7T nL57znb5ZjWkcSJFsXjHaOy056CdGwQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iX8khRyd67IY+/lzUJlDAoAUTCKpl9uRkYwJv3FEI9k=; b=AH1EDxoYcVx5Ef1KmhIElxrpPmgigWS83VI1jTfrhEltzl7+r53tHRAWcMkVmr7sebLlGk WAJOgzybbNLV3tDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 21/25] migration: Move URI parsing to channel.c Date: Fri, 9 Jan 2026 09:40:37 -0300 Message-ID: <20260109124043.25019-22-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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_DN_NONE(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(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]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: C0B03337E0 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962652180158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 8b71b3f430..cee78532ea 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -284,10 +284,10 @@ int migration_channel_read_peek(QIOChannel *ioc, return 0; } =20 -bool migrate_channels_parse(MigrationChannelList *channels, - MigrationChannel **main_channelp, - MigrationChannel **cpr_channelp, - Error **errp) +static bool migrate_channels_parse(MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) { MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; bool single_channel =3D cpr_channelp ? false : true; @@ -325,3 +325,77 @@ bool migrate_channels_parse(MigrationChannelList *chan= nels, =20 return true; } + +bool migrate_uri_parse(const char *uri, MigrationChannel **channel, + Error **errp) +{ + g_autoptr(MigrationChannel) val =3D g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); + InetSocketAddress *isock =3D &addr->u.rdma; + strList **tail =3D &addr->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_EXEC; +#ifdef WIN32 + QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); + QAPI_LIST_APPEND(tail, g_strdup("/c")); +#else + QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); + QAPI_LIST_APPEND(tail, g_strdup("-c")); +#endif + QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); + } else if (strstart(uri, "rdma:", NULL)) { + if (inet_parse(isock, uri + strlen("rdma:"), errp)) { + qapi_free_InetSocketAddress(isock); + return false; + } + addr->transport =3D MIGRATION_ADDRESS_TYPE_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_SOCKET; + SocketAddress *saddr =3D socket_parse(uri, errp); + if (!saddr) { + return false; + } + addr->u.socket.type =3D saddr->type; + addr->u.socket.u =3D saddr->u; + /* Don't free the objects inside; their ownership moved to "addr" = */ + g_free(saddr); + } else if (strstart(uri, "file:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_FILE; + addr->u.file.filename =3D g_strdup(uri + strlen("file:")); + if (file_parse_offset(addr->u.file.filename, &addr->u.file.offset, + errp)) { + return false; + } + } else { + error_setg(errp, "unknown migration protocol: %s", uri); + return false; + } + + val->channel_type =3D MIGRATION_CHANNEL_TYPE_MAIN; + val->addr =3D g_steal_pointer(&addr); + *channel =3D g_steal_pointer(&val); + return true; +} + +bool migration_channel_parse_input(const char *uri, + MigrationChannelList *channels, + MigrationChannel **main_channelp, + MigrationChannel **cpr_channelp, + Error **errp) +{ + if (!uri =3D=3D !channels) { + error_setg(errp, "need either 'uri' or 'channels' argument"); + return false; + } + + if (channels) { + return migrate_channels_parse(channels, main_channelp, cpr_channel= p, + errp); + } else { + return migrate_uri_parse(uri, main_channelp, errp); + } +} diff --git a/migration/channel.h b/migration/channel.h index 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 98c1f38e8e..52c1bb5da2 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; @@ -2113,27 +2040,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 Feb 8 20:23:39 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=1767962605; cv=none; d=zohomail.com; s=zohoarc; b=AgB7Krqrkg+s7ptzq9WvW4rCQ02Sd5t0kZHDebU2e9y4+Y/jQSNYxNjm/vBsJbWYgXexndR7AQ9/CgXQUIeA6Mh52SI0lY267Xv6Gbc45W1CBJTk6b6R0XHSG+EPrWrzsEeRfVJ326Q1vZGxr1MB8mrYoc1vZAzp/POpUUbWFvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962605; 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=QTqOzInKszdo40jCyS7tieuHtJFHCQHbRnpp3Xczr84=; b=e17Bd9I2hUz++fikrVu/cZ9+9lKZuWql2ko5XECJ5vCOMVqV9Q3CbRVXgxlrdAOnufo3F/VeBueHskrbNYsJLMmD4b8c8ffKxtIilChbIy2aGlFax0xMeXy6O8xPWiDbjJZPg4qyTyae9pucuRMPsEGPCcRJr+Rf65n1BVRjMCA= 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 1767962605115357.69828785783625; Fri, 9 Jan 2026 04:43:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBp3-0006cG-N6; Fri, 09 Jan 2026 07:42: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 1veBot-0006W1-D6 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:25 -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 1veBor-0007Ou-2d for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:42:22 -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 88FD333952; Fri, 9 Jan 2026 12:41: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 676133EA63; Fri, 9 Jan 2026 12:41: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 SPnXCXr3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTqOzInKszdo40jCyS7tieuHtJFHCQHbRnpp3Xczr84=; b=yVKvTUmULRhKvqP6wOMdGWbWMB7lDo8rlp1IIOOfAPRhGZu5ADmIam0dA9g6Y9TJhE88IE aBIgAyhR4xo1jC/rQj/xXGCT/zCn6C2n+xNMHRCo8uPHOw6jL5ZbJDVoW+D7COBupSVmWu C79xbjSKD/1FbP00Qvq9fD+FWp69sMk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTqOzInKszdo40jCyS7tieuHtJFHCQHbRnpp3Xczr84=; b=MrZfO1s+kyeI2H3pYUutAnlhzymIX/8fUXp/88SdJ3jZtfxubMUsa0LKZFw3OfVwqRW0W4 Ev8dcSZuJpEsYNDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=yVKvTUmU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=MrZfO1s+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTqOzInKszdo40jCyS7tieuHtJFHCQHbRnpp3Xczr84=; b=yVKvTUmULRhKvqP6wOMdGWbWMB7lDo8rlp1IIOOfAPRhGZu5ADmIam0dA9g6Y9TJhE88IE aBIgAyhR4xo1jC/rQj/xXGCT/zCn6C2n+xNMHRCo8uPHOw6jL5ZbJDVoW+D7COBupSVmWu C79xbjSKD/1FbP00Qvq9fD+FWp69sMk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTqOzInKszdo40jCyS7tieuHtJFHCQHbRnpp3Xczr84=; b=MrZfO1s+kyeI2H3pYUutAnlhzymIX/8fUXp/88SdJ3jZtfxubMUsa0LKZFw3OfVwqRW0W4 Ev8dcSZuJpEsYNDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Mark Kanda , Ben Chaney Subject: [PATCH v3 22/25] migration: Free cpr-transfer MigrationAddress along with gsource Date: Fri, 9 Jan 2026 09:40:38 -0300 Message-ID: <20260109124043.25019-23-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[]; 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]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 88FD333952 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962605820158500 Content-Type: text/plain; charset="utf-8" When setting a callback on a Glib source and giving it a data pointer, it's natural to also provide the destructor for the data in question. Since migrate_hup_add() already needs to clone the MigrationAddress when setting the qmp_migrate_finish_cb callback, also pass the qapi_free_MigrationAddress as the GDestroyNotify callback. With this the address doesn't need to be freed at the callback body, making the management of that memory slight simpler. (also fix the indentation of migrate_hup_add) Cc: Mark Kanda Cc: Ben Chaney Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 52c1bb5da2..5167233f76 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2007,9 +2007,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) @@ -2028,7 +2030,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 @@ -2083,7 +2084,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 Feb 8 20:23:39 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=1767962518; cv=none; d=zohomail.com; s=zohoarc; b=FhBErMxa6IYziciCaz7CwOcFqRkV/+n5dOfsPaFTgCNxFhW9/yHSxkqYBYSurYpioN4AxaC7IZVSUPErwkRxJtS4elAi9iU/Vs9LOGaC63O+2mqkHdiTERfYNI4BYwmctr7umeVvB5TdlZaAgRL8qqvtose+uOJ4p6VxaqWX7Lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962518; 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=ZZPihHWFyip5uOxm6/TbbjlBT/W6JzxYArQR6lBeqCU=; b=kQDXZXz/L29cl1qr5/0iSaAIalhsm7S3fjMWZzZhIwTYUzWYS1CgrnqoTbb+hDgOC9ryZnGoH6o0nJPKAcb21821xr588+lHCCotmAIKV+OCNtef/a6PiEuxgy3yoE3Gw1esiMnf+jcfQBSH0rvWTjSnMqLDL6XFSXoKEaMsqZw= 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 1767962518201314.5469189604255; Fri, 9 Jan 2026 04:41:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoN-0004kG-R4; Fri, 09 Jan 2026 07:41:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBoI-00046D-79 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:46 -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 1veBoG-0007MG-0j for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41: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 EE6EC5BD06; Fri, 9 Jan 2026 12:41:34 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1C2E63EA63; Fri, 9 Jan 2026 12:41: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 mGrAMnz3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962495; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZPihHWFyip5uOxm6/TbbjlBT/W6JzxYArQR6lBeqCU=; b=XudIzf+fYZdFDndCo2sIJ+6Kq4b0Ij9Ni8xfQaQuuriv+c8onEK7H1aB2DL2BdQTGlG63C hM+ysv8dhlwad128MWcwyCPMG53MRsgXBxmIIt36wmPX3pHfMNXv3EvGyAitSe4jEBaTmx tII6qdQ5TUS46tH+RnjrGZjBmcVwfpA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962495; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZPihHWFyip5uOxm6/TbbjlBT/W6JzxYArQR6lBeqCU=; b=VDdeAP8bX/+3loj+zY6F0oLIFH4lYBrGwpO0EfNqKbK8WkxirpG4qoowLF4U1ti9LYR9wN bxOJ9a3LZMRyxnAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ZDFumSqH; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Ndv6dLX9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZPihHWFyip5uOxm6/TbbjlBT/W6JzxYArQR6lBeqCU=; b=ZDFumSqHgJXw0E8vsIYYjq6al1lDl87AGE9KjTtIBige8MDl4tcm4GcPtsNsTH0fi3dhE6 ccU2kyVvv88qM9Nkei4s0ipU9zromNWixA6+gRhxJt/FOWv9OjkZMufk0lkmUlUmVsBZt5 lq/IxVPipMqOz42TzgnLo8pFqauFlXc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZPihHWFyip5uOxm6/TbbjlBT/W6JzxYArQR6lBeqCU=; b=Ndv6dLX9N5Q0+1Xxij4lL2fr/v4VxVnEmnffUPgPQAgWYWYd6kWGQG9HswtOMN6vr0Ozro C2DpzIpkGUPO6jBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Mark Kanda , Ben Chaney Subject: [PATCH v3 23/25] migration: Move CPR HUP watch to cpr-transfer.c Date: Fri, 9 Jan 2026 09:40:39 -0300 Message-ID: <20260109124043.25019-24-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[]; 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]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: EE6EC5BD06 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1767962519665158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 5167233f76..6be2849326 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 @@ -1480,7 +1479,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 @@ -2004,25 +2003,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) @@ -2083,8 +2063,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 Feb 8 20:23:39 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=1767962954; cv=none; d=zohomail.com; s=zohoarc; b=CqrTddtPQdCDnlnEGMgxREEhMY8dpCxogPDEi6Ea4/LdIfcHrKJ9D0kfoGd9DB9EtfUzWLqODNiaTJjVHKkzGtb2wskHSStFqvmISVXxePrWdwuExFCztRwE2uuxtxtElDocoTjTMkh62wfsld1itftHwP7QXp0os87aNbWwxio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962954; 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=8B6gZVMTM6oa+XPmGy5FFlCU4nL1te5z4QsacKzpNUQ=; b=Ftf0ELVrPiyb9wJqEI8/XBn3xQy/O7DMdXpVBouiip+kHok1rY72sQlpwLbLlDw0GOES3+mRr4VyaFXHYlp/45EnV2L6lVKrf/phX491ATOkarij8/zYa5t1Zk02ujgMB2+EScrXNkiID+NhkLmevuO/sUMh5/E5HmzwzXztHaU= 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 1767962954396623.4127757039448; Fri, 9 Jan 2026 04:49:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoO-0004nO-DQ; Fri, 09 Jan 2026 07:41:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBoM-0004dE-S6 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:50 -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 1veBoL-0007Mv-3F for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41: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 CBC865BE76; Fri, 9 Jan 2026 12:41:36 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7B35B3EA63; Fri, 9 Jan 2026 12:41: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 sL65Dn/3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962496; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8B6gZVMTM6oa+XPmGy5FFlCU4nL1te5z4QsacKzpNUQ=; b=Byqe6gWWmg+kIHKBocyQGMaKMc9pXBdQd7CBcgC7c7dSy+ip/t0pj4rDfWiyvV4htQCA7J c52iD+sd3WpfF8vrp+Z1SBzB/MVC9KJsxF8YXs3MhAiwV1Uld0t030FW2an0ReKbv3gFig JcFv4u+wzgE+Bl5ixNfyR615iclCFdk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962496; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8B6gZVMTM6oa+XPmGy5FFlCU4nL1te5z4QsacKzpNUQ=; b=HCmwizVCUfDJbVhXSmdBxBlzw44m9zR0vugky7H1W/52WolHi05s4Z/IsW0Elli3SJagX0 BGLW5NPwjFN81ECA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Byqe6gWW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HCmwizVC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962496; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8B6gZVMTM6oa+XPmGy5FFlCU4nL1te5z4QsacKzpNUQ=; b=Byqe6gWWmg+kIHKBocyQGMaKMc9pXBdQd7CBcgC7c7dSy+ip/t0pj4rDfWiyvV4htQCA7J c52iD+sd3WpfF8vrp+Z1SBzB/MVC9KJsxF8YXs3MhAiwV1Uld0t030FW2an0ReKbv3gFig JcFv4u+wzgE+Bl5ixNfyR615iclCFdk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962496; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8B6gZVMTM6oa+XPmGy5FFlCU4nL1te5z4QsacKzpNUQ=; b=HCmwizVCUfDJbVhXSmdBxBlzw44m9zR0vugky7H1W/52WolHi05s4Z/IsW0Elli3SJagX0 BGLW5NPwjFN81ECA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com Subject: [PATCH v3 24/25] migration: Remove qmp_migrate_finish Date: Fri, 9 Jan 2026 09:40:40 -0300 Message-ID: <20260109124043.25019-25-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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%]; 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)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; 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]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: CBC865BE76 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962955654158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- migration/migration.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 6be2849326..086bbb03de 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2001,15 +2001,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 @@ -2063,10 +2066,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: @@ -2076,19 +2080,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 Feb 8 20:23:39 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=1767962700; cv=none; d=zohomail.com; s=zohoarc; b=W/vtnuYCG0zlfX4R0swDz5rtkk5h6eVvwuWVGnoN9JqOYaXTysgw2F3vnX9vKQWfm8iO0c6IAFsYRONjMUAfu3eEFsMJ5yRX9k7p60p/y/nbYoYDI2oLqFaUezlMI65MDYQgsU6RhxzdSZpyR6h/RPmt6Q9/Y8HwpfNcGP3tEnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767962700; 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=rXDLmk9wvX2ylogkwQAW9169g8AFr/89eCMogpDIvik=; b=fUEFuWFHH9mF8njeNnFQuMU6PzdFqrz+vRGjTnKPu6F2aKSWTStcTsOkDBadzioZ5riomIe62nSwqx9riYuZ9OAMf0hnHpdyaRWv9JS9dGFL7XwEAGIn+7nLm//LTrUxx7LyLBG54EeC8gDbAWyFreCZ7r8dB6N6wpD89vsMAaw= 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 1767962700878414.25494433207916; Fri, 9 Jan 2026 04:45:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veBoU-0005Tg-Bv; Fri, 09 Jan 2026 07:41:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1veBoS-0005PR-VP for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:57 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1veBoQ-0007NI-N0 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 07:41:56 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0155D5BCE7; Fri, 9 Jan 2026 12:41: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 6869F3EA63; Fri, 9 Jan 2026 12:41: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 0HsECoH3YGkkQgAAD6G6ig (envelope-from ); Fri, 09 Jan 2026 12:41:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXDLmk9wvX2ylogkwQAW9169g8AFr/89eCMogpDIvik=; b=pMA1ZbQPs7KgWAIKefDgs5dj2d4sjOcPeFGimbLPtWt8jriY/QrNmkEjSb5Z/LIUtzanfT a5hOJg9LDz3uevFUQeAqvl1ThOi7R4b0XpbnR+hAC/j9xq36s3nl4HitWpswb2/qHznAej cuqKZImb+xdVnwZHXNqP42RnBTigZ9A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXDLmk9wvX2ylogkwQAW9169g8AFr/89eCMogpDIvik=; b=49YbprRWRDXBIYuz1bLRIHid52GZxWcMLmWIkJQeotvfcxTcbxElqcl/wSBfvL+jGVM3T9 H2YLWMFJ9UWbR6CA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767962499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXDLmk9wvX2ylogkwQAW9169g8AFr/89eCMogpDIvik=; b=pMA1ZbQPs7KgWAIKefDgs5dj2d4sjOcPeFGimbLPtWt8jriY/QrNmkEjSb5Z/LIUtzanfT a5hOJg9LDz3uevFUQeAqvl1ThOi7R4b0XpbnR+hAC/j9xq36s3nl4HitWpswb2/qHznAej cuqKZImb+xdVnwZHXNqP42RnBTigZ9A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767962499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXDLmk9wvX2ylogkwQAW9169g8AFr/89eCMogpDIvik=; b=49YbprRWRDXBIYuz1bLRIHid52GZxWcMLmWIkJQeotvfcxTcbxElqcl/wSBfvL+jGVM3T9 H2YLWMFJ9UWbR6CA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v3 25/25] migration/channel: Centralize calling migration_channel_connect_outgoing Date: Fri, 9 Jan 2026 09:40:41 -0300 Message-ID: <20260109124043.25019-26-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260109124043.25019-1-farosas@suse.de> References: <20260109124043.25019-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)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767962702239158500 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 Signed-off-by: Fabiano Rosas Reviewed-by: Prasad Pandit --- 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 cee78532ea..589a5520fe 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 b726392097..5d78c1827a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3934,8 +3934,8 @@ err: g_free(rdma); } =20 -void rdma_connect_outgoing(void *opaque, - InetSocketAddress *host_port, Error **errp) +QIOChannel *rdma_connect_outgoing(void *opaque, + InetSocketAddress *host_port, Error **er= rp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; @@ -3945,7 +3945,7 @@ void rdma_connect_outgoing(void *opaque, /* Avoid ram_block_discard_disable(), cannot change during migration. = */ if (ram_block_discard_is_required()) { error_setg(errp, "RDMA: cannot disable RAM discard"); - return; + return NULL; } =20 rdma =3D qemu_rdma_data_init(host_port, errp); @@ -3995,12 +3995,11 @@ void rdma_connect_outgoing(void *opaque, trace_rdma_connect_outgoing_after_rdma_connect(); =20 s->rdma_migration =3D true; - migration_outgoing_setup(rdma_new_output(rdma)); - migration_start_outgoing(s); - return; + return rdma_new_output(rdma); return_path_err: qemu_rdma_cleanup(rdma); err: g_free(rdma); g_free(rdma_return_path); + return NULL; } diff --git a/migration/rdma.h b/migration/rdma.h index 170c25cf44..8a6515f130 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,8 +21,8 @@ =20 #include "system/memory.h" =20 -void rdma_connect_outgoing(void *opaque, InetSocketAddress *host_port, - Error **errp); +QIOChannel *rdma_connect_outgoing(void *opaque, InetSocketAddress *host_po= rt, + Error **errp); =20 void rdma_connect_incoming(InetSocketAddress *host_port, Error **errp); =20 --=20 2.51.0