From nobody Mon Nov 23 04:26:30 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=1793299688; cv=none; d=zohomail.com; s=zohoarc; b=oKaw8+AVC3dZB2IgpKC6LCF1kVGC22g+3hxsEdZcJG8hlw4CRbJyvlv5v3ECnxFC/WbURs0PUmG9yDH1B4q1cy98mJNTz5IIOMaJ/EbkKsuw+bGUwIynH6CwdPla+2Bfba6lA11gcRVc8uqdigcHDjnRj6CKg1uFmTcoq5QKgD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299688; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k6NBGJzufmtbhbdPvtjxl8Tlabi1WpY93xHLXk8DHN0=; b=DkBMJdVODzBu0OSiIfVrp7URxDa4cymu9WvgmGTO1UDkKn6ZTjS4pyNbyUWFlSlX5BL3ZAoh8Phkqpi7G+x1Ro/9r4SWnEzMGWrZMd87Qb5eUGP1IcIs6VK7sPh8wuocC8vE0oj/dmWNIpo1TRSUmX0LACVblv2Mfc9MAq7URaA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793299688768988.8993769085818; Thu, 29 Oct 2026 11:48:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMVA9-0002hc-AL; Thu, 29 Oct 2026 14:47:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9Y-0002Vb-2W for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:10 -0400 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 1xMV9U-00022q-SI for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:07 -0400 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 635C31F813; Thu, 29 Oct 2026 18:47:03 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F00B013419; Thu, 29 Oct 2026 18:47:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cMnTJaOU42pwUgAAD6G6ig:T2 (envelope-from ); Thu, 29 Oct 2026 18:47:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6NBGJzufmtbhbdPvtjxl8Tlabi1WpY93xHLXk8DHN0=; b=j8LjqrIKLxAZYfv3ERQ0MlTvyB9OT+TNF2JZ88c0zi83L2unDIGwtSvAdntaJtmYu0dqQm O8q2yFmATwjQMhXox9xTnC5FSC/1Vwz2/etLSfGAeh9Xoq5reLFyyLG5xUp1hJboO3BLrm lpxvFhGNDL31aptZylzeoC80oM1zVT0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6NBGJzufmtbhbdPvtjxl8Tlabi1WpY93xHLXk8DHN0=; b=cLLOCSvtFmKckQZ1U2lJY1KHVfd8fWUsrr2BPEN3GorpIrokcLCcZrpOGrAOsSR3w8nv7/ c1opFbZGY7/rweDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6NBGJzufmtbhbdPvtjxl8Tlabi1WpY93xHLXk8DHN0=; b=j8LjqrIKLxAZYfv3ERQ0MlTvyB9OT+TNF2JZ88c0zi83L2unDIGwtSvAdntaJtmYu0dqQm O8q2yFmATwjQMhXox9xTnC5FSC/1Vwz2/etLSfGAeh9Xoq5reLFyyLG5xUp1hJboO3BLrm lpxvFhGNDL31aptZylzeoC80oM1zVT0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6NBGJzufmtbhbdPvtjxl8Tlabi1WpY93xHLXk8DHN0=; b=cLLOCSvtFmKckQZ1U2lJY1KHVfd8fWUsrr2BPEN3GorpIrokcLCcZrpOGrAOsSR3w8nv7/ c1opFbZGY7/rweDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , yuanminghao Subject: [PULL 1/8] migration: shorten dst snapshot load thread name Date: Thu, 29 Oct 2026 15:46:34 -0300 Message-ID: <20261029184641.1973813-2-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-11.80 / 50.00]; SUSE_INTERNAL_BYPASS(-9.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.996]; MIME_GOOD(-0.10)[text/plain]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(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_THREE(0.00)[3]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -11.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1793299692670154100 Content-Type: text/plain; charset="utf-8" From: yuanminghao pthread_setname_np() fails with ERANGE if the name is longer than 15 characters, so "mig/dst/snapshot_load" (21 characters) is rejected and the thread keeps its default name. Shorten it to "mig/dst/snapld" (15 characters) so the name is actually applied. Signed-off-by: yuanminghao Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.h b/migration/migration.h index 683bc7bdd52..1329f6bba48 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -42,7 +42,7 @@ #define MIGRATION_THREAD_DST_FAULT "mig/dst/fault" #define MIGRATION_THREAD_DST_LISTEN "mig/dst/listen" #define MIGRATION_THREAD_DST_PREEMPT "mig/dst/preempt" -#define MIGRATION_THREAD_DST_SNAPSHOT_LOAD "mig/dst/snapshot_load" +#define MIGRATION_THREAD_DST_SNAPSHOT_LOAD "mig/dst/snapld" =20 struct PostcopyBlocktimeContext; typedef struct ThreadPool ThreadPool; --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299735; cv=none; d=zohomail.com; s=zohoarc; b=a1l377iJiufH51kapiKGk5//N9zcGTAYPajX4xO2MguXMbGrR/z/Jip67xh+1ZPD1jbdQS9oq7skHyXCjOM3h/HLBKSXZLi2KTGvwhyXMDW3ETnXDv+3akGo20GlUqknCfq5A02U7rBPAZvGNGAibCt/pHpg5KI0FDW8EjAhvF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299735; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=woW40DGe5lOaMcPH0n5oiJG3Ps9Q0vcbBIpC5oKYV3A=; b=P30UnydJDx6igYy6p45JacBaZ3QC6RnTyJAh1QhlWO3Yn9ISpT3incFQV5JAMbKSLG71eZGf9Y4gf8ph/F2Seml8M4pWO8YYj8BY7vBCDnY5x0dwn2wFRnBQum8Z0uIXc5nG8/Wnck2BP5CMkY0LbVrbnPxkuUTqKMazTDhb1AY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793299735550136.88501918904183; Thu, 29 Oct 2026 11:48:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMVAL-0002st-3v; Thu, 29 Oct 2026 14:47:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9Z-0002Ve-C7 for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:12 -0400 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 1xMV9X-00022z-LG for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:09 -0400 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 7FA451F8C2; Thu, 29 Oct 2026 18:47: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 A2CC113419; Thu, 29 Oct 2026 18:47:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cMnTJaOU42pwUgAAD6G6ig:T3 (envelope-from ); Thu, 29 Oct 2026 18:47:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=woW40DGe5lOaMcPH0n5oiJG3Ps9Q0vcbBIpC5oKYV3A=; b=HKnmwb5sao3x19yqJF2StrL6S5M0ZizfCeOxhwGUIyHaAOBK0JCQKIUcYDqK0ZX8y8qlYS PvDZdul3v/VJCg9Nq+h1N/T+xgYqj7TajTPp/4rDy52WHMAk31nJMnHdpGSAOJhgJwRT5S jJ8dnhTRCDgSTaGF0oM9PNgtYtM7B7E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=woW40DGe5lOaMcPH0n5oiJG3Ps9Q0vcbBIpC5oKYV3A=; b=6vj+uC0oPNlfksSgTUQTPLNNaF1FQlYCgLUuyK/Aau19WeYVVQMR+QNrkjoTzjg6JURZnI oflPxPYNlbTM/QAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=HKnmwb5s; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=6vj+uC0o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=woW40DGe5lOaMcPH0n5oiJG3Ps9Q0vcbBIpC5oKYV3A=; b=HKnmwb5sao3x19yqJF2StrL6S5M0ZizfCeOxhwGUIyHaAOBK0JCQKIUcYDqK0ZX8y8qlYS PvDZdul3v/VJCg9Nq+h1N/T+xgYqj7TajTPp/4rDy52WHMAk31nJMnHdpGSAOJhgJwRT5S jJ8dnhTRCDgSTaGF0oM9PNgtYtM7B7E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=woW40DGe5lOaMcPH0n5oiJG3Ps9Q0vcbBIpC5oKYV3A=; b=6vj+uC0oPNlfksSgTUQTPLNNaF1FQlYCgLUuyK/Aau19WeYVVQMR+QNrkjoTzjg6JURZnI oflPxPYNlbTM/QAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 2/8] tests/migration-test: Add multifd+postcopy test for preempt recovery Date: Thu, 29 Oct 2026 15:46:35 -0300 Message-ID: <20261029184641.1973813-3-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 7FA451F8C2 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-12.01 / 50.00]; SUSE_INTERNAL_BYPASS(-9.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)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -12.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1793299738573154100 Content-Type: text/plain; charset="utf-8" From: Peter Xu We have one for TLS, but we don't have the non-TLS version. Add it. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/migration/postcopy-tests.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 13a57596551..6c4fd311529 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -89,6 +89,15 @@ static void test_multifd_postcopy_preempt(char *name, Mi= grateCommon *args) test_postcopy_common(args); } =20 +static void test_multifd_postcopy_preempt_recovery(char *name, + MigrateCommon *args) +{ + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_recovery_common(args, POSTCOPY_FAIL_NONE); +} + void migration_test_add_postcopy(MigrationTestEnv *env) { migration_test_add_postcopy_smoke(env); @@ -113,6 +122,8 @@ void migration_test_add_postcopy(MigrationTestEnv *env) test_multifd_postcopy); migration_test_add("/migration/multifd+postcopy/preempt/plain", test_multifd_postcopy_preempt); + migration_test_add("/migration/multifd+postcopy/preempt/recovery/p= lain", + test_multifd_postcopy_preempt_recovery); if (env->is_x86) { migration_test_add("/migration/postcopy/suspend", test_postcopy_suspend); --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299701; cv=none; d=zohomail.com; s=zohoarc; b=hHpooAS9r6IbzTwyNzjLCIPvAw8iLSnFT82YHYtHKvv7RXQ3UZ5u9nX4sxhHz1vgQOpVOTRy644q7qKh4MR2iDOw6y39w1HELvVQ1xS1XRxV9Q5bUeeNG2y7dr8ISSDZmyCtuxojjCfUXkAS/kE50iv70otQ+0O+I6T9xgsw3bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299701; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lRPCI0+9f4+ET29TuxOtVO6OQR9dJQ/KLWDDwh73GDU=; b=JvjLrHWnDu4dYoHRZfUKPnJ+Oymq6zmXU2JarG+Bu6hFFk7sPckt/6iybxQlJCjzZP+LhO+XTMbhp4esSlG0JJU2QGiYmy9LTDBI8ystWZ0cN988ky3hBLfc4j/OHjc9vQCASPk4ts/nktDgN3u6glBiV098V9A1MVezguoUdMY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179329970151172.28213129043775; Thu, 29 Oct 2026 11:48:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMV9l-0002Yn-Bh; Thu, 29 Oct 2026 14:47:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9Z-0002Vd-Bi for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:10 -0400 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 1xMV9W-00022w-RB for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:09 -0400 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 9A0DC22120; Thu, 29 Oct 2026 18:47: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 BE57B1342D; Thu, 29 Oct 2026 18:47: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 cMnTJaOU42pwUgAAD6G6ig:T4 (envelope-from ); Thu, 29 Oct 2026 18:47:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299625; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lRPCI0+9f4+ET29TuxOtVO6OQR9dJQ/KLWDDwh73GDU=; b=cew9X6KGNhCLO7BsbwPwUhjM/VfQWQ/NwDNQ/Y7XakKRlEa/sWZsrrjST+dJwG5px526nt nBTEclT1klctJRqT8ki+y1XcifEMzy0aHSiGULMvZV11WrcPBl2I/zonXarL836Jfm1VtF /t2NJWauTGLRDm5c5zDolKPanXcMc54= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299625; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lRPCI0+9f4+ET29TuxOtVO6OQR9dJQ/KLWDDwh73GDU=; b=vQjND4GH2EBFdt00orBLRxGz6TtZuEPODTf+l6wPMogxztnyuB3UeZovIt8g7qmBLDRGBQ AtzVle9W3mwcmtAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299625; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lRPCI0+9f4+ET29TuxOtVO6OQR9dJQ/KLWDDwh73GDU=; b=cew9X6KGNhCLO7BsbwPwUhjM/VfQWQ/NwDNQ/Y7XakKRlEa/sWZsrrjST+dJwG5px526nt nBTEclT1klctJRqT8ki+y1XcifEMzy0aHSiGULMvZV11WrcPBl2I/zonXarL836Jfm1VtF /t2NJWauTGLRDm5c5zDolKPanXcMc54= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299625; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lRPCI0+9f4+ET29TuxOtVO6OQR9dJQ/KLWDDwh73GDU=; b=vQjND4GH2EBFdt00orBLRxGz6TtZuEPODTf+l6wPMogxztnyuB3UeZovIt8g7qmBLDRGBQ AtzVle9W3mwcmtAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 3/8] migration: Add two more trace points for incoming channel mgmt Date: Thu, 29 Oct 2026 15:46:36 -0300 Message-ID: <20261029184641.1973813-4-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-11.80 / 50.00]; SUSE_INTERNAL_BYPASS(-9.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.996]; MIME_GOOD(-0.10)[text/plain]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -11.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=lists1p.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1793299704152154100 Content-Type: text/plain; charset="utf-8" From: Peter Xu We have trace points for both multifd channel and preempt channel when a new channel is established on the destination, but no main channel. We can normally deduce this by analyzing the socket channel tracepoints, but add one for debugging purpose so in a trace log we can see when all channels are established. Add one more for start / resume of incoming migration too. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- migration/migration.c | 3 +++ migration/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index fab7949fe11..3ffc0c2c6aa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -852,6 +852,7 @@ bool migration_incoming_setup(QIOChannel *ioc, uint8_t = channel, Error **errp) assert(!mis->from_src_file); mis->from_src_file =3D f; qemu_file_set_blocking(f, false, &error_abort); + trace_migration_main_channel_received(); break; =20 case CH_MULTIFD: @@ -918,6 +919,8 @@ static bool postcopy_try_recover(void) =20 void migration_start_incoming(void) { + trace_migration_start_incoming(); + if (postcopy_try_recover()) { return; } diff --git a/migration/trace-events b/migration/trace-events index db911fe6f2c..68bcf12dc71 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -200,6 +200,8 @@ postcopy_preempt_enabled(bool value) "%d" migration_precopy_complete(void) "" migration_call_notifiers(int type) "type=3D%d" migration_request_switchover_ack_legacy(const char *requester, unsigned in= t switchover_ack_pending_num_legacy) "Requester %s, switchover_ack_pending_= num_legacy %u" +migration_main_channel_received(void) "" +migration_start_incoming(void) "" =20 # migration-stats migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd, uint64_t= rdma) "qemu_file %" PRIu64 " multifd %" PRIu64 " RDMA %" PRIu64 --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299671; cv=none; d=zohomail.com; s=zohoarc; b=mEvMhAhUIBpaJiWAqChmb0ef5WxAP0M4YQ7mihaVdP++7EHwZFL+WqzjLvXWXnCFQpx1um5exh1WqfgEMZhGCHszqlZ7qN0urzyrsy2GPqVzS2J75WWWAx8fysZkRlT9lNScQ8M8uOHL622koWYnKW2cxVdzib1oGQVapfK4Izo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299671; h=Content-Type: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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H7/4Xkm20p/oU4VFP0hd0PtiijgH6QX2s7YyYWNnDLs=; b=grZW0RSSsPSTMu5NoSnEUVYriXrk5I6nF9eSBglA2rQGXLJK8DY3vwObZEWKU7MzJ0HbsVzzYkOyZd4IVfQZlld5A8QWzdutFeh4MFBoxWjxIPoCLHUF4q/2OCMDCpRGdRMxF2VGAncAQnw7+FoxJx1kTuc7CyPZ/o5HF44ANYg= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793299670894245.6238493278172; Thu, 29 Oct 2026 11:47:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMV9w-0002cf-E1; Thu, 29 Oct 2026 14:47:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9a-0002Vj-EN for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:15 -0400 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 1xMV9Y-000239-DX for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:09 -0400 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 E60F821F08; Thu, 29 Oct 2026 18:47:06 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D9D8B13419; Thu, 29 Oct 2026 18:47:05 +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 cMnTJaOU42pwUgAAD6G6ig:T5 (envelope-from ); Thu, 29 Oct 2026 18:47:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299627; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H7/4Xkm20p/oU4VFP0hd0PtiijgH6QX2s7YyYWNnDLs=; b=tFcH0FyIbu9KujH8zdxJy/d2M7zLl2EAVI2kJ5mJDAH6nnmDfy0FUnN54GIbDQ2OfasxSh gX1btkm39Kjn3nzq9xycfIbQNEUHEc9t6Rfl3nPku0zhB6+ajBEEup5nAbnxhVbxPQLqlP FlVNplwkEQInCTHYpF8yMpdv/I82FWo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299627; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H7/4Xkm20p/oU4VFP0hd0PtiijgH6QX2s7YyYWNnDLs=; b=XRxauJEd5w+0N/E/5ZbJ62ErM5Ti9kH+xX5y5i1MDPcBbU4mfk2AvmgVj7bSPNLU0u9aUN HB5YiLnXeK1Xd/AA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=vh8MCUug; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="Wy276cb/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H7/4Xkm20p/oU4VFP0hd0PtiijgH6QX2s7YyYWNnDLs=; b=vh8MCUugKTLguJFsdmjpn+DcFkbuxBLRYWBvVCDcYTem63HKxkJv+MnNhElXCt2kIOc4IK efjjkRDRspcoVwR+CY1zifs5lrGfTuGoNciDOifjvHMA6nMEeGrVvWK655VTRBMHquWg2y r8yj91036hN5+qoXgLshvua0TY3Ombk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H7/4Xkm20p/oU4VFP0hd0PtiijgH6QX2s7YyYWNnDLs=; b=Wy276cb/01taKqQO592FlPl8gEj7wkSkR5VU+gLSx/FDfH2aMFYE9+K0/f+szyiFkbWf0K UJxpfQNlCTFV63Cw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 4/8] migration: Fix socket listen backlog Date: Thu, 29 Oct 2026 15:46:37 -0300 Message-ID: <20261029184641.1973813-5-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: E60F821F08 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-12.51 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:email]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -12.51 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=lists1p.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1793299673720154100 From: Peter Xu QEMU incoming side may have set a wrong listen() backlog. After the support of multifd + postcopy now we have four possibilities on setting the backlog, some of them are wrong: Vanilla: 1 (correct) Multifd: N (wrong, should be N+1) Preempt: 2 (correct) Multifd+Preempt: N (wrong, should be N+2) No real report for this, found by code observation only. Logically the backlog (pending accept requests on destination on the listening sockets) needs to be the maximum of possible channels. Otherwise if the accept queue full on destination, source QEMU may hit connection errors. Cc: Daniel P. Berrang=C3=A9 Fixes: 0705e56496 ("multifd: Use number of channels as listen backlog") Fixes: e274188612 ("migration: enable multifd and postcopy together") Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas --- migration/socket.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/migration/socket.c b/migration/socket.c index f57f1a8e7c6..31bfa1eeebb 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -139,21 +139,32 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } =20 +static int socket_get_max_channels(void) +{ + /* The main channel is always wanted */ + int num =3D 1; + + if (migrate_multifd()) { + num +=3D migrate_multifd_channels(); + } + + if (migrate_postcopy_preempt()) { + /* The preempt channel */ + num +=3D 1; + } + + return num; +} + void socket_connect_incoming(SocketAddress *saddr, Error **errp) { QIONetListener *listener =3D qio_net_listener_new(); MigrationIncomingState *mis =3D migration_incoming_get_current(); size_t i; - int num =3D 1; + int num =3D socket_get_max_channels(); =20 qio_net_listener_set_name(listener, "migration-socket-listener"); =20 - if (migrate_multifd()) { - num =3D migrate_multifd_channels(); - } else if (migrate_postcopy_preempt()) { - num =3D RAM_CHANNEL_MAX; - } - if (qio_net_listener_open_sync(listener, saddr, num, errp) < 0) { object_unref(OBJECT(listener)); return; --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299704; cv=none; d=zohomail.com; s=zohoarc; b=OV+/T/Q4m8i1OLEpbTIolHs1wEaQIN+iD/00ViKCd+dtxPmklVs2gXKmTgFpPvXTIT//NDmmZemyajzYs9OzPhwD7PIB3bK2sRMeeFV1u25yR4ssPhWoaVxGbPaHgMnucBmiQlOM19xVjEHUmtNeTAqQaz8lmYE6zm0U+o29Ono= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299704; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=abqJJXaGGpMxrTTz4LNv0nEat57E5J8kh+2eC1Qx7y8=; b=VePUX73c4smZ5dXSaL5xk+wg/+VjDvWKPg+dbOj5ZS2N83AWOFBG5PZoVUv8UQrKBgNQcoxAdarL15rVm42TMS9wnpK2POXoxcslXUZPbvkPJUhkPQq9riYyx99nCvOjy+0MORFAMG9CMGGZsgAiOj1pzzDbORvLafFmtKlwgCY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793299704599842.8153829753697; Thu, 29 Oct 2026 11:48:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMVA3-0002gS-Ua; Thu, 29 Oct 2026 14:47:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9d-0002Vz-RM for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:15 -0400 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 1xMV9a-00023g-Ew for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:13 -0400 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 0D1731FAA3; Thu, 29 Oct 2026 18:47:08 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2F3C713419; Thu, 29 Oct 2026 18:47: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 cMnTJaOU42pwUgAAD6G6ig:T6 (envelope-from ); Thu, 29 Oct 2026 18:47:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abqJJXaGGpMxrTTz4LNv0nEat57E5J8kh+2eC1Qx7y8=; b=nxQRRj+RKAfndZ80dRkCHQyb2y5tM+tLzX3JT/VezVIVgh2sPvC/2mrBfpUPrVnEyDKYfv 37KvA09F09i8ZJ93WQnR12XLCRvJW5GoENSq8QkV9K0/Lv67BPqKQuKEhdaVuDQq3tEwhP aL3Ds72YDAve0jQ7RMlojMEHpILrNMk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abqJJXaGGpMxrTTz4LNv0nEat57E5J8kh+2eC1Qx7y8=; b=X2bZ8PODmJ/LcKfy9cK5O/iKDFOiaul1PirJareJgZwbThudXjHZLGgK+zptzbPDvkqiUd ckrGDA6frZZ4okCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=AA8bRlm9; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UqDhJ+qH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abqJJXaGGpMxrTTz4LNv0nEat57E5J8kh+2eC1Qx7y8=; b=AA8bRlm9P3EeKwXP2grltD48ztLXIO9q9isAXno1K3nzxNNQS+ROpL3uQ/LjrLXUWnJCZM mAa9VYGLc+68NtWKIrl2yrZF6i+UFFnt31dRnEHQDq2ql8+5zxONcQJvR3KuJl1bRJJv9T 6UccIDByJ1yE60KR/L2Ct89jybFb+wQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abqJJXaGGpMxrTTz4LNv0nEat57E5J8kh+2eC1Qx7y8=; b=UqDhJ+qHbPlPP3fp+wVwKFY7mxxdY32QzXROBGPRYqEsNF4S7aVeFzoBoJMq5mJ69fn/cW FhdDnnBU/nJZafBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 5/8] migration: Split migration_channel_process_incoming() Date: Thu, 29 Oct 2026 15:46:38 -0300 Message-ID: <20261029184641.1973813-6-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-12.01 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:dkim]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -12.01 X-Rspamd-Queue-Id: 0D1731FAA3 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1793299706159154100 Content-Type: text/plain; charset="utf-8" From: Peter Xu Introduce two smaller functions for it, - migration_incoming_channel_install(): peek at channels whenever possible, and install the channel to one of the slots (main, multifd, preempt) - migration_incoming_error_propagate(): handling an error happened during channel establish phase of an incoming migration. When at it, move the set channel tracepoint into the 1st helper, replacing the existing tracepoint with trace_migration_channel_process_incoming(). So far, they should fire almost the same time if the channel peek worked. This fact will change in follow up refactorings. I also moved migration_ioc_register_yank() to be after identify, hopefully it makes more sense: we'd better be careful on registration of yank, or we should be prepared for explosions. Previously it worked, my guess is when error happens we never unregister yank but hang dest QEMU or quit, depending on exit_on_error value. No real functional change intended. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- migration/channel.c | 57 +++++++++++++++++++++++++++++------------- migration/trace-events | 1 + 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 266ae8f7760..8407ea46cb8 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -197,6 +197,42 @@ out: return channel; } =20 +static void migration_incoming_error_propagate(MigrationIncomingState *mis, + Error *error) +{ + error_report_err(error); + migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED); + if (mis->exit_on_error) { + exit(EXIT_FAILURE); + } +} + +static bool migration_incoming_channel_install(MigrationIncomingState *mis, + QIOChannel *ioc, + Error **errp) +{ + MigChannelType ch =3D migration_channel_identify(mis, ioc, errp); + + if (!ch) { + assert(*errp); + return false; + } + + trace_migration_set_incoming_channel(ioc, + object_get_typename(OBJECT(ioc))); + migration_ioc_register_yank(ioc); + + if (migration_incoming_setup(ioc, ch, errp)) { + migration_start_incoming(); + } + + if (*errp) { + return false; + } + + return true; +} + /** * @migration_channel_process_incoming - Create new incoming migration cha= nnel * @@ -209,31 +245,18 @@ void migration_channel_process_incoming(QIOChannel *i= oc) { MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; - MigChannelType ch; =20 - trace_migration_set_incoming_channel( + trace_migration_channel_process_incoming( ioc, object_get_typename(OBJECT(ioc))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { migration_tls_channel_process_incoming(ioc, &local_err); } else { - migration_ioc_register_yank(ioc); - ch =3D migration_channel_identify(mis, ioc, &local_err); - if (!ch) { - goto out; - } - - if (migration_incoming_setup(ioc, ch, &local_err)) { - migration_start_incoming(); - } + migration_incoming_channel_install(mis, ioc, &local_err); } -out: + if (local_err) { - error_report_err(local_err); - migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED= ); - if (mis->exit_on_error) { - exit(EXIT_FAILURE); - } + migration_incoming_error_propagate(mis, local_err); } } =20 diff --git a/migration/trace-events b/migration/trace-events index 68bcf12dc71..c93c9f9e750 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -207,6 +207,7 @@ migration_start_incoming(void) "" migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd, uint64_t= rdma) "qemu_file %" PRIu64 " multifd %" PRIu64 " RDMA %" PRIu64 =20 # channel.c +migration_channel_process_incoming(void *ioc, const char *ioctype) "ioc=3D= %p ioctype=3D%s" 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) "ioc=3D%p i= octype=3D%s" =20 --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299670; cv=none; d=zohomail.com; s=zohoarc; b=NlXukA/UNHFgkfluiQKsMGoz/Z6GhMC1/YqYCvOFgE2WxvCp+ic98NKsajb6NTHAEpOmvIQU9pAoY1d1LmSi2MSBvuxoSFbMUS9mWhEWzgNwAjQ2tpBb88dfYzqbv9td0iGTuzB/XM4aBNnXDw/UXztkLsjhu0bFXgnqBV1hgPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299670; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pPN03CRQU8TXN2+fdlS1/hfeqTcY6ydjhZLZkENKmf4=; b=h3Eh+fChtQPL326l1PdSmdWyjR2AMh+2uM84DLi1u+5mY1AhjQgZu7QWnGTF2XflnNGzzDD2cQClnZDOv3CuebqaX8PZXM7e/pK4p1xx/1KHesMthCZcaGQSOnD7I/139vzR0NVBWH0sPmc+BKpUpALBbXO+nmdSd65jnLBFLFY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17932996707035.469532788316769; Thu, 29 Oct 2026 11:47:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMV9n-0002ZV-BT; Thu, 29 Oct 2026 14:47:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9d-0002W0-Ot for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:15 -0400 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 1xMV9c-00023e-1g for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:13 -0400 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 274FA22222; Thu, 29 Oct 2026 18:47: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 4A2671342D; Thu, 29 Oct 2026 18:47:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cMnTJaOU42pwUgAAD6G6ig:T7 (envelope-from ); Thu, 29 Oct 2026 18:47:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pPN03CRQU8TXN2+fdlS1/hfeqTcY6ydjhZLZkENKmf4=; b=BMrfmpO8bgJR8kWyBTnhOA3PVIFXE8J7N00RogfQf8/77Abxepg6eciPQt+b1kOMXYUH0h peaJNKd41Te4vTSYBMH0iNoyaSdg24U/xwC0dqAXrIVW2Vy+awz3jrCFcZtLAwQTr5+2rK Q4Q23GWubeoDoRq5eJl/de7Q+zff6E4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pPN03CRQU8TXN2+fdlS1/hfeqTcY6ydjhZLZkENKmf4=; b=v4/zaKchCVRUfmhTYiS1+cxJhVjaAR0ScJUTY2XGo6kMeSed8XBtIH8hX9j/ssgf3xtany Lr5hvLhwwVZctOAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pPN03CRQU8TXN2+fdlS1/hfeqTcY6ydjhZLZkENKmf4=; b=BMrfmpO8bgJR8kWyBTnhOA3PVIFXE8J7N00RogfQf8/77Abxepg6eciPQt+b1kOMXYUH0h peaJNKd41Te4vTSYBMH0iNoyaSdg24U/xwC0dqAXrIVW2Vy+awz3jrCFcZtLAwQTr5+2rK Q4Q23GWubeoDoRq5eJl/de7Q+zff6E4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pPN03CRQU8TXN2+fdlS1/hfeqTcY6ydjhZLZkENKmf4=; b=v4/zaKchCVRUfmhTYiS1+cxJhVjaAR0ScJUTY2XGo6kMeSed8XBtIH8hX9j/ssgf3xtany Lr5hvLhwwVZctOAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 6/8] migration: Dump type of channel in set_incoming_channel tracepoint Date: Thu, 29 Oct 2026 15:46:39 -0300 Message-ID: <20261029184641.1973813-7-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-11.80 / 50.00]; SUSE_INTERNAL_BYPASS(-9.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.996]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[suse.de:email,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -11.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=lists1p.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1793299673003158500 Content-Type: text/plain; charset="utf-8" From: Peter Xu Add this info to be crystal clear on what channel we're installing. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- migration/channel.c | 10 +++++++++- migration/channel.h | 3 ++- migration/trace-events | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 8407ea46cb8..b9065efd03f 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -34,6 +34,13 @@ #include "trace.h" #include "yank_functions.h" =20 +static const char *const mig_channel_str[CH_NUM] =3D { + [CH_NONE] =3D "NONE", + [CH_MAIN] =3D "MAIN", + [CH_MULTIFD] =3D "MULTIFD", + [CH_POSTCOPY] =3D "PREEMPT", +}; + void migration_connect_outgoing(MigrationState *s, MigrationAddress *addr, Error **errp) { @@ -219,7 +226,8 @@ static bool migration_incoming_channel_install(Migratio= nIncomingState *mis, } =20 trace_migration_set_incoming_channel(ioc, - object_get_typename(OBJECT(ioc))); + object_get_typename(OBJECT(ioc)), + mig_channel_str[ch]); migration_ioc_register_yank(ioc); =20 if (migration_incoming_setup(ioc, ch, errp)) { diff --git a/migration/channel.h b/migration/channel.h index a7d0d290586..678712f2919 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -24,7 +24,8 @@ typedef enum { CH_NONE, CH_MAIN, CH_MULTIFD, - CH_POSTCOPY + CH_POSTCOPY, + CH_NUM, } MigChannelType; =20 void migration_channel_process_incoming(QIOChannel *ioc); diff --git a/migration/trace-events b/migration/trace-events index c93c9f9e750..8840d82f8dc 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -208,7 +208,7 @@ migration_transferred_bytes(uint64_t qemu_file, uint64_= t multifd, uint64_t rdma) =20 # channel.c migration_channel_process_incoming(void *ioc, const char *ioctype) "ioc=3D= %p ioctype=3D%s" -migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" +migration_set_incoming_channel(void *ioc, const char *ioctype, const char = *type) "ioc=3D%p ioctype=3D%s type=3D%s" migration_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" =20 # global_state.c --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299671; cv=none; d=zohomail.com; s=zohoarc; b=QB7pv6hP7RMO6SC86SDJww6QJMxBucI1uDc//rpRF6vkkM+chlklEr0Pyl+xl/ijIeTLjOSYI1dDK8/ZNLohSICmgpzldpb2lsCc2Uoy/SaPHuBOUuNh6mNj0xKe26q0rhHTKRzjFsWDGM/1zYVSpvC8MzL2235hz/IIqYv2YBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299671; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ixt6qsrnoC75v52xyVn338JuQ7nZoHJY06HSwPVgNVw=; b=CM/ciC/NH5by0OX23CZJrW7HzNoa7SLQ30+qe0+gREBBq14gMpkS1RRe2PQs6/6pvRzZZIaQZy9Uc09VNXjsEdvPuqfqf1M2Kb1K4/pclKaRCbwR3XsWS9VKoMa+Q47RueS5gB5Z/5MHMtPHfu8S8Cm3M4HPz5x9O344cHmfF/k= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793299671545752.8136113822509; Thu, 29 Oct 2026 11:47:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMVA0-0002et-9K; Thu, 29 Oct 2026 14:47:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9h-0002XX-PD for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:19 -0400 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 1xMV9c-00023r-K9 for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:17 -0400 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 5338E22225; Thu, 29 Oct 2026 18:47: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 68AB31342D; Thu, 29 Oct 2026 18:47: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 cMnTJaOU42pwUgAAD6G6ig:T8 (envelope-from ); Thu, 29 Oct 2026 18:47:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ixt6qsrnoC75v52xyVn338JuQ7nZoHJY06HSwPVgNVw=; b=0hRlYgfmHTHySy71VV4zoPoKcdrkoL30XnIW/rzeDyDSQJPu7WVVGktTm/+dylq5vohpzA Dwfp0p41EJ6whUoqXYrrgvLmUcE2J8CEGGpPw3UlUmA/IqxcYdHyecvGy0tQrXVeYXvxdK 7fakTdvB1fSu7yPeZLOnKV/v8GEV1Fw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ixt6qsrnoC75v52xyVn338JuQ7nZoHJY06HSwPVgNVw=; b=isl/3Cp0Ib0RDKk6+nBkdQ8U39Lf1VKa1Fvuw8qDtommo7I8LuffRAHmQGNuEzRafmgQK6 uuF8jrrQnVOXwVBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ixt6qsrnoC75v52xyVn338JuQ7nZoHJY06HSwPVgNVw=; b=0hRlYgfmHTHySy71VV4zoPoKcdrkoL30XnIW/rzeDyDSQJPu7WVVGktTm/+dylq5vohpzA Dwfp0p41EJ6whUoqXYrrgvLmUcE2J8CEGGpPw3UlUmA/IqxcYdHyecvGy0tQrXVeYXvxdK 7fakTdvB1fSu7yPeZLOnKV/v8GEV1Fw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ixt6qsrnoC75v52xyVn338JuQ7nZoHJY06HSwPVgNVw=; b=isl/3Cp0Ib0RDKk6+nBkdQ8U39Lf1VKa1Fvuw8qDtommo7I8LuffRAHmQGNuEzRafmgQK6 uuF8jrrQnVOXwVBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Juraj Marcin Subject: [PULL 7/8] migration: Fix incoming channel race with multifd and preempt_pre_7_2 Date: Thu, 29 Oct 2026 15:46:40 -0300 Message-ID: <20261029184641.1973813-8-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-11.80 / 50.00]; SUSE_INTERNAL_BYPASS(-9.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]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,atlassian.net:url]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -11.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1793299672992158500 Content-Type: text/plain; charset="utf-8" From: Peter Xu PROBLEM =3D=3D=3D=3D=3D=3D=3D Migration reliably hangs with old machine types (7.2-) when these migration capabilities are enabled: multifd, postcopy-ram, postcopy-preempt. Simplest reproducer : $ QTEST_QEMU_MACHINE_TYPE=3Dpc-q35-7.2 \ QTEST_QEMU_BINARY=3D./qemu-system-x86_64 \ ./tests/qtest/migration-test --full \ -r /x86_64/migration/multifd+postcopy/preempt/plain Current workaround is to kill destination QEMU, cancel the migration on source (with/without yank), disable one or more of the features, and retry. The hang is caused by receiving preempt channel before most of the multifd channels, the peek buffer operation will stuck forever. Incoming side QEMU hang (with relevant tracepoints enabled): migrate_set_state new state setup migration_socket_incoming_accepted migration_set_incoming_channel ioc=3D0x557d82c1caa0 ioctype=3Dqio-channel= -socket migration_socket_incoming_accepted migration_set_incoming_channel ioc=3D0x557d83023840 ioctype=3Dqio-channel= -socket multifd_recv_new_channel channel 1 migration_socket_incoming_accepted migration_set_incoming_channel ioc=3D0x557d830c08c0 ioctype=3Dqio-channel= -socket multifd_recv_new_channel channel 0 multifd_recv_thread_start 1 migration_socket_incoming_accepted migration_set_incoming_channel ioc=3D0x557d8284a010 ioctype=3Dqio-channel= -socket multifd_recv_thread_start 0 multifd_recv_unfill channel 0 packet_num 0 flags 0x1 next packet size 0 multifd_recv_unfill channel 1 packet_num 1 flags 0x1 next packet size 0 [dest qemu hangs here] Incoming side backtrace: __syscall_cancel_arch __internal_syscall_cancel __syscall_cancel recvmsg qio_channel_socket_readv qio_channel_readv_full migration_channel_read_peek migration_channel_identify migration_channel_process_incoming socket_accept_incoming_migration qio_net_listener_channel_func qio_channel_fd_source_dispatch g_main_context_dispatch_unlocked.lto_priv g_main_context_dispatch glib_pollfds_poll os_host_main_loop_wait main_loop_wait qemu_main_loop qemu_default_main main This patch tries to fix it, from incoming side first. This patch alone should enable single-direction migration to this new QEMU. The next patch will propose a fix for the outgoing path, fixing new->old migrations. BACKGROUND =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D preempt_pre_7_2 used to be a flag marking QEMU releases 7.1/7.2 only because they have a flaw on channel establishment on preempt channel. Now, after we have multifd + postcopy support, new QEMU binaries can migrate old machine types with both features enabled. Juraj reported constant migration hang at the very beginning for those old machine types in our downstream systems with such setup. Juraj found it's because of this flag. QEMU source initiates channels in this order on current master when both features enabled with postcopy-preempt mode (machine type 7.2, implies preempt_pre_7_2=3Don): - First, main channel connect() happens, - Second, postcopy_preempt_setup() invokes connect() for preempt channel, - Last, in migration_thread(), multifd_send_setup() invokes connect()s for all the multifd channels However on an old QEMU, it expect the channels arrive in order of "main"->"multifd"->"preempt". Even on a new QEMU, the destination expects the same order of arrival on the channels when the channels are not peekable. For peekable channels (non-tls sockets), this time we'll likely see preempt channel appearing very soon, peeking at it causing main thread hang, like mentioned in the PROBLEM section above. SOLUTION =3D=3D=3D=3D=3D=3D=3D=3D One major problem of current hang is we try to peek at preempt channel, which offers nothing at the beginning. Since we'll need to accept stream from old binaries (QEMU 10.1 to 11.1), arrival of preempt channel early is unavoidable. What we can do, though, is to allow concurrent monitoring of all channels rather than one. Meanwhile, we shouldn't peek at anything that has no data. migration_channel_read_peek() almost does the wait, but it's too late. This patch proposes to watch all channels from the start without reading at them at all, relying on an IO watch attached. This will make sure (1) for preempt channel, we never read on it (watch can be gracefully disarmed when we know it's preempt channel later) (2) since we have one IO watch for each channel, then we can allow accept() to happen in almost any order, process only when there's some header to read. To maintain these watches, a new GArray @channels_early is introduced, with each element to be a (ioc, GSource) tuple (@MigEarlyIncomingChannel), so that QEMU can manage all the IO watches later with it. Here I used GSource rather than io_tag because the GSource may or may not be attached to the default main thread gcontext: when OOB is used, it may be the iothread context instead. IOW, g_source_remove() on io_tags stops working, which only works for default main context. The trick this patch used is when we have the ability to wait on all channel headers at the same time, we pick one by one from main and multifd channels (since both of the types will contain headers dumped right at the very beginning), leave preempt channel alone. It means, after dest QEMU finds all main and multifd channels, there are three possibilities: - If preempt not enabled, we finished full channel establishment, done. - If preempt enabled, - If we have one registered IO watch with the IOC, it must be the preempt channel, - If we have no further IO watch, wait for the next accept(), which must be the preempt channel. This will make channel establish work on incoming side even with the old QEMU binaries. While working on it, I managed to refactor the peeking logic quite a bit: we used to have a very convoluted migration_channel_identify() function, taking care of two different cases: (1) when the channel is peekable (like normal socket channels), (2) when the channel is not peekable (like TLS or file migrations). This patch refactored that part to make it crystal clear on how we make decisions on which channel is which, and split the peek/identify paths. One example incoming migration from pc-q35-7.2 after this patch applied, and with relevant tracepoints set (8 multifd channels, 1 preempt channel): migrate_set_state new state setup migration_channel_process_incoming ioc=3D0x557dc8af4e20 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc8af4e20 ioctype=3Dqio-chann= el-socket migration_channel_process_incoming ioc=3D0x557dc8abc5d0 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc8abc5d0 ioctype=3Dqio-chann= el-socket migration_channel_process_incoming ioc=3D0x557dc953d680 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc953d680 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc8abc5d0 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_channel_process_incoming ioc=3D0x557dc898a820 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc898a820 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc953d680 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_channel_process_incoming ioc=3D0x557dc919bd70 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc919bd70 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc898a820 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_channel_process_incoming ioc=3D0x557dc8734b20 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc8734b20 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc919bd70 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_channel_process_incoming ioc=3D0x557dc898bdf0 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc898bdf0 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc8734b20 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_channel_process_incoming ioc=3D0x557dc968cfd0 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc968cfd0 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc898bdf0 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_channel_process_incoming ioc=3D0x557dc8c31810 ioctype=3Dqio-cha= nnel-socket migration_incoming_channel_watch ioc=3D0x557dc8c31810 ioctype=3Dqio-chann= el-socket migration_set_incoming_channel ioc=3D0x557dc968cfd0 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_set_incoming_channel ioc=3D0x557dc8c31810 ioctype=3Dqio-channel= -socket type=3DMULTIFD migration_set_incoming_channel ioc=3D0x557dc8af4e20 ioctype=3Dqio-channel= -socket type=3DMAIN migration_start_incoming migrate_set_state new state active migration_channel_process_incoming ioc=3D0x557dc8966160 ioctype=3Dqio-cha= nnel-socket migration_set_incoming_channel ioc=3D0x557dc8966160 ioctype=3Dqio-channel= -socket type=3DPREEMPT While at it, I renamed the four channel incoming/outgoing tracepoints, make all to follow migration_[incoming|outgoing]_channel_*(). Especially for incoming, then we can enable migration_incoming_channel* for incoming channel debuggings. FINAL NOTE ON TLS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Note that this solution isn't a magic bullet fixing everything. TLS is not fixable with this approach because TLS isn't peekable channel, hence the watch won't help. We can have other ways to hack it to make it work, e.g. we can make TLS channels peekable too, but I don't want to pollute the TLS iochannel only for this: let's hope handshake will arrive soon so we can drop these code. For now, when TLS is involved with such old machine type (7.2-), one needs to migrate it out with any combination of features except enabling all four (multifd + TLS + postcopy + preempt) to a patched binary, after that, all combinations will start working. BugLink: https://redhat.atlassian.net/browse/RHEL-254933 Fixes: e27418861288 ("migration: enable multifd and postcopy together") Reported-by: Juraj Marcin Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- migration/channel.c | 417 ++++++++++++++++++++++++++++++++++------- migration/channel.h | 3 + migration/migration.c | 31 ++- migration/migration.h | 35 ++++ migration/trace-events | 7 +- 5 files changed, 420 insertions(+), 73 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index b9065efd03f..1aeb8814858 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -12,6 +12,8 @@ =20 #include "qemu/osdep.h" #include "qemu/cutils.h" +#include "qemu/main-loop.h" +#include "qemu/error-report.h" #include "channel.h" #include "exec.h" #include "fd.h" @@ -146,61 +148,81 @@ bool migration_has_all_channels(void) return true; } =20 -static MigChannelType migration_channel_identify(MigrationIncomingState *m= is, - QIOChannel *ioc, Error **= errp) +static bool qio_channel_is_peekable(QIOChannel *ioc) +{ + return qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK); +} + +/* + * With multiple channels, it is possible that we receive channels out of + * order on destination side, causing incorrect mapping of source channels + * on destination side. + * + * When the channel is peekable (e.g. non-TLS socket channels), 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. + * + * Returns: >0 if success, =3D=3D0 (CH_NONE) if error. If error happened, + * *errp must be set. + */ +static MigChannelType migration_channel_peek(MigrationIncomingState *mis, + QIOChannel *ioc, + Error **errp) { MigChannelType channel =3D CH_NONE; uint32_t channel_magic =3D 0; int ret =3D 0; =20 - 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; - } + assert(qio_channel_is_peekable(ioc)); =20 - 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"); - } + ret =3D migration_channel_read_peek(ioc, (void *)&channel_magic, + sizeof(channel_magic), errp); + if (ret !=3D 0) { + /* Failed */ + return channel; + } + + 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_magic); + } + + return channel; +} + +/* + * Returns: >0 if success, =3D=3D0 (CH_NONE) if error. If error happened, + * *errp must be set. NOTE: preempt channel is done separately. + */ +static MigChannelType migration_channel_identify(MigrationIncomingState *m= is, + QIOChannel *ioc, Error **= errp) +{ + MigChannelType channel =3D CH_NONE; + + if (!mis->from_src_file) { + channel =3D CH_MAIN; + } else if (migrate_multifd()) { + /* + * Non-peekable channels like tls/file are processed as + * multifd channels when multifd is enabled. + */ + channel =3D CH_MULTIFD; } else { - assert(migrate_postcopy_preempt()); - channel =3D CH_POSTCOPY; + error_setg(errp, "Unexpected non-peekable channel observed"); } =20 -out: return channel; } =20 @@ -214,33 +236,264 @@ static void migration_incoming_error_propagate(Migra= tionIncomingState *mis, } } =20 +/* Must be with mis->channels_early.mutex held */ +static void +migration_incoming_early_channel_insert(MigrationIncomingState *mis, + QIOChannel *ioc, + GSource *source) +{ + MigEarlyIncomingChannel chan =3D { + .source =3D source, + .ioc =3D ioc, + }; + + object_ref(OBJECT(ioc)); + g_source_ref(source); + + g_array_append_val(mis->channels_early.channels, chan); +} + +static void migration_incoming_early_channel_free(GArray *channels, int i) +{ + MigEarlyIncomingChannel *chan; + + chan =3D &g_array_index(channels, MigEarlyIncomingChannel, i); + + g_source_destroy(chan->source); + g_source_unref(chan->source); + object_unref(OBJECT(chan->ioc)); + + g_array_remove_index_fast(channels, i); +} + +/* + * Remove this channel from the monitoring of @channels_early array. + * Return true if found and successful, false otherwise. + */ +static bool +migration_incoming_early_channel_remove(MigrationIncomingState *mis, + QIOChannel *ioc) +{ + GArray *channels =3D mis->channels_early.channels; + MigEarlyIncomingChannel *chan; + int i; + + QEMU_LOCK_GUARD(&mis->channels_early.mutex); + + for (i =3D 0; i < channels->len; i++) { + chan =3D &g_array_index(channels, MigEarlyIncomingChannel, i); + if (chan->ioc !=3D ioc) { + continue; + } + migration_incoming_early_channel_free(channels, i); + return true; + } + + return false; +} + +void migration_incoming_free_early_channels(MigrationIncomingState *mis) +{ + GArray *channels =3D mis->channels_early.channels; + + QEMU_LOCK_GUARD(&mis->channels_early.mutex); + + while (channels->len) { + migration_incoming_early_channel_free(channels, 0); + } +} + +static bool migration_incoming_setup_channel(QIOChannel *ioc, + MigChannelType ch, + Error **errp) +{ + trace_migration_incoming_channel_set(ioc, + object_get_typename(OBJECT(ioc)), + mig_channel_str[ch]); + migration_ioc_register_yank(ioc); + + return migration_incoming_setup(ioc, ch, errp); +} + static bool migration_incoming_channel_install(MigrationIncomingState *mis, QIOChannel *ioc, + MigChannelType ch, Error **errp) { - MigChannelType ch =3D migration_channel_identify(mis, ioc, errp); - - if (!ch) { - assert(*errp); + if (!migration_incoming_setup_channel(ioc, ch, errp)) { return false; } =20 - trace_migration_set_incoming_channel(ioc, - object_get_typename(OBJECT(ioc)), - mig_channel_str[ch]); - migration_ioc_register_yank(ioc); - - if (migration_incoming_setup(ioc, ch, errp)) { + /* Installation succeeded, kickoff migration if needed */ + if (migration_has_main_and_multifd_channels()) { migration_start_incoming(); } =20 - if (*errp) { - return false; - } - return true; } =20 +static void +migration_incoming_channel_preempt_setup(QIOChannel *ioc) +{ + assert(migrate_postcopy_preempt()); + /* Installation of preempt channel should never fail */ + migration_incoming_setup_channel(ioc, CH_POSTCOPY, &error_abort); +} + +static void +migration_incoming_detect_preempt_channel(MigrationIncomingState *mis) +{ + GArray *channels =3D mis->channels_early.channels; + MigEarlyIncomingChannel *chan; + + QEMU_LOCK_GUARD(&mis->channels_early.mutex); + + /* When preempt mode not enabled, nothing to detect.. */ + if (!migrate_postcopy_preempt()) { + /* + * .. but if we found something pending, throw an error only, which + * should not happen. Even if it happens, resources will still be + * released after incoming migration is completedly. + */ + if (channels->len) { + error_report("%s: Found %u unused channels", + __func__, channels->len); + } + return; + } + + /* Preempt channel hasn't yet arrived? Process it later */ + if (!channels->len) { + return; + } + + /* + * More than one channel should never happen.. capture it in case if + * it happens, then there's not much we can do. + */ + if (channels->len > 1) { + error_report("%s: Found %u unused channels, " + "can't identify preempt channel", + __func__, channels->len); + return; + } + + assert(channels->len =3D=3D 1); + /* This is the preempt channel, install it directly */ + chan =3D &g_array_index(channels, MigEarlyIncomingChannel, 0); + migration_incoming_channel_preempt_setup(chan->ioc); + migration_incoming_early_channel_free(channels, 0); +} + +static gboolean migration_incoming_channel_readable(QIOChannel *ioc, + GIOCondition condition, + gpointer opaque) +{ + MigrationIncomingState *mis =3D opaque; + Error *local_err =3D NULL; + MigChannelType ch; + + /* + * No need to monitor this channel anymore as long as anything arrived, + * remove it from tracking. + * + * NOTE: this means if partial data arrived we may still block here, + * but it shouldn't happen in production, only malicious stream. Since + * migration stream is trusted (either due to trusted network, or TLS), + * that's non-issue. + * + * NOTE2: it's theoretically possible that this entry is gone reaching + * here. Example: the main thread is doing incoming cleanup having this + * one removed, while this watch can be registered on the monitor + * iothread's context and fired at the exact same time but in the + * iothread instead. If it happens, skip the rest. I'm not sure if + * this could happen at all, may depend on iothread lifespan management + * in the main thread, but be prepared. + */ + if (!migration_incoming_early_channel_remove(mis, ioc)) { + goto out; + } + + ch =3D migration_channel_peek(mis, ioc, &local_err); + if (!ch) { + goto out; + } + + if (!migration_incoming_channel_install(mis, ioc, ch, &local_err)) { + goto out; + } + + if (migration_has_main_and_multifd_channels()) { + /* + * Possibilities when reaching here: + * + * (1) if preempt not enabled, this should be no-op, all done, + * (2) if preempt enabled, + * (2.a) preempt channel arrived @channels_early, handle it now + * (2.b) preempt channel not arrived, to be handled in + * migration_channel_process_incoming() later + */ + migration_incoming_detect_preempt_channel(mis); + } + +out: + if (local_err) { + migration_incoming_error_propagate(mis, local_err); + } + + /* + * NOTE: we should have already detached the GSource, returning + * G_SOURCE_REMOVE to be logically consistent only. + */ + return G_SOURCE_REMOVE; +} + +static void migration_incoming_channel_watch(MigrationIncomingState *mis, + QIOChannel *ioc) +{ + GMainContext *context =3D g_main_context_get_thread_default(); + GSource *source; + guint io_tag; + + trace_migration_incoming_channel_watch(ioc, + object_get_typename(OBJECT(ioc)= )); + + /* + * Careful: this can be run from either the main thread or the monitor + * iothread when migrate_recover is used with OOB=3Don, so we need to + * take the lock and use the full version to specify the correct + * context. + */ + QEMU_LOCK_GUARD(&mis->channels_early.mutex); + + /* + * We should never watch an @ioc that is not peekable, because there's + * no point. What is worse is we lose the real order of accept()s via + * the asynchronous IO watch operation. + * + * Another note is TLS channel (non-peekable) may or may not work + * properly with IO watch due to its current .io_create_watch() impl, + * which is another story. Just guard both points. + */ + assert(qio_channel_is_peekable(ioc)); + io_tag =3D qio_channel_add_watch_full(ioc, G_IO_IN, + migration_incoming_channel_readabl= e, + mis, NULL, context); + + /* + * Replace this if one day qio_channel_add_watch*() API can directly + * return the GSource*.. for now, stick with it. + */ + source =3D g_main_context_find_source_by_id(context, io_tag); + /* + * Nothing can race with adding the IO watch, aka, concurrent removal + * is not possible when we have the lock. So it must be present. + */ + assert(source); + + migration_incoming_early_channel_insert(mis, ioc, source); +} + /** * @migration_channel_process_incoming - Create new incoming migration cha= nnel * @@ -253,14 +506,52 @@ void migration_channel_process_incoming(QIOChannel *i= oc) { MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; + MigChannelType ch; =20 - trace_migration_channel_process_incoming( + trace_migration_incoming_channel_process( ioc, object_get_typename(OBJECT(ioc))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { migration_tls_channel_process_incoming(ioc, &local_err); } else { - migration_incoming_channel_install(mis, ioc, &local_err); + if (migration_has_main_and_multifd_channels()) { + /* + * If all main+multifd channels are present already, this must + * be the preempt channel. + * + * QEMU can't register an IO watch for it if there is only the + * last preempt channel left, because it means the IO watch + * will never fire and nobody will pick it up: we rely on the + * one before the last one to pick both. + * + * See comment in migration_incoming_channel_readable() on + * the migration_incoming_detect_preempt_channel() call. + */ + migration_incoming_channel_preempt_setup(ioc); + } else { + if (qio_channel_is_peekable(ioc)) { + /* + * Register an IO watch for the peekable channel, deciding + * the type of channel later by peeking at it whenever + * possible. migration_incoming_channel_install() will be + * postponed. + */ + migration_incoming_channel_watch(mis, ioc); + } else { + /* + * Non-peekable channels (file, TLS, etc.), cannot register + * IO watch because (1) there's nothing to peek, (2) after + * registering IO watch, QEMU will lose the real ordering + * it gets from accept(), which is still so far the only + * source of truth to identify a channel in this case. + */ + ch =3D migration_channel_identify(mis, ioc, &local_err); + if (ch) { + migration_incoming_channel_install(mis, ioc, ch, + &local_err); + } + } + } } =20 if (local_err) { @@ -270,7 +561,7 @@ void migration_channel_process_incoming(QIOChannel *ioc) =20 void migration_channel_connect_outgoing(MigrationState *s, QIOChannel *ioc) { - trace_migration_set_outgoing_channel(ioc, object_get_typename(OBJECT(i= oc))); + trace_migration_outgoing_channel_set(ioc, object_get_typename(OBJECT(i= oc))); =20 if (migrate_channel_requires_tls_upgrade(ioc)) { Error *local_err =3D NULL; diff --git a/migration/channel.h b/migration/channel.h index 678712f2919..40bd339a3e7 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -49,4 +49,7 @@ bool migration_channel_parse_input(const char *uri, MigrationChannel **main_channelp, MigrationChannel **cpr_channelp, Error **errp); + +void migration_incoming_free_early_channels(MigrationIncomingState *mis); + #endif diff --git a/migration/migration.c b/migration/migration.c index 3ffc0c2c6aa..b140fb69509 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -334,6 +334,10 @@ void migration_object_init(void) current_incoming->page_requested =3D g_tree_new(page_request_addr_cmp); =20 current_incoming->exit_on_error =3D INMIGRATE_DEFAULT_EXIT_ON_ERROR; + /* zero_terminated=3Dfalse, clear_=3Dtrue (NOTE, "clear_" is not a typ= o) */ + current_incoming->channels_early.channels =3D + g_array_new(FALSE, TRUE, sizeof(MigEarlyIncomingChannel)); + qemu_mutex_init(¤t_incoming->channels_early.mutex); =20 migration_object_check(current_migration, &error_fatal); =20 @@ -447,6 +451,24 @@ void migration_incoming_state_destroy(void) MigrationIncomingState *mis =3D migration_incoming_get_current(); PostcopyState ps =3D postcopy_state_get(); =20 + /* Cleanup listener to make sure no further accept() for sockets */ + migration_incoming_transport_cleanup(mis); + + /* + * It's safer to free channel watches earlier than most of the rest, in + * case the IO watches could fire in the monitor iothread concurrently + * against this function. + * + * Above migration_incoming_transport_cleanup() should have disarmed + * anything that we could accept() new sockets. + * + * Here return of migration_incoming_free_early_channels() makes sure + * even if something already fired concurrently, it won't really do + * anything but return - see migration_incoming_early_channel_remove() + * and its return code for details. + */ + migration_incoming_free_early_channels(mis); + multifd_recv_cleanup(); =20 if (ps !=3D POSTCOPY_INCOMING_NONE) { @@ -491,7 +513,6 @@ void migration_incoming_state_destroy(void) mis->postcopy_remote_fds =3D NULL; } =20 - migration_incoming_transport_cleanup(mis); qemu_event_reset(&mis->main_thread_load_event); =20 if (mis->page_requested) { @@ -833,10 +854,6 @@ out: migrate_incoming_unref_outgoing_state(); } =20 -/* - * Returns whether all the necessary channels to proceed with the - * incoming migration have been established without error. - */ bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -865,13 +882,13 @@ bool migration_incoming_setup(QIOChannel *ioc, uint8_= t channel, Error **errp) assert(!mis->postcopy_qemufile_dst); f =3D qemu_file_new_input(ioc); postcopy_preempt_new_channel(mis, f); - return false; + break; =20 default: g_assert_not_reached(); } =20 - return migration_has_main_and_multifd_channels(); + return true; } =20 void migration_outgoing_setup(QIOChannel *ioc) diff --git a/migration/migration.h b/migration/migration.h index 1329f6bba48..057c85d6115 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -90,6 +90,28 @@ typedef enum { PREEMPT_THREAD_QUIT, } PreemptThreadStatus; =20 +typedef struct { + /* + * The GSource we have allocated to track G_IO_IN events for the + * channel. Note: it may not be attached to the default main gcontext, + * for example, when in case of io watch created during an OOB + * migrate-recover command. + */ + GSource *source; + /* The channel we will identify later after getting some buffers to re= ad */ + QIOChannel *ioc; +} MigEarlyIncomingChannel; + +typedef struct { + GArray *channels; + /* + * In most cases, channels are only operated with BQl, but since we + * have OOB command support, don't assume it, just use a standalone + * mutex to protect any access to the channels array. + */ + QemuMutex mutex; +} MigEarlyIncomingChannels; + /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -255,6 +277,19 @@ struct MigrationIncomingState { =20 /* Do exit on incoming migration failure */ bool exit_on_error; + + /* + * Maintains all channels only at early stage. After incoming + * migration started, this should be an empty array and no use anymore. + * + * TODO: we logically only need this to make new QEMU binaries work for + * old machines who have @preempt_pre_7_2 set on the source, but it's + * also good to have this early stage anyway, making sure when peek the + * channel there will be something in the channel. Ideally, we should + * manage all migration channels in the future with proper headers, + * then we can drop this. + */ + MigEarlyIncomingChannels channels_early; }; =20 MigrationIncomingState *migration_incoming_get_current(void); diff --git a/migration/trace-events b/migration/trace-events index 8840d82f8dc..a6e11451f19 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -207,9 +207,10 @@ migration_start_incoming(void) "" migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd, uint64_t= rdma) "qemu_file %" PRIu64 " multifd %" PRIu64 " RDMA %" PRIu64 =20 # channel.c -migration_channel_process_incoming(void *ioc, const char *ioctype) "ioc=3D= %p ioctype=3D%s" -migration_set_incoming_channel(void *ioc, const char *ioctype, const char = *type) "ioc=3D%p ioctype=3D%s type=3D%s" -migration_set_outgoing_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" +migration_outgoing_channel_set(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" +migration_incoming_channel_process(void *ioc, const char *ioctype) "ioc=3D= %p ioctype=3D%s" +migration_incoming_channel_set(void *ioc, const char *ioctype, const char = *type) "ioc=3D%p ioctype=3D%s type=3D%s" +migration_incoming_channel_watch(void *ioc, const char *ioctype) "ioc=3D%p= ioctype=3D%s" =20 # global_state.c migrate_state_too_big(void) "" --=20 2.53.0 From nobody Mon Nov 23 04:26:30 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=1793299698; cv=none; d=zohomail.com; s=zohoarc; b=PUWAb3Fd2FGGbdosBQBFiea2Tnb1Ql1Z5CVj33As3OfYPib/4sN7glJR1x3LYdshArQIF7UrnwGj6iwxxExXFXZeeblc4KDsMrmJSzIKfAtu4qNe7tjrQhyw8QkP/DrZnpnkcxxL9NtM4vS6YyRWD0mJ5UyHQq39E4QL28GZsvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793299698; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p0uOWDa+WPB76fa3h6SyMG/PYYR+nyzZ1IYnU1HR1aQ=; b=jXAzS/Ku+AZeW/WKjzzbr3/HoR6XVMw+NQHeNXbAHEEEWRBQpo69L4LLCXBKCDXPbyz0eubUo45s+h6SIM7p0WO1e56Ofd7+Sk8+diFrLkcA67ADN+4eKIvjfdk5rcNYpoxwCo69b3WxEqWvnOvSzu6QU2bP6SMdBE+TjItJ6Dc= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793299698737316.012567856906; Thu, 29 Oct 2026 11:48:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xMVAF-0002pX-Fq; Thu, 29 Oct 2026 14:47:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xMV9f-0002WD-CF for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:15 -0400 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 1xMV9d-00023w-Kx for qemu-devel@nongnu.org; Thu, 29 Oct 2026 14:47:15 -0400 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 6FB8A1F8C2; Thu, 29 Oct 2026 18:47:12 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 92DF61342D; Thu, 29 Oct 2026 18:47:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cMnTJaOU42pwUgAAD6G6ig:T9 (envelope-from ); Thu, 29 Oct 2026 18:47:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p0uOWDa+WPB76fa3h6SyMG/PYYR+nyzZ1IYnU1HR1aQ=; b=uAKJFCrW7DCEPI/Ni/c9GB9LGKGDS+z3IGQt2ydRxlSMd6B8nvBqfx0hkujsInhd2ACI9V aRG8PgVWFpETs2F+YGN+AGc8RYpDw7NMaCKBdahbKc5cNrnQf7kS/OItNw5zgMypf4DCZP vHJ48on3hUQZyHeDL7KKqY1KjHo/Kw4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p0uOWDa+WPB76fa3h6SyMG/PYYR+nyzZ1IYnU1HR1aQ=; b=AL57SlDHHlqtg92Z+MWiXc344ep4q+B32RVZSJbbBXXwGSOYpBR/w5p/BfTtcmOWogEflE fLNxqcnH4kcyT6Ag== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1793299632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p0uOWDa+WPB76fa3h6SyMG/PYYR+nyzZ1IYnU1HR1aQ=; b=uAKJFCrW7DCEPI/Ni/c9GB9LGKGDS+z3IGQt2ydRxlSMd6B8nvBqfx0hkujsInhd2ACI9V aRG8PgVWFpETs2F+YGN+AGc8RYpDw7NMaCKBdahbKc5cNrnQf7kS/OItNw5zgMypf4DCZP vHJ48on3hUQZyHeDL7KKqY1KjHo/Kw4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1793299632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p0uOWDa+WPB76fa3h6SyMG/PYYR+nyzZ1IYnU1HR1aQ=; b=AL57SlDHHlqtg92Z+MWiXc344ep4q+B32RVZSJbbBXXwGSOYpBR/w5p/BfTtcmOWogEflE fLNxqcnH4kcyT6Ag== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 8/8] migration: Postpone the outgoing preempt channel for preempt_pre_7_2 Date: Thu, 29 Oct 2026 15:46:41 -0300 Message-ID: <20261029184641.1973813-9-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029184641.1973813-1-farosas@suse.de> References: <20261029184641.1973813-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-11.80 / 50.00]; SUSE_INTERNAL_BYPASS(-9.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.996]; MIME_GOOD(-0.10)[text/plain]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,imap1.dmz-prg2.suse.org:helo]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -11.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=lists1p.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1793299701127158500 Content-Type: text/plain; charset="utf-8" From: Peter Xu This is the corresponding outgoing fix for the same problem mentioned in the previous patch. The idea is simple: either migration to an old QEMU or when TLS is enabled, we rely on correct ordering of channels to make it work: first main, then multifd, finally preempt. This patch re-orders multifd and postcopy preempt channel on outgoing side, but only for the old machine types where preempt_pre_7_2 set, to make it follow the right orders to create the channels. Keep the resume path alone because the resume path never involve multifd channels, even if multifd is enabled. For that, fun fact: when multifd is enabled with postcopy preempt, network interruption will break all multifd channels, but they're never re-connected, until they got recycled at the end of postcopy migration. OTOH, multifd_recv_all_channels_created() reports true even after postcopy network down, as multifd_recv_state->count is never decremented. NOTE: this will move the preempt channel connection no matter multifd is enabled or not. It should fix multifd's case, but should have zero impact on when multifd is not enabled. Fixes: e27418861288 ("migration: enable multifd and postcopy together") Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- migration/migration.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b140fb69509..53cb6d38210 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3729,6 +3729,21 @@ static void *migration_thread(void *opaque) goto out; } =20 + /* + * Only for old 7.1/7.2 machine types (preempt mode supported since + * 7.1). Connect the preempt channel only after multifd channels, + * because some QEMU versions (v10.1 to v11.1) will assume the order of + * channels to be: (1) main, then (2) multifd channels, then (3) + * preempt channel. IOW, (3) must be after (2). + * + * multifd_send_setup() makes sure all multifd channels be connected + * first, then initiate preempt channel here guarantees the ordering to + * those QEMU binaries. + */ + if (migrate_postcopy_preempt() && s->preempt_pre_7_2) { + postcopy_preempt_setup(s); + } + bql_lock(); qemu_savevm_state_header(s->to_dst_file); bql_unlock(); @@ -4009,16 +4024,16 @@ void migration_start_outgoing(MigrationState *s) open_return_path_on_source(s); } =20 - /* - * This needs to be done before resuming a postcopy. Note: for newer - * QEMUs we will delay the channel creation until postcopy_start(), to - * avoid disorder of channel creations. - */ - if (migrate_postcopy_preempt() && s->preempt_pre_7_2) { - postcopy_preempt_setup(s); - } - if (resume) { + /* + * This needs to be done before resuming a postcopy. Note: for ne= wer + * QEMUs we will delay the channel creation until postcopy_start()= , to + * avoid disorder of channel creations. + */ + if (migrate_postcopy_preempt() && s->preempt_pre_7_2) { + postcopy_preempt_setup(s); + } + /* Wakeup the main migration thread to do the recovery */ migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP, MIGRATION_STATUS_POSTCOPY_RECOVER); --=20 2.53.0