{"id":2177612,"url":"http://patchwork.ozlabs.org/api/patches/2177612/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20251226211930.27565-5-farosas@suse.de/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20251226211930.27565-5-farosas@suse.de>","list_archive_url":null,"date":"2025-12-26T21:19:06","name":"[RFC,04/25] migration: Move multifd_recv_setup call","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"96fbb518feae68cde0f696a983932b2ac6275840","submitter":{"id":85343,"url":"http://patchwork.ozlabs.org/api/people/85343/?format=json","name":"Fabiano Rosas","email":"farosas@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20251226211930.27565-5-farosas@suse.de/mbox/","series":[{"id":486505,"url":"http://patchwork.ozlabs.org/api/series/486505/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=486505","date":"2025-12-26T21:19:04","name":"migration: Cleanup early connection code","version":1,"mbox":"http://patchwork.ozlabs.org/series/486505/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2177612/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2177612/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=IdqFcZr5;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=AgPrkurx;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=FSHdoXdW;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=rYUldyIs;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)","smtp-out2.suse.de;\n dkim=pass header.d=suse.de header.s=susede2_rsa header.b=FSHdoXdW;\n dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=rYUldyIs"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ddJT66RmJz1y3s\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 27 Dec 2025 08:21:30 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vZFE5-0001Ip-S2; Fri, 26 Dec 2025 16:19:57 -0500","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1vZFDz-0001G4-LS\n for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:51 -0500","from smtp-out2.suse.de ([195.135.223.131])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1vZFDy-0003fg-7h\n for qemu-devel@nongnu.org; Fri, 26 Dec 2025 16:19:51 -0500","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 68CEE5BCCD;\n Fri, 26 Dec 2025 21:19:40 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5FE193EA63;\n Fri, 26 Dec 2025 21:19:39 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id cO1TCOv7TmnwJwAAD6G6ig\n (envelope-from <farosas@suse.de>); Fri, 26 Dec 2025 21:19:39 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1766783981;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=;\n b=IdqFcZr5+MPiPCj3VF4GetVymenoy3xda7zRqDSQinQp7V9TYtuKSFIrXoS1bP6GyVu/Mg\n WHIk9bR3RIx2WzhWm4WIhAZtJ5+Tzv0RRrHR+O1TqWyZrdvPigvTzh1YLt6G/w/Fcunc5r\n 5NBoJlacMBHKx+zmRLlsk1dxVlv36Ak=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1766783981;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=;\n b=AgPrkurx0ai7MdeK7XX7jSJhBAXX+nIp4NK6jhTPz0ARmT/QgoFTop6puPCJurlcEyfX1V\n JmXa/o99I6KeMnCw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1766783980;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=;\n b=FSHdoXdWE5tlwxyJeYbVKc3QhRYk1ZWNPKI1RF5YqiLpwpEAaURBGGoaO5llE3t/sRJD1r\n 5zp3WbUCRsKq5wF43k5O7RDKmmdqr+mskUYxGvyBqELJJTXvJzE8AeuhW/lppy0B92lHej\n 4YV+7DInzS7NiUni3YNWqHRbkoJlj2k=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1766783980;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=oCWOcmRaggOLrfO9cnMOTOEkRgtGI7Vl4EU7819u5a8=;\n b=rYUldyIslehrZlqLuVMqHA6hf0OOINny/BkwISjZeS4Pm3IXXOaxkYSIa+mGzHpHeUlcrm\n HC82OMoXyLFdQfDg=="],"From":"Fabiano Rosas <farosas@suse.de>","To":"qemu-devel@nongnu.org","Cc":"peterx@redhat.com","Subject":"[RFC PATCH 04/25] migration: Move multifd_recv_setup call","Date":"Fri, 26 Dec 2025 18:19:06 -0300","Message-ID":"<20251226211930.27565-5-farosas@suse.de>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20251226211930.27565-1-farosas@suse.de>","References":"<20251226211930.27565-1-farosas@suse.de>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Spam-Score":"-3.01","X-Rspamd-Queue-Id":"68CEE5BCCD","X-Spamd-Result":"default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%];\n NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[];\n R_MISSING_CHARSET(0.50)[];\n R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[];\n ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[];\n RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2];\n URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n RCPT_COUNT_TWO(0.00)[2];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n DKIM_TRACE(0.00)[suse.de:+]","X-Rspamd-Server":"rspamd1.dmz-prg2.suse.org","X-Rspamd-Action":"no action","Received-SPF":"pass client-ip=195.135.223.131; envelope-from=farosas@suse.de;\n 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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"The multifd_recv_setup() call is currently in a place where it will be\ncalled for every channel that appears. That doesn't make much\nsense.\n\nIt seems it was moved when the channel discovery mechanism was added\nback at commit 6720c2b327 (migration: check magic value for deciding\nthe mapping of channels, 2022-12-20). The original place was\nmigration_incoming_setup() which would run for just the main channel,\nbut it was discovered that the main channel might arrive after a\nmultifd channel.\n\nMove the call back to a place where it will be called only once.\n\nWith respect to cleanup, this new location at\nqemu_start_incoming_migration() has the same issue as the previous\ncallsite at migration_ioc_process_incoming(): no cleanup ever happens.\n\nThe error message goes from being emitted via error_report_err(), to\nbeing returned to the qmp_migrate_incoming() incoming command, which\nis arguably better, since this is setup code.\n\nSigned-off-by: Fabiano Rosas <farosas@suse.de>\n---\n migration/migration.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/migration/migration.c b/migration/migration.c\nindex 71efe945f6..974313944c 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -786,6 +786,10 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels,\n         return;\n     }\n \n+    if (multifd_recv_setup(errp) != 0) {\n+        return;\n+    }\n+\n     if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {\n         SocketAddress *saddr = &addr->u.socket;\n         if (saddr->type == SOCKET_ADDRESS_TYPE_INET ||\n@@ -1065,10 +1069,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)\n         channel = CH_POSTCOPY;\n     }\n \n-    if (multifd_recv_setup(errp) != 0) {\n-        return;\n-    }\n-\n     if (channel == CH_MAIN) {\n         f = qemu_file_new_input(ioc);\n         migration_incoming_setup(f);\n","prefixes":["RFC","04/25"]}