From nobody Mon Nov 25 02:07:29 2024 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=1718992615; cv=none; d=zohomail.com; s=zohoarc; b=JF67tyJJ4DPEA2/PcFnMStfndI06wjfyMZFQppvJoETxB1svJv8XhVGk1zkPYwBm1/Hi2e+B23Xk/DohxHX5vY6P0LJmyj1LtJCuMx+M3MBGFtMaHeVvUFzp5dhXjsr4JK8R4tdhG7W5o0wBT8CesoFsh3ba37JBN/R9HkHn4+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992615; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kmKfQt7layowIRW2SpPGoIDYLqLdV6aEOQgXewASHS4=; b=PrU2t8d9s3n356O7vdBi5Snh/fmRy05fYMfNuzdVXuvKsMT3Rt9NhDkR/qYEk7TYSAd+rjJg4YGOu1M8+Z89z1NfeeF/P+jnjyyDFT7mKTQsEJ6LE4CecRx7kfttGjGdEYpTo7FBB1C0MWqavQzmbleh4yCIYmjlvD3pgrRck8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992615661951.4840446740918; Fri, 21 Jun 2024 10:56:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTL-0003GU-7g; Fri, 21 Jun 2024 13:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTF-0003F3-Ce for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:45 -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 1sKiTC-0003JL-Vv for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:45 -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 9EEC821B37; Fri, 21 Jun 2024 17:54:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6B8CB13AAA; Fri, 21 Jun 2024 17:54:38 +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 GMGmDF6+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kmKfQt7layowIRW2SpPGoIDYLqLdV6aEOQgXewASHS4=; b=ZregTxxUVCn32KM9TlpS/PkPQALhQLvDPmfWX9x/Jp7ORF25Gb3bp9DIbn2L0l49NKZlp2 bUdOnaBaUkRBGBnDNEBf4LT1+V8fbMCSA6gaUi6faAZwo/K3mjNpuhvaVsqUv/SpLgmzW+ OR/LVqX8fGDK7/30RAj1JZB+cXJ2vUk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kmKfQt7layowIRW2SpPGoIDYLqLdV6aEOQgXewASHS4=; b=ft+PBB988k0PM32rzQyj4j5Vt7H/RuYVFIaW15MIH9plWQE7LzdSHoBspXjNuEuzlX+Q9D EIa0rc3JKG1IcHBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kmKfQt7layowIRW2SpPGoIDYLqLdV6aEOQgXewASHS4=; b=ZregTxxUVCn32KM9TlpS/PkPQALhQLvDPmfWX9x/Jp7ORF25Gb3bp9DIbn2L0l49NKZlp2 bUdOnaBaUkRBGBnDNEBf4LT1+V8fbMCSA6gaUi6faAZwo/K3mjNpuhvaVsqUv/SpLgmzW+ OR/LVqX8fGDK7/30RAj1JZB+cXJ2vUk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kmKfQt7layowIRW2SpPGoIDYLqLdV6aEOQgXewASHS4=; b=ft+PBB988k0PM32rzQyj4j5Vt7H/RuYVFIaW15MIH9plWQE7LzdSHoBspXjNuEuzlX+Q9D EIa0rc3JKG1IcHBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 01/28] migration: Drop reference to QIOChannel if file seeking fails Date: Fri, 21 Jun 2024 14:54:07 -0300 Message-Id: <20240621175434.31180-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -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: 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: 1718992616987100003 Content-Type: text/plain; charset="utf-8" We forgot to drop the reference to the QIOChannel in the error path of the offset adjustment. Do it now. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/file.c b/migration/file.c index ab18ba505a..2bb8c64092 100644 --- a/migration/file.c +++ b/migration/file.c @@ -94,6 +94,7 @@ void file_start_outgoing_migration(MigrationState *s, =20 ioc =3D QIO_CHANNEL(fioc); if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) { + object_unref(OBJECT(fioc)); return; } qio_channel_set_name(ioc, "migration-file-outgoing"); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992603; cv=none; d=zohomail.com; s=zohoarc; b=Jb2MEsz2H4pesaAt+COHmSa4I8KJjekD4r1tPQueaKt2c4t52IUCcoyUxe6W5r7SoQ2jEdCm74FpJItvmd1wc96sTlwtIHMTcsN1iLUhIoEj5SYHbSyOXPbQJRHm+W1F8apzu7reuJkxHD58EQy3GLzDzUgXg6JXIxDMFLiASjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992603; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hKJ7OgowTW5xAwPODDARLGeRGWa3PEf/OcdtH34X+gM=; b=lw4RSFS6dbJ0jPgVp5wBIO6fzp0ecT8KRgZqKtP/jCFdCSpM3KgyZbf3L0flKki1EiC0WGfsfjseU4PEJGm5YpJS4ECC4UnzSKQdsncCZIpolx6DWnQZ+4x0/JA757WJPV1l1tT3Dht3cViC7QoOuU2uHr19pUgU7THL/UyITy8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992603098687.8844694460922; Fri, 21 Jun 2024 10:56:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTL-0003H0-Ql; Fri, 21 Jun 2024 13:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTF-0003F5-FG for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:45 -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 1sKiTD-0003JW-TH for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:45 -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 BCCDA1F835; Fri, 21 Jun 2024 17:54:41 +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 163DC13AAA; Fri, 21 Jun 2024 17:54:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EDdsM1++dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992481; 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=hKJ7OgowTW5xAwPODDARLGeRGWa3PEf/OcdtH34X+gM=; b=I16D8+MxbdxjvZjCKRssOzipIz61C3cRDvaw76rUyqaJYGPcYi667jBLysLFCZgwUv0I70 8zTjZwDm6PjlmjOVR6nbMliMe/cOeoBdIKqQd9h0Xs/klmX1rjca/MwzzsSpJd02zP+Xnn pIOssOpa6mc4j/SUdfDDzNFpcm7lKU8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992481; 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=hKJ7OgowTW5xAwPODDARLGeRGWa3PEf/OcdtH34X+gM=; b=SKaxUYlxr3/QdljMpNxAqLBHvX2dF3fccNbjiS3yq4wWvj9ALVC38eB18lYDxcbQxsP4KB GeL0knzceV3nTECw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992481; 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=hKJ7OgowTW5xAwPODDARLGeRGWa3PEf/OcdtH34X+gM=; b=I16D8+MxbdxjvZjCKRssOzipIz61C3cRDvaw76rUyqaJYGPcYi667jBLysLFCZgwUv0I70 8zTjZwDm6PjlmjOVR6nbMliMe/cOeoBdIKqQd9h0Xs/klmX1rjca/MwzzsSpJd02zP+Xnn pIOssOpa6mc4j/SUdfDDzNFpcm7lKU8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992481; 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=hKJ7OgowTW5xAwPODDARLGeRGWa3PEf/OcdtH34X+gM=; b=SKaxUYlxr3/QdljMpNxAqLBHvX2dF3fccNbjiS3yq4wWvj9ALVC38eB18lYDxcbQxsP4KB GeL0knzceV3nTECw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Prasad Pandit Subject: [PULL 02/28] migration: Fix file migration with fdset Date: Fri, 21 Jun 2024 14:54:08 -0300 Message-Id: <20240621175434.31180-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.30 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_FIVE(0.00)[5] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1718992604941100009 When the "file:" migration support was added we missed the special case in the qemu_open_old implementation that allows for a particular file name format to be used to refer to a set of file descriptors that have been previously provided to QEMU via the add-fd QMP command. When using this fdset feature, we should not truncate the migration file because being given an fd means that the management layer is in control of the file and will likely already have some data written to it. This is further indicated by the presence of the 'offset' argument, which indicates the start of the region where QEMU is allowed to write. Fix the issue by replacing the O_TRUNC flag on open by an ftruncate call, which will take the offset into consideration. Fixes: 385f510df5 ("migration: file URI offset") Suggested-by: Daniel P. Berrang=C3=A9 Reviewed-by: Prasad Pandit Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas --- migration/file.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/migration/file.c b/migration/file.c index 2bb8c64092..a903710f06 100644 --- a/migration/file.c +++ b/migration/file.c @@ -84,12 +84,19 @@ void file_start_outgoing_migration(MigrationState *s, =20 trace_migration_file_outgoing(filename); =20 - fioc =3D qio_channel_file_new_path(filename, O_CREAT | O_WRONLY | O_TR= UNC, - 0600, errp); + fioc =3D qio_channel_file_new_path(filename, O_CREAT | O_WRONLY, 0600,= errp); if (!fioc) { return; } =20 + if (ftruncate(fioc->fd, offset)) { + error_setg_errno(errp, errno, + "failed to truncate migration file to offset %" P= RIx64, + offset); + object_unref(OBJECT(fioc)); + return; + } + outgoing_args.fname =3D g_strdup(filename); =20 ioc =3D QIO_CHANNEL(fioc); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992589; cv=none; d=zohomail.com; s=zohoarc; b=CChoA/OI51XTQFH6y677C/lGyFSMeTadxKSpepc0kSmfG935x2eBK2XNjyV6SfzVe1NYRl2vhu70gQOfZM4Zl3qHwiiO2UbPeiyAdrjKEO2MR3GyBrpunfbQ9rhsv92X6VcPYRCsHDUh9Uj9LHTS9rc2hg9TO5Ayro3y0pX/7fo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992589; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zqG1BJBm4U7LvvpBbGDyqk1DGPRidUb8RgqRFwNrWpY=; b=KbwjwRD1CSbliLTKN6h04XXBzKdBAljv4lLrzrzidgUwX7VTB6v6qGFtZsxkJDmREexskszckNzERUeAZyiVb+F0H29pQj33VPzq18otm12ln6S8oA2G+5v6SNOgV5NLYEVAxUgYCkrLSQZI2O4yVS1EGCU6iosrM4RlFLDhtQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992589526145.4927222154946; Fri, 21 Jun 2024 10:56:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTL-0003GP-4U; Fri, 21 Jun 2024 13:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTH-0003Fj-RD for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:49 -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 1sKiTE-0003Je-QN for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:46 -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 8FE2521B40; Fri, 21 Jun 2024 17:54:43 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2BEE513AAA; Fri, 21 Jun 2024 17:54:41 +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 UCKqOGG+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992483; 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=zqG1BJBm4U7LvvpBbGDyqk1DGPRidUb8RgqRFwNrWpY=; b=Qtz1R5X1u4VqRnxN6HqQdVQrjPYnQ2IIuAZspp6Oepnf1D7DaXgZXPFJpX3BSarOdTY9/6 B63pOQJHJHY7o5YxhHxQAXoXmn/g2/+p2wkQVv4l+NcWWX14+0faC2RtM5nScOxTEZSCls s20iHfDHV0Yb6QEHbpgUYQDfIM3aIYM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992483; 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=zqG1BJBm4U7LvvpBbGDyqk1DGPRidUb8RgqRFwNrWpY=; b=/BKKo0iDVENF6DLcAwFdgPH+Df1j0AdSPmjJSlqAe0S+YnsswreUqlWMSEektOGr4lss/e OvT4u18Itqw8YXBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992483; 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=zqG1BJBm4U7LvvpBbGDyqk1DGPRidUb8RgqRFwNrWpY=; b=Qtz1R5X1u4VqRnxN6HqQdVQrjPYnQ2IIuAZspp6Oepnf1D7DaXgZXPFJpX3BSarOdTY9/6 B63pOQJHJHY7o5YxhHxQAXoXmn/g2/+p2wkQVv4l+NcWWX14+0faC2RtM5nScOxTEZSCls s20iHfDHV0Yb6QEHbpgUYQDfIM3aIYM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992483; 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=zqG1BJBm4U7LvvpBbGDyqk1DGPRidUb8RgqRFwNrWpY=; b=/BKKo0iDVENF6DLcAwFdgPH+Df1j0AdSPmjJSlqAe0S+YnsswreUqlWMSEektOGr4lss/e OvT4u18Itqw8YXBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 03/28] tests/qtest/migration: Fix file migration offset check Date: Fri, 21 Jun 2024 14:54:09 -0300 Message-Id: <20240621175434.31180-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_THREE(0.00)[4] X-Spam-Score: -3.30 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -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: 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: 1718992591051100003 When doing file migration, QEMU accepts an offset that should be skipped when writing the migration stream to the file. The purpose of the offset is to allow the management layer to put its own metadata at the start of the file. We have tests for this in migration-test, but only testing that the migration stream starts at the correct offset and not that it actually leaves the data intact. Unsurprisingly, there's been a bug in that area that the tests didn't catch. Fix the tests to write some data to the offset region and check that it's actually there after the migration. While here, switch to using g_get_file_contents() which is more portable than mmap(). Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas --- tests/qtest/migration-test.c | 79 ++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0dccb4beff..0a529a527b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -68,6 +68,7 @@ static QTestMigrationState dst_state; #define QEMU_VM_FILE_MAGIC 0x5145564d #define FILE_TEST_FILENAME "migfile" #define FILE_TEST_OFFSET 0x1000 +#define FILE_TEST_MARKER 'X' #define QEMU_ENV_SRC "QTEST_QEMU_BINARY_SRC" #define QEMU_ENV_DST "QTEST_QEMU_BINARY_DST" =20 @@ -1693,10 +1694,43 @@ finish: test_migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); } =20 +static void file_dirty_offset_region(void) +{ + g_autofree char *path =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); + size_t size =3D FILE_TEST_OFFSET; + g_autofree char *data =3D g_new0(char, size); + + memset(data, FILE_TEST_MARKER, size); + g_assert(g_file_set_contents(path, data, size, NULL)); +} + +static void file_check_offset_region(void) +{ + g_autofree char *path =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); + size_t size =3D FILE_TEST_OFFSET; + g_autofree char *expected =3D g_new0(char, size); + g_autofree char *actual =3D NULL; + uint64_t *stream_start; + + /* + * Ensure the skipped offset region's data has not been touched + * and the migration stream starts at the right place. + */ + + memset(expected, FILE_TEST_MARKER, size); + + g_assert(g_file_get_contents(path, &actual, NULL, NULL)); + g_assert(!memcmp(actual, expected, size)); + + stream_start =3D (uint64_t *)(actual + size); + g_assert_cmpint(cpu_to_be64(*stream_start) >> 32, =3D=3D, QEMU_VM_FILE= _MAGIC); +} + static void test_file_common(MigrateCommon *args, bool stop_src) { QTestState *from, *to; void *data_hook =3D NULL; + bool check_offset =3D false; =20 if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { return; @@ -1709,6 +1743,16 @@ static void test_file_common(MigrateCommon *args, bo= ol stop_src) */ g_assert_false(args->live); =20 + if (g_strrstr(args->connect_uri, "offset=3D")) { + check_offset =3D true; + /* + * This comes before the start_hook because it's equivalent to + * a management application creating the file and writing to + * it so hooks should expect the file to be already present. + */ + file_dirty_offset_region(); + } + if (args->start_hook) { data_hook =3D args->start_hook(from, to); } @@ -1743,6 +1787,10 @@ static void test_file_common(MigrateCommon *args, bo= ol stop_src) =20 wait_for_serial("dest_serial"); =20 + if (check_offset) { + file_check_offset_region(); + } + finish: if (args->finish_hook) { args->finish_hook(from, to, data_hook); @@ -1942,36 +1990,6 @@ static void test_precopy_file(void) test_file_common(&args, true); } =20 -static void file_offset_finish_hook(QTestState *from, QTestState *to, - void *opaque) -{ -#if defined(__linux__) - g_autofree char *path =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); - size_t size =3D FILE_TEST_OFFSET + sizeof(QEMU_VM_FILE_MAGIC); - uintptr_t *addr, *p; - int fd; - - fd =3D open(path, O_RDONLY); - g_assert(fd !=3D -1); - addr =3D mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); - g_assert(addr !=3D MAP_FAILED); - - /* - * Ensure the skipped offset contains zeros and the migration - * stream starts at the right place. - */ - p =3D addr; - while (p < addr + FILE_TEST_OFFSET / sizeof(uintptr_t)) { - g_assert(*p =3D=3D 0); - p++; - } - g_assert_cmpint(cpu_to_be64(*p) >> 32, =3D=3D, QEMU_VM_FILE_MAGIC); - - munmap(addr, size); - close(fd); -#endif -} - static void test_precopy_file_offset(void) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s,offset=3D%d", tmp= fs, @@ -1980,7 +1998,6 @@ static void test_precopy_file_offset(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .finish_hook =3D file_offset_finish_hook, }; =20 test_file_common(&args, false); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992604; cv=none; d=zohomail.com; s=zohoarc; b=VXto7ys4V9qcE4duZ7Hgau4ObadILQmlmgSh2FfoKJxvO5Plziia7lPXDemTtSBUkAPjErY2QAuJSFVnIV70tPb5lCpug+gNf6uofmlGv8MTWsT8dulZGhRv7Q8nWvWwOldbjbuo0p13yuprsVZYNNDwYfRehw6FUr/DtJhHxA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992604; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BHDDc9Txz5UoWG2oPka59YLq/Od6MbDAayJ9RVr1JIo=; b=WlJVYsWns9tYksKQmeT2Ayhzpr+IjgGRIHYh5fO8OPmW8kddWE6y9dJM82mHIrADvZZfp+5TEefVs+Touc2puGz90rWmPqYGf0IiVRFuVuL5y9SAn3y+DJXvLJTFB9EDU8JApTL9m/WaWotGsbcJzbuaxPc/S6tT5wOb+jbtacQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171899260462226.339967455139572; Fri, 21 Jun 2024 10:56:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTN-0003I6-Fp; Fri, 21 Jun 2024 13:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTJ-0003Fy-9k for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:49 -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 1sKiTH-0003Jz-K9 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:49 -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 2F3A721B37; Fri, 21 Jun 2024 17:54:45 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0788713AAA; Fri, 21 Jun 2024 17:54:43 +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 EJLdL2O+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BHDDc9Txz5UoWG2oPka59YLq/Od6MbDAayJ9RVr1JIo=; b=m3Axk7h3xmX9kqOq3n/1FNmeuxLWewEB4dearNTIy3XKWDeaPobhBz74M2JOjpW0TDfVag RTUJ5wZuKm+Zzbo5M2ibNIagNVoZsA+973+BxW3PV9XjA+ODtjb96ifkqzYOm7VltuX/AK YVTbBNGdEFuDeEogq5jsxjnJ0/T+iys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BHDDc9Txz5UoWG2oPka59YLq/Od6MbDAayJ9RVr1JIo=; b=3T2XGaUMA40wBvlfnON0nfFJFdxFg7Vvr74e3v9RjYR8CFN0OoEa2IyDIS+sMKgwfaNTeb kurl/EVqyIAL6uBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BHDDc9Txz5UoWG2oPka59YLq/Od6MbDAayJ9RVr1JIo=; b=m3Axk7h3xmX9kqOq3n/1FNmeuxLWewEB4dearNTIy3XKWDeaPobhBz74M2JOjpW0TDfVag RTUJ5wZuKm+Zzbo5M2ibNIagNVoZsA+973+BxW3PV9XjA+ODtjb96ifkqzYOm7VltuX/AK YVTbBNGdEFuDeEogq5jsxjnJ0/T+iys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BHDDc9Txz5UoWG2oPka59YLq/Od6MbDAayJ9RVr1JIo=; b=3T2XGaUMA40wBvlfnON0nfFJFdxFg7Vvr74e3v9RjYR8CFN0OoEa2IyDIS+sMKgwfaNTeb kurl/EVqyIAL6uBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 04/28] tests/qtest/migration: Add a precopy file test with fdset Date: Fri, 21 Jun 2024 14:54:10 -0300 Message-Id: <20240621175434.31180-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.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: 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: 1718992604935100008 Content-Type: text/plain; charset="utf-8" Add a test for file migration using fdset. The passing of fds is more complex than using a file path. This is also the scenario where it's most important we ensure that the initial migration stream offset is respected because the fdset interface is the one used by the management layer when providing a non empty migration file. Note that fd passing is not available on Windows, so anything that uses add-fd needs to exclude that platform. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- tests/qtest/migration-test.c | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0a529a527b..22b07bc0ec 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1990,6 +1990,46 @@ static void test_precopy_file(void) test_file_common(&args, true); } =20 +#ifndef _WIN32 +static void fdset_add_fds(QTestState *qts, const char *file, int flags, + int num_fds) +{ + for (int i =3D 0; i < num_fds; i++) { + int fd; + + fd =3D open(file, flags, 0660); + assert(fd !=3D -1); + + qtest_qmp_fds_assert_success(qts, &fd, 1, "{'execute': 'add-fd', " + "'arguments': {'fdset-id': 1}}"); + close(fd); + } +} + +static void *file_offset_fdset_start_hook(QTestState *from, QTestState *to) +{ + g_autofree char *file =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); + + fdset_add_fds(from, file, O_WRONLY, 1); + fdset_add_fds(to, file, O_RDONLY, 1); + + return NULL; +} + +static void test_precopy_file_offset_fdset(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", + FILE_TEST_OFFSET); + MigrateCommon args =3D { + .connect_uri =3D uri, + .listen_uri =3D "defer", + .start_hook =3D file_offset_fdset_start_hook, + }; + + test_file_common(&args, false); +} +#endif + static void test_precopy_file_offset(void) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s,offset=3D%d", tmp= fs, @@ -3527,6 +3567,10 @@ int main(int argc, char **argv) test_precopy_file); migration_test_add("/migration/precopy/file/offset", test_precopy_file_offset); +#ifndef _WIN32 + migration_test_add("/migration/precopy/file/offset/fdset", + test_precopy_file_offset_fdset); +#endif migration_test_add("/migration/precopy/file/offset/bad", test_precopy_file_offset_bad); =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992616; cv=none; d=zohomail.com; s=zohoarc; b=dTWV4cC9P0DLiPY2KK5bXivYh52BWnJB7eTjpHeN++/qGwvdCxjpR2usfr+zfMws0AOtYhpYMu+b19LjtpGavF/JrbhEWXHvYtrwk5cW+h7W0PMtgvKLvaTu9KrJCuVoRcAcm+vDoCWdV7ZHZIVQQqExDnmQvML8cNUygnqMfaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992616; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ej2WTQ/a70FEnSwNeGX5ZJIjI8llyrpp7m9fi688FQk=; b=c9pfbWAuPJmJGHNUkFuLhDxvRO7JuYxtzAH31a3gTm9mubtjsktZj1qRTd0FmirbbMoPOiJiqq3TBvXi/wcPWDmbkQp3hqxPJ3RrgQHbGx4gq5gZAuKK68kSGeHzLSn/+MR3+wScYSO4Vr4BjUByjgGJMsiA22LFjXRYwf8ih4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992616731664.2028818186354; Fri, 21 Jun 2024 10:56:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTN-0003IQ-P1; Fri, 21 Jun 2024 13:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTL-0003Gc-9S for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:51 -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 1sKiTJ-0003KD-GA for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:51 -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 ED79321B40; Fri, 21 Jun 2024 17:54:47 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9BF5413AAA; Fri, 21 Jun 2024 17:54:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8Bl0GGW+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992488; 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=ej2WTQ/a70FEnSwNeGX5ZJIjI8llyrpp7m9fi688FQk=; b=uix+J2C4+ICUWTMpLJr62CJYmJ6DylQHwvYPYrN5BsbFGdFg2g2kI27xJuEI/vCM1Vlsvl j15ifl+q5K2XWv+gupnhA9kIVsJ7meKeit/pSQdUWY31EYxckc3RdHVx9Ep9HGcLGjCHq4 GBeSMhc86XEJfgRa7X//F9HP8WspZXU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992488; 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=ej2WTQ/a70FEnSwNeGX5ZJIjI8llyrpp7m9fi688FQk=; b=ZPKlCnxDqyZYqhiNSlPXjUCkWQjs6BaLGGdr2+otZiUgDRBH6D/RuFD9eBwFSvesV2XVQV Izq8PcusBrpaeWAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=rAJhJDwu; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=q66p6AtI DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992487; 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=ej2WTQ/a70FEnSwNeGX5ZJIjI8llyrpp7m9fi688FQk=; b=rAJhJDwu68XV5Y5pS60yAbxi6u0x9OPFoDee+mFKMZdK+WLchORJGCTVTJYjkZiTx4OGV6 qDoi86uv+2fnz2NDtkMUuOwWFXrKCJxVq5hzYC/vtbxOFZHA49rsdoLE8H/Vk9V85YH4Ci DeGyWjwDSOryloYZGh5AswU5ezdf+3Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992487; 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=ej2WTQ/a70FEnSwNeGX5ZJIjI8llyrpp7m9fi688FQk=; b=q66p6AtITmGSsaoIl1vlcpr1l2bpeYFn355mctUNhZnRCRei2+SqzclBFhGd72Pm3MFE5/ kwTwhXiMkTSm8ZAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , "Dr . David Alan Gilbert" , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 05/28] monitor: Drop monitor_fdset_dup_fd_find/_remove() Date: Fri, 21 Jun 2024 14:54:11 -0300 Message-Id: <20240621175434.31180-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: ED79321B40 X-Spam-Score: -3.51 X-Spamd-Result: default: False [-3.51 / 50.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)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[linaro.org:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1718992617013100004 From: Peter Xu Those functions are not needed, one remove function should already work. Clean it up. Here the code doesn't really care about whether we need to keep that dupfd around if close() failed: when that happens something got very wrong, keeping the dup_fd around the fdsets may not help that situation so far. Cc: Dr. David Alan Gilbert Cc: Markus Armbruster Cc: Philippe Mathieu-Daud=C3=A9 Cc: Paolo Bonzini Cc: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu Reviewed-by: Daniel P. Berrang=C3=A9 [add missing return statement, removal during traversal is not safe] Signed-off-by: Fabiano Rosas --- include/monitor/monitor.h | 1 - monitor/fds.c | 28 ++++++---------------------- stubs/fdset.c | 5 ----- util/osdep.c | 15 +-------------- 4 files changed, 7 insertions(+), 42 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 965f5d5450..fd9b3f538c 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -53,7 +53,6 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id= , int64_t fdset_id, const char *opaque, Error **errp); int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags); void monitor_fdset_dup_fd_remove(int dup_fd); -int64_t monitor_fdset_dup_fd_find(int dup_fd); =20 void monitor_register_hmp(const char *name, bool info, void (*cmd)(Monitor *mon, const QDict *qdict)); diff --git a/monitor/fds.c b/monitor/fds.c index d86c2c674c..fb9f58c056 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -458,7 +458,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int flag= s) #endif } =20 -static int64_t monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove) +void monitor_fdset_dup_fd_remove(int dup_fd) { MonFdset *mon_fdset; MonFdsetFd *mon_fdset_fd_dup; @@ -467,31 +467,15 @@ static int64_t monitor_fdset_dup_fd_find_remove(int d= up_fd, bool remove) QLIST_FOREACH(mon_fdset, &mon_fdsets, next) { QLIST_FOREACH(mon_fdset_fd_dup, &mon_fdset->dup_fds, next) { if (mon_fdset_fd_dup->fd =3D=3D dup_fd) { - if (remove) { - QLIST_REMOVE(mon_fdset_fd_dup, next); - g_free(mon_fdset_fd_dup); - if (QLIST_EMPTY(&mon_fdset->dup_fds)) { - monitor_fdset_cleanup(mon_fdset); - } - return -1; - } else { - return mon_fdset->id; + QLIST_REMOVE(mon_fdset_fd_dup, next); + g_free(mon_fdset_fd_dup); + if (QLIST_EMPTY(&mon_fdset->dup_fds)) { + monitor_fdset_cleanup(mon_fdset); } + return; } } } - - return -1; -} - -int64_t monitor_fdset_dup_fd_find(int dup_fd) -{ - return monitor_fdset_dup_fd_find_remove(dup_fd, false); -} - -void monitor_fdset_dup_fd_remove(int dup_fd) -{ - monitor_fdset_dup_fd_find_remove(dup_fd, true); } =20 int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp) diff --git a/stubs/fdset.c b/stubs/fdset.c index d7c39a28ac..389e368a29 100644 --- a/stubs/fdset.c +++ b/stubs/fdset.c @@ -9,11 +9,6 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags) return -1; } =20 -int64_t monitor_fdset_dup_fd_find(int dup_fd) -{ - return -1; -} - void monitor_fdset_dup_fd_remove(int dupfd) { } diff --git a/util/osdep.c b/util/osdep.c index 5d23bbfbec..756de9a745 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -398,21 +398,8 @@ int qemu_open_old(const char *name, int flags, ...) =20 int qemu_close(int fd) { - int64_t fdset_id; - /* Close fd that was dup'd from an fdset */ - fdset_id =3D monitor_fdset_dup_fd_find(fd); - if (fdset_id !=3D -1) { - int ret; - - ret =3D close(fd); - if (ret =3D=3D 0) { - monitor_fdset_dup_fd_remove(fd); - } - - return ret; - } - + monitor_fdset_dup_fd_remove(fd); return close(fd); } =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992727; cv=none; d=zohomail.com; s=zohoarc; b=jZIFDgf1+I+DPCH22DH6aT8n6DozKe5bmCb0+FS8qWIq4z5T4cxs0qlRFwjXu69D0qjo+9MBBH6ar1bwoFlSXhX7Tno7lXECirqwpdnBC3h+SdRTdrgT8t7/7SqkSwSO9Lw1OiqXya0J/1hG95cgz1zJ51krh3y5hEux/5jCPjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992727; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=v1KaYbtoCrYR/UVJrzg71LPk0e1FdJi5ikFfwJo+cZ4=; b=EhdlUIS30n+Cxwl4oWGZ+/jEZBDGp64P0DZCYMqBn45JiJxsI6MizLe2q06oYpxp3AkfoyaVGCdAnj/CWRzGJ/yXr2P3A6MTiss1ZrM/LPjxF6rAFDA71QuC/Z3DnxjgrSGlxH87OcjoSPoRqV9pKT0qjGI5WunboFKNKn0u87g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992727569813.2419951543321; Fri, 21 Jun 2024 10:58:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTO-0003Im-LL; Fri, 21 Jun 2024 13:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTM-0003Ho-MR for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:52 -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 1sKiTK-0003KQ-Ta for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:52 -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 937A721B37; Fri, 21 Jun 2024 17:54:49 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6572913AAA; Fri, 21 Jun 2024 17:54:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4PUFC2i+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1KaYbtoCrYR/UVJrzg71LPk0e1FdJi5ikFfwJo+cZ4=; b=DUS/oUwl/tzS78bikzXyrXulVyF7vcGlQncdBhIYst7nggxn27kC5CIOB/kAz/ILk0Zvr6 fBE4NXxCZhjZG+YEb5eZq751kDwxrSmqViK0BnrO512QlUC2e0rSPXO4y99dR2WoaYtTKo 6/tTo3fGUrKzGaXFOtfUqEcV6owVbro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1KaYbtoCrYR/UVJrzg71LPk0e1FdJi5ikFfwJo+cZ4=; b=fWouPYWHxxAP+qL+0zmruzu+PwpKFLLzcFSx86QPmh+w8gGe+EERFtunhJHio02Sgineo9 E7DlF+18aM8V9lAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="DUS/oUwl"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=fWouPYWH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1KaYbtoCrYR/UVJrzg71LPk0e1FdJi5ikFfwJo+cZ4=; b=DUS/oUwl/tzS78bikzXyrXulVyF7vcGlQncdBhIYst7nggxn27kC5CIOB/kAz/ILk0Zvr6 fBE4NXxCZhjZG+YEb5eZq751kDwxrSmqViK0BnrO512QlUC2e0rSPXO4y99dR2WoaYtTKo 6/tTo3fGUrKzGaXFOtfUqEcV6owVbro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1KaYbtoCrYR/UVJrzg71LPk0e1FdJi5ikFfwJo+cZ4=; b=fWouPYWHxxAP+qL+0zmruzu+PwpKFLLzcFSx86QPmh+w8gGe+EERFtunhJHio02Sgineo9 E7DlF+18aM8V9lAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 06/28] monitor: Introduce monitor_fdset_*free Date: Fri, 21 Jun 2024 14:54:12 -0300 Message-Id: <20240621175434.31180-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 937A721B37 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; 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: 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: 1718992728078100001 Content-Type: text/plain; charset="utf-8" Introduce new functions to remove and free no longer used fds and fdsets. We need those to decouple the remove/free routines from monitor_fdset_cleanup() which will go away in the next patches. The new functions: - monitor_fdset_free/_if_empty() will be used when a monitor connection closes and when an fd is removed to cleanup any fdset that is now empty. - monitor_fdset_fd_free() will be used to remove one or more fds that have been explicitly targeted by qmp_remove_fd(). Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- monitor/fds.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/monitor/fds.c b/monitor/fds.c index fb9f58c056..bd45a26368 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -167,6 +167,27 @@ int monitor_get_fd(Monitor *mon, const char *fdname, E= rror **errp) return -1; } =20 +static void monitor_fdset_free(MonFdset *mon_fdset) +{ + QLIST_REMOVE(mon_fdset, next); + g_free(mon_fdset); +} + +static void monitor_fdset_free_if_empty(MonFdset *mon_fdset) +{ + if (QLIST_EMPTY(&mon_fdset->fds) && QLIST_EMPTY(&mon_fdset->dup_fds)) { + monitor_fdset_free(mon_fdset); + } +} + +static void monitor_fdset_fd_free(MonFdsetFd *mon_fdset_fd) +{ + close(mon_fdset_fd->fd); + g_free(mon_fdset_fd->opaque); + QLIST_REMOVE(mon_fdset_fd, next); + g_free(mon_fdset_fd); +} + static void monitor_fdset_cleanup(MonFdset *mon_fdset) { MonFdsetFd *mon_fdset_fd; @@ -176,17 +197,11 @@ static void monitor_fdset_cleanup(MonFdset *mon_fdset) if ((mon_fdset_fd->removed || (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount =3D=3D 0= )) && runstate_is_running()) { - close(mon_fdset_fd->fd); - g_free(mon_fdset_fd->opaque); - QLIST_REMOVE(mon_fdset_fd, next); - g_free(mon_fdset_fd); + monitor_fdset_fd_free(mon_fdset_fd); } } =20 - if (QLIST_EMPTY(&mon_fdset->fds) && QLIST_EMPTY(&mon_fdset->dup_fds)) { - QLIST_REMOVE(mon_fdset, next); - g_free(mon_fdset); - } + monitor_fdset_free_if_empty(mon_fdset); } =20 void monitor_fdsets_cleanup(void) --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992594; cv=none; d=zohomail.com; s=zohoarc; b=MbrTlx2o9e68QMb3UiZQ0xDh88RRP9C9p1rfamafVbgfpu7XxnwYQ1tU0Q99lqX1W6WN1vh+cgEPb57MY8f++M5rJ5MiF5Ie8MIUi4/XG2bfw4Yes3zitLXpD1A5k2UTGqsJlvgeck/riCy1K+gpn4GR1qUZQ0vGUfjXHQj6t/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992594; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0DM7bpjwD6k46025A+PQR6pcH6H0GhzHZ0gk1D0eZ6c=; b=mkIRK8CrAyyg/8Sqzb1oucLIht1TgRswLRfucDHoV9xc2fqAKPksgf31RLFq7CjKSZPVVCQHdUBb+uvEbASaLwoiyJa3tmYuMlgBOSV4VH7aK0g2LOVFsNPY11UFkbnkbjfSd4BzF2W502QV2NIKP+cF5WaAMDltFyRbXiOEZTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992594619178.4169288465057; Fri, 21 Jun 2024 10:56:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTQ-0003JZ-7B; Fri, 21 Jun 2024 13:54:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTO-0003Io-JS for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:54 -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 1sKiTM-0003Ka-EE for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:54 -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 3D9CB1F7F2; Fri, 21 Jun 2024 17:54:51 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0DE6E13AAA; Fri, 21 Jun 2024 17:54:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oC8iMWm+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0DM7bpjwD6k46025A+PQR6pcH6H0GhzHZ0gk1D0eZ6c=; b=AaNesnP+Wl6WawD1eTdqwUp1t/ulk4HOLN466Wddt3GQb8P821t6zbrwmwle91+nQ6vRaU Wgbo5FWA8cOOExCtz5n5cpAsI8EULul673qFhvsqqk9tJekd0wmekz8jkm4TcHYZ8p3viO zCGmrm7SeXZUSzcSKB7dF+a+W4ji9F8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0DM7bpjwD6k46025A+PQR6pcH6H0GhzHZ0gk1D0eZ6c=; b=HYmI5JK6QTsi1xgfXSLGIBeh+vIZNuZcsfrs8h196pfOiX0IIKlgiRoaIIvdifrhDADfhB qq841a/Onr0tLEDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0DM7bpjwD6k46025A+PQR6pcH6H0GhzHZ0gk1D0eZ6c=; b=AaNesnP+Wl6WawD1eTdqwUp1t/ulk4HOLN466Wddt3GQb8P821t6zbrwmwle91+nQ6vRaU Wgbo5FWA8cOOExCtz5n5cpAsI8EULul673qFhvsqqk9tJekd0wmekz8jkm4TcHYZ8p3viO zCGmrm7SeXZUSzcSKB7dF+a+W4ji9F8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0DM7bpjwD6k46025A+PQR6pcH6H0GhzHZ0gk1D0eZ6c=; b=HYmI5JK6QTsi1xgfXSLGIBeh+vIZNuZcsfrs8h196pfOiX0IIKlgiRoaIIvdifrhDADfhB qq841a/Onr0tLEDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 07/28] monitor: Stop removing non-duplicated fds Date: Fri, 21 Jun 2024 14:54:13 -0300 Message-Id: <20240621175434.31180-8-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; 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: 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: 1718992595005100002 Content-Type: text/plain; charset="utf-8" monitor_fdsets_cleanup() currently has three responsibilities: 1- Remove the fds that have been marked for removal(->removed=3Dtrue) by qmp_remove_fd(). This is overly complicated, but ok. 2- Remove any file descriptors that have been passed into QEMU and never duplicated[1,2]. A file descriptor without duplicates indicates that no part of QEMU has made use of it. This is problematic because the current implementation does it only if the guest is not running and the monitor is closed. 3- Remove/free fdsets that have become empty due to the above removals. This is ok. The scenario described in (2) is starting to show some cracks now that we're trying to consume fds from the migration code: - Doing cleanup every time the last monitor connection closes works to reap unused fds, but also has the side effect of forcing the management layer to pass the file descriptors again in case of a disconnect/re-connect, if that happened to be the only monitor connection. Another side effect is that removing an fd with qmp_remove_fd() is effectively delayed until the last monitor connection closes. The usage of mon_refcount is also problematic because it's racy. - Checking runstate_is_running() skips the cleanup unless the VM is running and avoids premature cleanup of the fds, but also has the side effect of blocking the legitimate removal of an fd via qmp_remove_fd() if the VM happens to be in another state. This affects qmp_remove_fd() and qmp_query_fdsets() in particular because requesting a removal at a bad time (guest stopped) might cause an fd to never be removed, or to be removed at a much later point in time, causing the query command to continue showing the supposedly removed fd/fdset. Note that file descriptors that *have* been duplicated are owned by the code that uses them and will be removed after qemu_close() is called. Therefore we've decided that the best course of action to avoid the undesired side-effects is to stop managing non-duplicated file descriptors. 1- efb87c1697 ("monitor: Clean up fd sets on monitor disconnect") 2- ebe52b592d ("monitor: Prevent removing fd from set during init") Reviewed-by: Peter Xu [fix logic mistake: s/fdset_free/fdset_free_if_empty] Signed-off-by: Fabiano Rosas --- monitor/fds.c | 15 ++++--- monitor/hmp.c | 2 - monitor/monitor-internal.h | 1 - monitor/monitor.c | 1 - monitor/qmp.c | 2 - tests/qtest/libqtest.c | 15 ++++--- tests/qtest/libqtest.h | 2 + tests/qtest/migration-test.c | 82 ++++++++++++++++++++++++++++++++++++ 8 files changed, 102 insertions(+), 18 deletions(-) diff --git a/monitor/fds.c b/monitor/fds.c index bd45a26368..76199d4b3b 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -175,6 +175,11 @@ static void monitor_fdset_free(MonFdset *mon_fdset) =20 static void monitor_fdset_free_if_empty(MonFdset *mon_fdset) { + /* + * Only remove an empty fdset. The fds are owned by the user and + * should have been removed with qmp_remove_fd(). The dup_fds are + * owned by QEMU and should have been removed with qemu_close(). + */ if (QLIST_EMPTY(&mon_fdset->fds) && QLIST_EMPTY(&mon_fdset->dup_fds)) { monitor_fdset_free(mon_fdset); } @@ -194,9 +199,7 @@ static void monitor_fdset_cleanup(MonFdset *mon_fdset) MonFdsetFd *mon_fdset_fd_next; =20 QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_n= ext) { - if ((mon_fdset_fd->removed || - (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount =3D=3D 0= )) && - runstate_is_running()) { + if (mon_fdset_fd->removed) { monitor_fdset_fd_free(mon_fdset_fd); } } @@ -211,7 +214,7 @@ void monitor_fdsets_cleanup(void) =20 QEMU_LOCK_GUARD(&mon_fdsets_lock); QLIST_FOREACH_SAFE(mon_fdset, &mon_fdsets, next, mon_fdset_next) { - monitor_fdset_cleanup(mon_fdset); + monitor_fdset_free_if_empty(mon_fdset); } } =20 @@ -484,9 +487,7 @@ void monitor_fdset_dup_fd_remove(int dup_fd) if (mon_fdset_fd_dup->fd =3D=3D dup_fd) { QLIST_REMOVE(mon_fdset_fd_dup, next); g_free(mon_fdset_fd_dup); - if (QLIST_EMPTY(&mon_fdset->dup_fds)) { - monitor_fdset_cleanup(mon_fdset); - } + monitor_fdset_free_if_empty(mon_fdset); return; } } diff --git a/monitor/hmp.c b/monitor/hmp.c index 69c1b7e98a..460e8832f6 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1437,11 +1437,9 @@ static void monitor_event(void *opaque, QEMUChrEvent= event) monitor_resume(mon); } qemu_mutex_unlock(&mon->mon_lock); - mon_refcount++; break; =20 case CHR_EVENT_CLOSED: - mon_refcount--; monitor_fdsets_cleanup(); break; =20 diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 252de85681..cb628f681d 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -168,7 +168,6 @@ extern bool qmp_dispatcher_co_shutdown; extern QmpCommandList qmp_commands, qmp_cap_negotiation_commands; extern QemuMutex monitor_lock; extern MonitorList mon_list; -extern int mon_refcount; =20 extern HMPCommand hmp_cmds[]; =20 diff --git a/monitor/monitor.c b/monitor/monitor.c index 01ede1babd..db52a9c7ef 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -71,7 +71,6 @@ static GHashTable *monitor_qapi_event_state; static GHashTable *coroutine_mon; /* Maps Coroutine* to Monitor* */ =20 MonitorList mon_list; -int mon_refcount; static bool monitor_destroyed; =20 Monitor *monitor_cur(void) diff --git a/monitor/qmp.c b/monitor/qmp.c index a239945e8d..5e538f34c0 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -466,7 +466,6 @@ static void monitor_qmp_event(void *opaque, QEMUChrEven= t event) data =3D qmp_greeting(mon); qmp_send_response(mon, data); qobject_unref(data); - mon_refcount++; break; case CHR_EVENT_CLOSED: /* @@ -479,7 +478,6 @@ static void monitor_qmp_event(void *opaque, QEMUChrEven= t event) json_message_parser_destroy(&mon->parser); json_message_parser_init(&mon->parser, handle_qmp_command, mon, NULL); - mon_refcount--; monitor_fdsets_cleanup(); break; case CHR_EVENT_BREAK: diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 18e2f7f282..c7f6897d78 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -514,11 +514,6 @@ static QTestState *qtest_init_internal(const char *qem= u_bin, kill(s->qemu_pid, SIGSTOP); } #endif - - /* ask endianness of the target */ - - s->big_endian =3D qtest_query_target_endianness(s); - return s; } =20 @@ -527,11 +522,21 @@ QTestState *qtest_init_without_qmp_handshake(const ch= ar *extra_args) return qtest_init_internal(qtest_qemu_binary(NULL), extra_args); } =20 +QTestState *qtest_init_with_env_no_handshake(const char *var, + const char *extra_args) +{ + return qtest_init_internal(qtest_qemu_binary(var), extra_args); +} + QTestState *qtest_init_with_env(const char *var, const char *extra_args) { QTestState *s =3D qtest_init_internal(qtest_qemu_binary(var), extra_ar= gs); QDict *greeting; =20 + /* ask endianness of the target */ + + s->big_endian =3D qtest_query_target_endianness(s); + /* Read the QMP greeting and then do the handshake */ greeting =3D qtest_qmp_receive(s); qobject_unref(greeting); diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index beb96b18eb..c261b7e0b3 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -68,6 +68,8 @@ QTestState *qtest_init(const char *extra_args); */ QTestState *qtest_init_with_env(const char *var, const char *extra_args); =20 +QTestState *qtest_init_with_env_no_handshake(const char *var, + const char *extra_args); /** * qtest_init_without_qmp_handshake: * @extra_args: other arguments to pass to QEMU. CAUTION: these diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 22b07bc0ec..eb4d5948e0 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -64,6 +64,7 @@ static QTestMigrationState dst_state; #define DIRTYLIMIT_TOLERANCE_RANGE 25 /* MB/s */ =20 #define ANALYZE_SCRIPT "scripts/analyze-migration.py" +#define VMSTATE_CHECKER_SCRIPT "scripts/vmstate-static-checker.py" =20 #define QEMU_VM_FILE_MAGIC 0x5145564d #define FILE_TEST_FILENAME "migfile" @@ -1589,6 +1590,85 @@ static void test_analyze_script(void) test_migrate_end(from, to, false); cleanup("migfile"); } + +static void test_vmstate_checker_script(void) +{ + g_autofree gchar *cmd_src =3D NULL; + g_autofree gchar *cmd_dst =3D NULL; + g_autofree gchar *vmstate_src =3D NULL; + g_autofree gchar *vmstate_dst =3D NULL; + const char *machine_alias, *machine_opts =3D ""; + g_autofree char *machine =3D NULL; + const char *arch =3D qtest_get_arch(); + int pid, wstatus; + const char *python =3D g_getenv("PYTHON"); + + if (!getenv(QEMU_ENV_SRC) && !getenv(QEMU_ENV_DST)) { + g_test_skip("Test needs two different QEMU versions"); + return; + } + + if (!python) { + g_test_skip("PYTHON variable not set"); + return; + } + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + if (g_str_equal(arch, "i386")) { + machine_alias =3D "pc"; + } else { + machine_alias =3D "q35"; + } + } else if (g_str_equal(arch, "s390x")) { + machine_alias =3D "s390-ccw-virtio"; + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + machine_alias =3D "pseries"; + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + machine_alias =3D "virt"; + } else { + g_assert_not_reached(); + } + + if (!qtest_has_machine(machine_alias)) { + g_autofree char *msg =3D g_strdup_printf("machine %s not supported= ", machine_alias); + g_test_skip(msg); + return; + } + + machine =3D resolve_machine_version(machine_alias, QEMU_ENV_SRC, + QEMU_ENV_DST); + + vmstate_src =3D g_strdup_printf("%s/vmstate-src", tmpfs); + vmstate_dst =3D g_strdup_printf("%s/vmstate-dst", tmpfs); + + cmd_dst =3D g_strdup_printf("-machine %s,%s -dump-vmstate %s", + machine, machine_opts, vmstate_dst); + cmd_src =3D g_strdup_printf("-machine %s,%s -dump-vmstate %s", + machine, machine_opts, vmstate_src); + + qtest_init_with_env_no_handshake(QEMU_ENV_SRC, cmd_src); + qtest_init_with_env_no_handshake(QEMU_ENV_DST, cmd_dst); + + pid =3D fork(); + if (!pid) { + close(1); + open("/dev/null", O_WRONLY); + execl(python, python, VMSTATE_CHECKER_SCRIPT, + "-s", vmstate_src, + "-d", vmstate_dst, + NULL); + g_assert_not_reached(); + } + + g_assert(waitpid(pid, &wstatus, 0) =3D=3D pid); + if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) !=3D 0) { + g_test_message("Failed to run vmstate-static-checker.py"); + g_test_fail(); + } + + cleanup("vmstate-src"); + cleanup("vmstate-dst"); +} #endif =20 static void test_precopy_common(MigrateCommon *args) @@ -3522,6 +3602,8 @@ int main(int argc, char **argv) migration_test_add("/migration/bad_dest", test_baddest); #ifndef _WIN32 migration_test_add("/migration/analyze-script", test_analyze_script); + migration_test_add("/migration/vmstate-checker-script", + test_vmstate_checker_script); #endif =20 /* --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992651; cv=none; d=zohomail.com; s=zohoarc; b=TpnKKXMzCTqBxrSuJBjMAbEm1EihTDsjfcPqKilmlDpyum847xTN+TwKjT+AAPADcS1xL7f/GRoyR4uyS++wWRfaJYn/PAi75KlxnhJI5RfN63hi0ZUpGaSKyB8wF7rjtNy9gX+qruVngjN0Ejqn8V6iERwXshaeKrhgJf3XaOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992651; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Za/MdoTjYF8RTE34hqR6WeoRMReozqYIC59R2HEqRgQ=; b=A+6v7kpK18Sj9pxsNjxSnB4B5ojxyPh5s4n0uMTL2ZFXiImE7F/mIc1LE1sxQnJyOK4E8pZxmsFNrcCm+jROK1xpXrqpfItYhG4BCzeD7zlugAjZHCtGos5lAQ/sFk4qfRz1xcRGcv260Phhdok3AHIbtqJZ95+FyxiDyHt5JxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992651163984.141731120437; Fri, 21 Jun 2024 10:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTR-0003K8-P3; Fri, 21 Jun 2024 13:54:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTP-0003JA-GR for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:55 -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 1sKiTN-0003Km-Vk for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:55 -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 D4F6C1FB83; Fri, 21 Jun 2024 17:54:52 +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 A82D013AAA; Fri, 21 Jun 2024 17:54:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2AR7G2u+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Za/MdoTjYF8RTE34hqR6WeoRMReozqYIC59R2HEqRgQ=; b=SDTez2cWPSNIVtj3PfquviaHkcmg6uyZPWBTz+7FAlM65x9ytc8ax1FMNKzaQgR6mGY+tJ +adXO0W7cI8bXGOrX7Wbpf3ThwmW0pxsh0/yW0LN9vu8QIHvNovEJDDGLpY0OwnUrqoafr jF9C9b7C1zkDChobUaRvMDMUXQ955xo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Za/MdoTjYF8RTE34hqR6WeoRMReozqYIC59R2HEqRgQ=; b=x8eOSEAcq4j/nQgVpBbIPDdF6n9EvYQR5Bj+urd8jdkDX6bLyVoUFu2o4gPAZ2gtkvX3gu f5yU9TYQHnQ2a7CA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Za/MdoTjYF8RTE34hqR6WeoRMReozqYIC59R2HEqRgQ=; b=SDTez2cWPSNIVtj3PfquviaHkcmg6uyZPWBTz+7FAlM65x9ytc8ax1FMNKzaQgR6mGY+tJ +adXO0W7cI8bXGOrX7Wbpf3ThwmW0pxsh0/yW0LN9vu8QIHvNovEJDDGLpY0OwnUrqoafr jF9C9b7C1zkDChobUaRvMDMUXQ955xo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Za/MdoTjYF8RTE34hqR6WeoRMReozqYIC59R2HEqRgQ=; b=x8eOSEAcq4j/nQgVpBbIPDdF6n9EvYQR5Bj+urd8jdkDX6bLyVoUFu2o4gPAZ2gtkvX3gu f5yU9TYQHnQ2a7CA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 08/28] monitor: Simplify fdset and fd removal Date: Fri, 21 Jun 2024 14:54:14 -0300 Message-Id: <20240621175434.31180-9-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; 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: 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: 1718992653154100007 Content-Type: text/plain; charset="utf-8" Remove fds right away instead of setting the ->removed flag. We don't need the extra complexity of having a cleanup function reap the removed entries at a later time. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- monitor/fds.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/monitor/fds.c b/monitor/fds.c index 76199d4b3b..e7619a6103 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -43,7 +43,6 @@ struct mon_fd_t { typedef struct MonFdsetFd MonFdsetFd; struct MonFdsetFd { int fd; - bool removed; char *opaque; QLIST_ENTRY(MonFdsetFd) next; }; @@ -193,20 +192,6 @@ static void monitor_fdset_fd_free(MonFdsetFd *mon_fdse= t_fd) g_free(mon_fdset_fd); } =20 -static void monitor_fdset_cleanup(MonFdset *mon_fdset) -{ - MonFdsetFd *mon_fdset_fd; - MonFdsetFd *mon_fdset_fd_next; - - QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_n= ext) { - if (mon_fdset_fd->removed) { - monitor_fdset_fd_free(mon_fdset_fd); - } - } - - monitor_fdset_free_if_empty(mon_fdset); -} - void monitor_fdsets_cleanup(void) { MonFdset *mon_fdset; @@ -281,7 +266,7 @@ void qmp_get_win32_socket(const char *infos, const char= *fdname, Error **errp) void qmp_remove_fd(int64_t fdset_id, bool has_fd, int64_t fd, Error **errp) { MonFdset *mon_fdset; - MonFdsetFd *mon_fdset_fd; + MonFdsetFd *mon_fdset_fd, *mon_fdset_fd_next; char fd_str[60]; =20 QEMU_LOCK_GUARD(&mon_fdsets_lock); @@ -289,21 +274,22 @@ void qmp_remove_fd(int64_t fdset_id, bool has_fd, int= 64_t fd, Error **errp) if (mon_fdset->id !=3D fdset_id) { continue; } - QLIST_FOREACH(mon_fdset_fd, &mon_fdset->fds, next) { + QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, + mon_fdset_fd_next) { if (has_fd) { if (mon_fdset_fd->fd !=3D fd) { continue; } - mon_fdset_fd->removed =3D true; + monitor_fdset_fd_free(mon_fdset_fd); break; } else { - mon_fdset_fd->removed =3D true; + monitor_fdset_fd_free(mon_fdset_fd); } } if (has_fd && !mon_fdset_fd) { goto error; } - monitor_fdset_cleanup(mon_fdset); + monitor_fdset_free_if_empty(mon_fdset); return; } =20 @@ -413,7 +399,6 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_= id, int64_t fdset_id, =20 mon_fdset_fd =3D g_malloc0(sizeof(*mon_fdset_fd)); mon_fdset_fd->fd =3D fd; - mon_fdset_fd->removed =3D false; mon_fdset_fd->opaque =3D g_strdup(opaque); QLIST_INSERT_HEAD(&mon_fdset->fds, mon_fdset_fd, next); =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992540; cv=none; d=zohomail.com; s=zohoarc; b=kif8yz/8Y5ksuV22qbNwG9DyQG0Ykn7uTiNhJdxYMB9emWisCj75HIhQlQSWhT8A8sjDTgvQhcK9HAXo8z+lI+77iBwbZx7dWeq55kCsKbMjpU1zoEtCjrrIlvG3FPcL6dmX9os83rlrKPNqn73jb0VCFB8e8tvRoBpHHkMcztA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992540; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jN1SnHdsTSkY/VL7VN47UOFrwpUi7Yv/L/E/snGVRF0=; b=N8KNFm+d0O0jIcvv4FDn+ocL8JnPcxsyHwqJy61dQVs6/kq5zd2xuOe7zntNBm2aGebCiHJKH5NltgV7sHeBLeAP+OhsY9s54UYopL2JFwPei1uvK5Af4EtcKRCTWvndiZvPoOgQYigoPnoMPjIDixGnZ9AH1fMy8hGMgo51VXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992540449789.9420314353994; Fri, 21 Jun 2024 10:55:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTS-0003KA-12; Fri, 21 Jun 2024 13:54:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTR-0003Js-Cd for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:57 -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 1sKiTP-0003Kw-PB for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:57 -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 774851F7F2; Fri, 21 Jun 2024 17:54:54 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4CF8813AAA; Fri, 21 Jun 2024 17:54:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iNsUBW2+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jN1SnHdsTSkY/VL7VN47UOFrwpUi7Yv/L/E/snGVRF0=; b=h7SCQlitth1JxjgOFpt4qJv+U7Zql1frMn/6r9rtdxotKIRGs8GyhnNmfQCORLfv+nk0SO 5XTf1q4rA6WFmvw7XyukJTA0s0X0Znms1+cntpnKCyiiRxzXJOpyn8ys/v3FU/PTlrLdme ABRbdBReCtWgjDILTWj2ho7D35MSqsw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jN1SnHdsTSkY/VL7VN47UOFrwpUi7Yv/L/E/snGVRF0=; b=kYR7dSj8mnRvlXzxs3TF37DPRuYzkq5ewaBjjqOdE/HEFcp1gZrm5+3mMo+2rxuWGToQHV M363OjJeKvUiyzDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jN1SnHdsTSkY/VL7VN47UOFrwpUi7Yv/L/E/snGVRF0=; b=h7SCQlitth1JxjgOFpt4qJv+U7Zql1frMn/6r9rtdxotKIRGs8GyhnNmfQCORLfv+nk0SO 5XTf1q4rA6WFmvw7XyukJTA0s0X0Znms1+cntpnKCyiiRxzXJOpyn8ys/v3FU/PTlrLdme ABRbdBReCtWgjDILTWj2ho7D35MSqsw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jN1SnHdsTSkY/VL7VN47UOFrwpUi7Yv/L/E/snGVRF0=; b=kYR7dSj8mnRvlXzxs3TF37DPRuYzkq5ewaBjjqOdE/HEFcp1gZrm5+3mMo+2rxuWGToQHV M363OjJeKvUiyzDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 09/28] monitor: Report errors from monitor_fdset_dup_fd_add Date: Fri, 21 Jun 2024 14:54:15 -0300 Message-Id: <20240621175434.31180-10-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; 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: 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: 1718992540749100001 Content-Type: text/plain; charset="utf-8" I'm keeping the EACCES because callers expect to be able to look at errno. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- include/monitor/monitor.h | 2 +- monitor/fds.c | 10 +++++++++- stubs/fdset.c | 2 +- util/osdep.c | 10 +--------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index fd9b3f538c..c3740ec616 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -51,7 +51,7 @@ int monitor_read_password(MonitorHMP *mon, ReadLineFunc *= readline_func, =20 AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_i= d, const char *opaque, Error **errp); -int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags); +int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags, Error **errp); void monitor_fdset_dup_fd_remove(int dup_fd); =20 void monitor_register_hmp(const char *name, bool info, diff --git a/monitor/fds.c b/monitor/fds.c index e7619a6103..d8c6b395b0 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -409,9 +409,10 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset= _id, int64_t fdset_id, return fdinfo; } =20 -int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags) +int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags, Error **errp) { #ifdef _WIN32 + error_setg(errp, "Platform does not support fd passing (fdset)"); return -ENOENT; #else MonFdset *mon_fdset; @@ -431,6 +432,8 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int flag= s) QLIST_FOREACH(mon_fdset_fd, &mon_fdset->fds, next) { mon_fd_flags =3D fcntl(mon_fdset_fd->fd, F_GETFL); if (mon_fd_flags =3D=3D -1) { + error_setg(errp, "Failed to read file status flags for fd= =3D%d", + mon_fdset_fd->fd); return -1; } =20 @@ -442,11 +445,15 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int fl= ags) =20 if (fd =3D=3D -1) { errno =3D EACCES; + error_setg(errp, + "Failed to find file descriptor with matching flags= =3D0x%x", + flags); return -1; } =20 dup_fd =3D qemu_dup_flags(fd, flags); if (dup_fd =3D=3D -1) { + error_setg(errp, "Failed to dup() given file descriptor fd=3D%= d", fd); return -1; } =20 @@ -456,6 +463,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int flag= s) return dup_fd; } =20 + error_setg(errp, "Failed to find fdset /dev/fdset/%" PRId64, fdset_id); errno =3D ENOENT; return -1; #endif diff --git a/stubs/fdset.c b/stubs/fdset.c index 389e368a29..2950fd91fd 100644 --- a/stubs/fdset.c +++ b/stubs/fdset.c @@ -3,7 +3,7 @@ #include "monitor/monitor.h" #include "../monitor/monitor-internal.h" =20 -int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags) +int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags, Error **errp) { errno =3D ENOSYS; return -1; diff --git a/util/osdep.c b/util/osdep.c index 756de9a745..5bbfdfac7a 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -310,7 +310,6 @@ qemu_open_internal(const char *name, int flags, mode_t = mode, Error **errp) /* Attempt dup of fd from fd set */ if (strstart(name, "/dev/fdset/", &fdset_id_str)) { int64_t fdset_id; - int dupfd; =20 fdset_id =3D qemu_parse_fdset(fdset_id_str); if (fdset_id =3D=3D -1) { @@ -319,14 +318,7 @@ qemu_open_internal(const char *name, int flags, mode_t= mode, Error **errp) return -1; } =20 - dupfd =3D monitor_fdset_dup_fd_add(fdset_id, flags); - if (dupfd =3D=3D -1) { - error_setg_errno(errp, errno, "Could not dup FD for %s flags %= x", - name, flags); - return -1; - } - - return dupfd; + return monitor_fdset_dup_fd_add(fdset_id, flags, errp); } #endif =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992571; cv=none; d=zohomail.com; s=zohoarc; b=DsQ9H6r17KmXiYRhuXb1UaJDz1fSZuwU2cScasuJ3uVFa53cj9+RRDUTdVkfPsKYfoybNpQ419br/88ffcB1TqlmJJ2z8Fn+Sj29yc6bQpt1BjnLv2Rf9jqX3/hVAPRCq74qLYc2QxyikO4OeeDNyecb527kkrrZZH3a+nooOFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992571; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iUojXKKi7au5lbz0GBdgGak+ICpTnFKCQZykBCuYuWk=; b=jqBDb4OJj0jvRtXH0sq0SIWhSmzdg/aB+Y1S6/ORZl5JuF6JbzFaJZ6IP84tKNY7sqSDZ0taQxOIuIDhnEWYGfgs2S8O2KjMc2AKXTcPrHvF22SXBiNz5tdgRt6mRXlPdP2dbc3aLFMDCpEOhSqfRY2nQDIvVJjTEGLJDJTJ09Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992571129359.7147342458819; Fri, 21 Jun 2024 10:56:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTU-0003Kn-AK; Fri, 21 Jun 2024 13:55:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTT-0003KQ-6n for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:59 -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 1sKiTR-0003LA-Gq for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:54:58 -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 5ED771FB83; Fri, 21 Jun 2024 17:54:56 +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 E2A9E13AAA; Fri, 21 Jun 2024 17:54:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uFyyKW6+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992496; 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=iUojXKKi7au5lbz0GBdgGak+ICpTnFKCQZykBCuYuWk=; b=Ulr/n9AYCOICcbBvq3/CDUoMvUnjdYaJNrMrx5Br/vlZX54irgj276dp8uBjFEdQBZH0QC rSbQdYv2rkSHSWeM06c6QF/p019QahGegI36dLDcHBS8fo/OI0VWqrZFIitXAmhPboLYAP Lwog2ejrxapzi9ZqJybDg3rZWFMitlI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992496; 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=iUojXKKi7au5lbz0GBdgGak+ICpTnFKCQZykBCuYuWk=; b=xhZ3w1YHBnyWCpprJsAcDvIdEdv3TK8KSN3/Uo6Gi98To1AlF3/HTRGI/7F1GPUSd/n69N zlLe1GVmkIRHHcDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992496; 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=iUojXKKi7au5lbz0GBdgGak+ICpTnFKCQZykBCuYuWk=; b=Ulr/n9AYCOICcbBvq3/CDUoMvUnjdYaJNrMrx5Br/vlZX54irgj276dp8uBjFEdQBZH0QC rSbQdYv2rkSHSWeM06c6QF/p019QahGegI36dLDcHBS8fo/OI0VWqrZFIitXAmhPboLYAP Lwog2ejrxapzi9ZqJybDg3rZWFMitlI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992496; 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=iUojXKKi7au5lbz0GBdgGak+ICpTnFKCQZykBCuYuWk=; b=xhZ3w1YHBnyWCpprJsAcDvIdEdv3TK8KSN3/Uo6Gi98To1AlF3/HTRGI/7F1GPUSd/n69N zlLe1GVmkIRHHcDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 10/28] io: Stop using qemu_open_old in channel-file Date: Fri, 21 Jun 2024 14:54:16 -0300 Message-Id: <20240621175434.31180-11-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.30 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_THREE(0.00)[4] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 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: 1718992572814100012 We want to make use of the Error object to report fdset errors from qemu_open_internal() and passing the error pointer to qemu_open_old() would require changing all callers. Move the file channel to the new API instead. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- io/channel-file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/io/channel-file.c b/io/channel-file.c index 6436cfb6ae..2ea8d08360 100644 --- a/io/channel-file.c +++ b/io/channel-file.c @@ -68,11 +68,13 @@ qio_channel_file_new_path(const char *path, =20 ioc =3D QIO_CHANNEL_FILE(object_new(TYPE_QIO_CHANNEL_FILE)); =20 - ioc->fd =3D qemu_open_old(path, flags, mode); + if (flags & O_CREAT) { + ioc->fd =3D qemu_create(path, flags & ~O_CREAT, mode, errp); + } else { + ioc->fd =3D qemu_open(path, flags, errp); + } if (ioc->fd < 0) { object_unref(OBJECT(ioc)); - error_setg_errno(errp, errno, - "Unable to open %s", path); return NULL; } =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992548; cv=none; d=zohomail.com; s=zohoarc; b=QFE5YAOI0VkNo1mGxW3RhaBAZdo2EeP4uRBahZcr28q6aCbDQaDWY/hYl6ctGVVuhLIsMucLxb1TPWE9ARu5rmNFd5IqEgehYpsUzPue3nZThNLmZ1HVL7EkU1miEScAb742+sZcF0jM0PU+oYh9/jJfGeLM+IeOIKEbWsvQN1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992548; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hlkxaYgY8mSil0KBcsjbPyn9bEQ8GI9qfd/aA4XAzyM=; b=TAJBw/59xJbgryASbxmdDMN/tvw34lE/5JAUN13VH6FV+cHKl09d5dAykALNa+c3yuaWXVfkQTmkLHDzOWY5JQ9mE1ic6QvqXP8A0F8enVAdhlk0knXznY6bpk/s0wpTHznd60xvKJhlksE+ZhzpydxQd8bfq3Ph3WRkp+5VL+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992548423917.6350568705183; Fri, 21 Jun 2024 10:55:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTW-0003LM-Qk; Fri, 21 Jun 2024 13:55:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTV-0003Kw-8T for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:01 -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 1sKiTT-0003LP-CC for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:01 -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 342901FB84; Fri, 21 Jun 2024 17:54:58 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C126813AAA; Fri, 21 Jun 2024 17:54:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 6NhPIXC+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992498; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlkxaYgY8mSil0KBcsjbPyn9bEQ8GI9qfd/aA4XAzyM=; b=0hFzHWiQzZQHSIYJ1qb9vfEQ9iIcqRs7/QDcniPIZ/IUeud+LvXqGpUrmXH3sXm+Kw3Jlk JHW+dODlCL/UmAXEKZwMoQJVTQBYDpywlK0tvedb1+ZSzqXim7dlt7RP3ixhkMKTa3VuNG dq2IkxYUz765OtF0uebPEPinIwBxgto= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992498; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlkxaYgY8mSil0KBcsjbPyn9bEQ8GI9qfd/aA4XAzyM=; b=YB9EAARuGs/hAgVyJ66Uqsh6YbBYQmNsBBD+lg8WlcscY8bPx788w91vGRUIPE8RXcbpZf m0Y+AXj6sL84cHBQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992498; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlkxaYgY8mSil0KBcsjbPyn9bEQ8GI9qfd/aA4XAzyM=; b=0hFzHWiQzZQHSIYJ1qb9vfEQ9iIcqRs7/QDcniPIZ/IUeud+LvXqGpUrmXH3sXm+Kw3Jlk JHW+dODlCL/UmAXEKZwMoQJVTQBYDpywlK0tvedb1+ZSzqXim7dlt7RP3ixhkMKTa3VuNG dq2IkxYUz765OtF0uebPEPinIwBxgto= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992498; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlkxaYgY8mSil0KBcsjbPyn9bEQ8GI9qfd/aA4XAzyM=; b=YB9EAARuGs/hAgVyJ66Uqsh6YbBYQmNsBBD+lg8WlcscY8bPx788w91vGRUIPE8RXcbpZf m0Y+AXj6sL84cHBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , Markus Armbruster Subject: [PULL 11/28] migration: Add direct-io parameter Date: Fri, 21 Jun 2024 14:54:17 -0300 Message-Id: <20240621175434.31180-12-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; 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: 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: 1718992549152100003 Content-Type: text/plain; charset="utf-8" Add the direct-io migration parameter that tells the migration code to use O_DIRECT when opening the migration stream file whenever possible. This is currently only used with the mapped-ram migration that has a clear window guaranteed to perform aligned writes. Acked-by: Markus Armbruster Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- include/qemu/osdep.h | 2 ++ migration/migration-hmp-cmds.c | 11 +++++++++++ migration/options.c | 35 ++++++++++++++++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 21 +++++++++++++++++--- util/osdep.c | 9 +++++++++ 6 files changed, 76 insertions(+), 3 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index f61edcfdc2..191916f38e 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -612,6 +612,8 @@ int qemu_lock_fd_test(int fd, int64_t start, int64_t le= n, bool exclusive); bool qemu_has_ofd_lock(void); #endif =20 +bool qemu_has_direct_io(void); + #if defined(__HAIKU__) && defined(__i386__) #define FMT_pid "%ld" #elif defined(WIN64) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 9f0e8029e0..7d608d26e1 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -351,6 +351,13 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_MODE), qapi_enum_lookup(&MigMode_lookup, params->mode)); + + if (params->has_direct_io) { + monitor_printf(mon, "%s: %s\n", + MigrationParameter_str( + MIGRATION_PARAMETER_DIRECT_IO), + params->direct_io ? "on" : "off"); + } } =20 qapi_free_MigrationParameters(params); @@ -624,6 +631,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_mode =3D true; visit_type_MigMode(v, param, &p->mode, &err); break; + case MIGRATION_PARAMETER_DIRECT_IO: + p->has_direct_io =3D true; + visit_type_bool(v, param, &p->direct_io, &err); + break; default: assert(0); } diff --git a/migration/options.c b/migration/options.c index 5ab5b6d85d..645f55003d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -702,6 +702,25 @@ bool migrate_cpu_throttle_tailslow(void) return s->parameters.cpu_throttle_tailslow; } =20 +bool migrate_direct_io(void) +{ + MigrationState *s =3D migrate_get_current(); + + /* + * O_DIRECT is only supported with mapped-ram and multifd. + * + * mapped-ram is needed because filesystems impose restrictions on + * O_DIRECT IO alignment (see MAPPED_RAM_FILE_OFFSET_ALIGNMENT). + * + * multifd is needed to keep the unaligned portion of the stream + * isolated to the main migration thread while multifd channels + * process the aligned data with O_DIRECT enabled. + */ + return s->parameters.direct_io && + s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM] && + s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; +} + uint64_t migrate_downtime_limit(void) { MigrationState *s =3D migrate_get_current(); @@ -905,6 +924,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->mode =3D s->parameters.mode; params->has_zero_page_detection =3D true; params->zero_page_detection =3D s->parameters.zero_page_detection; + params->has_direct_io =3D true; + params->direct_io =3D s->parameters.direct_io; =20 return params; } @@ -937,6 +958,7 @@ void migrate_params_init(MigrationParameters *params) params->has_vcpu_dirty_limit =3D true; params->has_mode =3D true; params->has_zero_page_detection =3D true; + params->has_direct_io =3D true; } =20 /* @@ -1110,6 +1132,11 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (params->has_direct_io && params->direct_io && !qemu_has_direct_io(= )) { + error_setg(errp, "No build-time support for direct-io"); + return false; + } + return true; } =20 @@ -1216,6 +1243,10 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, if (params->has_zero_page_detection) { dest->zero_page_detection =3D params->zero_page_detection; } + + if (params->has_direct_io) { + dest->direct_io =3D params->direct_io; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1341,6 +1372,10 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) if (params->has_zero_page_detection) { s->parameters.zero_page_detection =3D params->zero_page_detection; } + + if (params->has_direct_io) { + s->parameters.direct_io =3D params->direct_io; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) diff --git a/migration/options.h b/migration/options.h index 4b21cc2669..a2397026db 100644 --- a/migration/options.h +++ b/migration/options.h @@ -69,6 +69,7 @@ uint32_t migrate_checkpoint_delay(void); uint8_t migrate_cpu_throttle_increment(void); uint8_t migrate_cpu_throttle_initial(void); bool migrate_cpu_throttle_tailslow(void); +bool migrate_direct_io(void); uint64_t migrate_downtime_limit(void); uint8_t migrate_max_cpu_throttle(void); uint64_t migrate_max_bandwidth(void); diff --git a/qapi/migration.json b/qapi/migration.json index 470f746cc5..de6c8b0444 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -821,6 +821,10 @@ # See description in @ZeroPageDetection. Default is 'multifd'. # (since 9.0) # +# @direct-io: Open migration files with O_DIRECT when possible. This +# only has effect if the @mapped-ram capability is enabled. +# (Since 9.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @@ -845,7 +849,8 @@ { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= }, 'vcpu-dirty-limit', 'mode', - 'zero-page-detection'] } + 'zero-page-detection', + 'direct-io'] } =20 ## # @MigrateSetParameters: @@ -991,6 +996,10 @@ # See description in @ZeroPageDetection. Default is 'multifd'. # (since 9.0) # +# @direct-io: Open migration files with O_DIRECT when possible. This +# only has effect if the @mapped-ram capability is enabled. +# (Since 9.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @@ -1030,7 +1039,8 @@ 'features': [ 'unstable' ] }, '*vcpu-dirty-limit': 'uint64', '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection'} } + '*zero-page-detection': 'ZeroPageDetection', + '*direct-io': 'bool' } } =20 ## # @migrate-set-parameters: @@ -1190,6 +1200,10 @@ # See description in @ZeroPageDetection. Default is 'multifd'. # (since 9.0) # +# @direct-io: Open migration files with O_DIRECT when possible. This +# only has effect if the @mapped-ram capability is enabled. +# (Since 9.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @@ -1226,7 +1240,8 @@ 'features': [ 'unstable' ] }, '*vcpu-dirty-limit': 'uint64', '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection'} } + '*zero-page-detection': 'ZeroPageDetection', + '*direct-io': 'bool' } } =20 ## # @query-migrate-parameters: diff --git a/util/osdep.c b/util/osdep.c index 5bbfdfac7a..770369831b 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -282,6 +282,15 @@ int qemu_lock_fd_test(int fd, int64_t start, int64_t l= en, bool exclusive) } #endif =20 +bool qemu_has_direct_io(void) +{ +#ifdef O_DIRECT + return true; +#else + return false; +#endif +} + static int qemu_open_cloexec(const char *name, int flags, mode_t mode) { int ret; --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992583; cv=none; d=zohomail.com; s=zohoarc; b=Y6qOqr6ppePIwasmmMgemGtXjkMbmdCNN/Cr7tCQGOQf52bUwdBBGXw1milCuPQfwzjkyzu9Y8A0BTVnpV8hCJJvLHch5IcP9QSQWwlOHR+fCMcMwt67/J4RCFKWCU5f2ARlxAW5aR+giC2iFUZtsr8MYHC3P169aRLV8S4BKEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992583; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k+HmQP3h3Mm2DrDGsClDzMbx0rC1gh3vI8zM8d67lXI=; b=hak1whucqoRx3P3nmtDGbWZEHYGJXdyfPmB92/lGxMtPOzJH6xH3GwGmxK5FrFTZclieHTCSKpX6NjlnnQ7e/M/V7J5juUtVlXzPP66anTXfi4UQRZz4m9Xij+exRsDp/TBvSOiZfBWs9pke2hu2OJXWlAXO6Eg9/5bhc1rdU+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992582999910.5915149452983; Fri, 21 Jun 2024 10:56:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTY-0003Pt-VD; Fri, 21 Jun 2024 13:55:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTX-0003LU-3n for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:03 -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 1sKiTV-0003Lb-6V for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:02 -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 D241721B37; Fri, 21 Jun 2024 17:54:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A4DFA13AAA; Fri, 21 Jun 2024 17:54:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OGaDGnK+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:54:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+HmQP3h3Mm2DrDGsClDzMbx0rC1gh3vI8zM8d67lXI=; b=NE4c6m6V8nSaEyL50t9Ebl+eTBXlddJ2jjl5RH2uo4FJF5q4pAHOCe+JRUvRGn3GKIF0sI SFeThs4frx4VygkFZQfuNsKMNmn2rdAu6Jx5LDUlibsGimfa6zzsMc5Xnkx+HQG6l4fxxo Ut3WvEKQF86k4/Sfma2GAMKIz4vbB3M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+HmQP3h3Mm2DrDGsClDzMbx0rC1gh3vI8zM8d67lXI=; b=VlRwAn2pFtjSwnXXYZQumXgT8nRCYjuqcXp0pHyP7L/Af47bwyPYJnzuv1laA68+ip8gfF 0d2GbKKFOmB/UaCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=NE4c6m6V; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=VlRwAn2p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+HmQP3h3Mm2DrDGsClDzMbx0rC1gh3vI8zM8d67lXI=; b=NE4c6m6V8nSaEyL50t9Ebl+eTBXlddJ2jjl5RH2uo4FJF5q4pAHOCe+JRUvRGn3GKIF0sI SFeThs4frx4VygkFZQfuNsKMNmn2rdAu6Jx5LDUlibsGimfa6zzsMc5Xnkx+HQG6l4fxxo Ut3WvEKQF86k4/Sfma2GAMKIz4vbB3M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+HmQP3h3Mm2DrDGsClDzMbx0rC1gh3vI8zM8d67lXI=; b=VlRwAn2pFtjSwnXXYZQumXgT8nRCYjuqcXp0pHyP7L/Af47bwyPYJnzuv1laA68+ip8gfF 0d2GbKKFOmB/UaCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 12/28] migration/multifd: Add direct-io support Date: Fri, 21 Jun 2024 14:54:18 -0300 Message-Id: <20240621175434.31180-13-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: D241721B37 X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1718992584871100003 Content-Type: text/plain; charset="utf-8" When multifd is used along with mapped-ram, we can take benefit of a filesystem that supports the O_DIRECT flag and perform direct I/O in the multifd threads. This brings a significant performance improvement because direct-io writes bypass the page cache which would otherwise be thrashed by the multifd data which is unlikely to be needed again in a short period of time. To be able to use a multifd channel opened with O_DIRECT, we must ensure that a certain aligment is used. Filesystems usually require a block-size alignment for direct I/O. The way to achieve this is by enabling the mapped-ram feature, which already aligns its I/O properly (see MAPPED_RAM_FILE_OFFSET_ALIGNMENT at ram.c). By setting O_DIRECT on the multifd channels, all writes to the same file descriptor need to be aligned as well, even the ones that come from outside multifd, such as the QEMUFile I/O from the main migration code. This makes it impossible to use the same file descriptor for the QEMUFile and for the multifd channels. The various flags and metadata written by the main migration code will always be unaligned by virtue of their small size. To workaround this issue, we'll require a second file descriptor to be used exclusively for direct I/O. The second file descriptor can be obtained by QEMU by re-opening the migration file (already possible), or by being provided by the user or management application (support to be added in future patches). Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/file.c | 33 ++++++++++++++++++++++++++++----- migration/file.h | 1 - migration/migration.c | 23 +++++++++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/migration/file.c b/migration/file.c index a903710f06..db870f2cf0 100644 --- a/migration/file.c +++ b/migration/file.c @@ -50,12 +50,31 @@ void file_cleanup_outgoing_migration(void) outgoing_args.fname =3D NULL; } =20 +static void file_enable_direct_io(int *flags) +{ +#ifdef O_DIRECT + *flags |=3D O_DIRECT; +#else + /* it should have been rejected when setting the parameter */ + g_assert_not_reached(); +#endif +} + bool file_send_channel_create(gpointer opaque, Error **errp) { QIOChannelFile *ioc; int flags =3D O_WRONLY; bool ret =3D true; =20 + if (migrate_direct_io()) { + /* + * Enable O_DIRECT for the secondary channels. These are used + * for sending ram pages and writes should be guaranteed to be + * aligned to at least page size. + */ + file_enable_direct_io(&flags); + } + ioc =3D qio_channel_file_new_path(outgoing_args.fname, flags, 0, errp); if (!ioc) { ret =3D false; @@ -117,21 +136,25 @@ static gboolean file_accept_incoming_migration(QIOCha= nnel *ioc, return G_SOURCE_REMOVE; } =20 -void file_create_incoming_channels(QIOChannel *ioc, Error **errp) +static void file_create_incoming_channels(QIOChannel *ioc, char *filename, + Error **errp) { - int i, fd, channels =3D 1; + int i, channels =3D 1; g_autofree QIOChannel **iocs =3D NULL; + int flags =3D O_RDONLY; =20 if (migrate_multifd()) { channels +=3D migrate_multifd_channels(); + if (migrate_direct_io()) { + file_enable_direct_io(&flags); + } } =20 iocs =3D g_new0(QIOChannel *, channels); - fd =3D QIO_CHANNEL_FILE(ioc)->fd; iocs[0] =3D ioc; =20 for (i =3D 1; i < channels; i++) { - QIOChannelFile *fioc =3D qio_channel_file_new_dupfd(fd, errp); + QIOChannelFile *fioc =3D qio_channel_file_new_path(filename, flags= , 0, errp); =20 if (!fioc) { while (i) { @@ -171,7 +194,7 @@ void file_start_incoming_migration(FileMigrationArgs *f= ile_args, Error **errp) return; } =20 - file_create_incoming_channels(QIO_CHANNEL(fioc), errp); + file_create_incoming_channels(QIO_CHANNEL(fioc), filename, errp); } =20 int file_write_ramblock_iov(QIOChannel *ioc, const struct iovec *iov, diff --git a/migration/file.h b/migration/file.h index 7699c04677..9f71e87f74 100644 --- a/migration/file.h +++ b/migration/file.h @@ -20,7 +20,6 @@ void file_start_outgoing_migration(MigrationState *s, int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp); void file_cleanup_outgoing_migration(void); bool file_send_channel_create(gpointer opaque, Error **errp); -void file_create_incoming_channels(QIOChannel *ioc, Error **errp); int file_write_ramblock_iov(QIOChannel *ioc, const struct iovec *iov, int niov, RAMBlock *block, Error **errp); int multifd_file_recv_data(MultiFDRecvParams *p, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index e1b269624c..e03c80b3aa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -155,6 +155,16 @@ static bool migration_needs_seekable_channel(void) return migrate_mapped_ram(); } =20 +static bool migration_needs_extra_fds(void) +{ + /* + * When doing direct-io, multifd requires two different, + * non-duplicated file descriptors so we can use one of them for + * unaligned IO. + */ + return migrate_multifd() && migrate_direct_io(); +} + static bool transport_supports_seeking(MigrationAddress *addr) { if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { @@ -164,6 +174,12 @@ static bool transport_supports_seeking(MigrationAddres= s *addr) return false; } =20 +static bool transport_supports_extra_fds(MigrationAddress *addr) +{ + /* file: works because QEMU can open it multiple times */ + return addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE; +} + static bool migration_channels_and_transport_compatible(MigrationAddress *addr, Error **errp) @@ -180,6 +196,13 @@ migration_channels_and_transport_compatible(MigrationA= ddress *addr, return false; } =20 + if (migration_needs_extra_fds() && + !transport_supports_extra_fds(addr)) { + error_setg(errp, + "Migration requires a transport that allows for extra f= ds (e.g. file)"); + return false; + } + return true; } =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992555; cv=none; d=zohomail.com; s=zohoarc; b=bCOOxpbs1aJIxOOBKJ7RYnmIGW6gZlZThDK54Ptz4FT2JykdDnRVBHCX+DL5zaHFvSxGxoCVi1rE+e/g3Fva137zokupiprxdWTkm/xdr8+Kg0xGyhcZf84m1prbpC5mK4E/k9hDNx0Pfm+hkJ1+lUTbr1NgZhdP28Zw5vAKWvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992555; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2sG9YOGinTBqaVO3rdKf22gmGfh8tPzqmsvDWpjg9ZU=; b=CftLSYoSFzhPsAKcHjwzHX5kTVMkan4sY0OZPdpPcBpIVV+YCNwQH9ckmbgO64l2UOri24zRJtB7ZimVDtH0ybiy5yXF0YWiB6k4p67IP4ENjmSBuCi0UDOJ3meQW/tnaBHgybMCiH+NTm+jzP+WpeUseHeRTxEy87fIA17doQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992555739493.499765997336; Fri, 21 Jun 2024 10:55:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTa-0003SH-RN; Fri, 21 Jun 2024 13:55:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTY-0003Oq-Dj for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:04 -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 1sKiTW-0003Lo-Ke for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:04 -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 74EEB1FB89; Fri, 21 Jun 2024 17:55:01 +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 4985A13AAA; Fri, 21 Jun 2024 17:55:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GLcxBHS+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992501; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2sG9YOGinTBqaVO3rdKf22gmGfh8tPzqmsvDWpjg9ZU=; b=KIqih6GHfx0X4O4cjAHtaIOur0tJRhCeRK10CA4MAS/fgsLu4F1qVkvZod3OxzmKmPFcW6 jMj0g9HaYvrxi4hN43kMurWcUxHNMNQVBhBL5W15oD+tvo2BAeMCozNYyurKbk+xKzR+qI 1xHhgaAqE4HooZ+tbK+EUg8uKN3+qxs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992501; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2sG9YOGinTBqaVO3rdKf22gmGfh8tPzqmsvDWpjg9ZU=; b=4AjDnz1jh7fd4q3J0Rh5n5H8ZQiuGA/E2Zj9QmDZrsR/QyVpUWI87hMceXODrKtQfmrlQf lEUdgwhKnSoep6Ag== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992501; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2sG9YOGinTBqaVO3rdKf22gmGfh8tPzqmsvDWpjg9ZU=; b=KIqih6GHfx0X4O4cjAHtaIOur0tJRhCeRK10CA4MAS/fgsLu4F1qVkvZod3OxzmKmPFcW6 jMj0g9HaYvrxi4hN43kMurWcUxHNMNQVBhBL5W15oD+tvo2BAeMCozNYyurKbk+xKzR+qI 1xHhgaAqE4HooZ+tbK+EUg8uKN3+qxs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992501; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2sG9YOGinTBqaVO3rdKf22gmGfh8tPzqmsvDWpjg9ZU=; b=4AjDnz1jh7fd4q3J0Rh5n5H8ZQiuGA/E2Zj9QmDZrsR/QyVpUWI87hMceXODrKtQfmrlQf lEUdgwhKnSoep6Ag== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 13/28] tests/qtest/migration: Add tests for file migration with direct-io Date: Fri, 21 Jun 2024 14:54:19 -0300 Message-Id: <20240621175434.31180-14-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; 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: 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: 1718992556755100002 Content-Type: text/plain; charset="utf-8" The tests are only allowed to run in systems that know about the O_DIRECT flag and in filesystems which support it. Note: this also brings back migrate_set_parameter_bool() which went away when we removed the compression tests. I copied it verbatim. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 44 +++++++++++++++++++++++ tests/qtest/migration-helpers.h | 8 +++++ tests/qtest/migration-test.c | 62 +++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index ce6d6615b5..0ac49ceb54 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "qapi/qmp/qlist.h" #include "qemu/cutils.h" +#include "qemu/memalign.h" =20 #include "migration-helpers.h" =20 @@ -473,3 +474,46 @@ void migration_test_add(const char *path, void (*fn)(v= oid)) qtest_add_data_func_full(path, test, migration_test_wrapper, migration_test_destroy); } + +#ifdef O_DIRECT +/* + * Probe for O_DIRECT support on the filesystem. Since this is used + * for tests, be conservative, if anything fails, assume it's + * unsupported. + */ +bool probe_o_direct_support(const char *tmpfs) +{ + g_autofree char *filename =3D g_strdup_printf("%s/probe-o-direct", tmp= fs); + int fd, flags =3D O_CREAT | O_RDWR | O_TRUNC | O_DIRECT; + void *buf; + ssize_t ret, len; + uint64_t offset; + + fd =3D open(filename, flags, 0660); + if (fd < 0) { + unlink(filename); + return false; + } + + /* + * Using 1MB alignment as conservative choice to satisfy any + * plausible architecture default page size, and/or filesystem + * alignment restrictions. + */ + len =3D 0x100000; + offset =3D 0x100000; + + buf =3D qemu_try_memalign(len, len); + g_assert(buf); + + ret =3D pwrite(fd, buf, len, offset); + unlink(filename); + g_free(buf); + + if (ret < 0) { + return false; + } + + return true; +} +#endif diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index 1339835698..50095fca4a 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -54,5 +54,13 @@ char *find_common_machine_version(const char *mtype, con= st char *var1, const char *var2); char *resolve_machine_version(const char *alias, const char *var1, const char *var2); +#ifdef O_DIRECT +bool probe_o_direct_support(const char *tmpfs); +#else +static inline bool probe_o_direct_support(const char *tmpfs) +{ + return false; +} +#endif void migration_test_add(const char *path, void (*fn)(void)); #endif /* MIGRATION_HELPERS_H */ diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index eb4d5948e0..5c41d1b70e 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -408,6 +408,38 @@ static void migrate_set_parameter_str(QTestState *who,= const char *parameter, migrate_check_parameter_str(who, parameter, value); } =20 +static long long migrate_get_parameter_bool(QTestState *who, + const char *parameter) +{ + QDict *rsp; + int result; + + rsp =3D qtest_qmp_assert_success_ref( + who, "{ 'execute': 'query-migrate-parameters' }"); + result =3D qdict_get_bool(rsp, parameter); + qobject_unref(rsp); + return !!result; +} + +static void migrate_check_parameter_bool(QTestState *who, const char *para= meter, + int value) +{ + int result; + + result =3D migrate_get_parameter_bool(who, parameter); + g_assert_cmpint(result, =3D=3D, value); +} + +static void migrate_set_parameter_bool(QTestState *who, const char *parame= ter, + int value) +{ + qtest_qmp_assert_success(who, + "{ 'execute': 'migrate-set-parameters'," + "'arguments': { %s: %i } }", + parameter, value); + migrate_check_parameter_bool(who, parameter, value); +} + static void migrate_ensure_non_converge(QTestState *who) { /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ @@ -2235,6 +2267,33 @@ static void test_multifd_file_mapped_ram(void) test_file_common(&args, true); } =20 +static void *multifd_mapped_ram_dio_start(QTestState *from, QTestState *to) +{ + migrate_multifd_mapped_ram_start(from, to); + + migrate_set_parameter_bool(from, "direct-io", true); + migrate_set_parameter_bool(to, "direct-io", true); + + return NULL; +} + +static void test_multifd_file_mapped_ram_dio(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, + FILE_TEST_FILENAME); + MigrateCommon args =3D { + .connect_uri =3D uri, + .listen_uri =3D "defer", + .start_hook =3D multifd_mapped_ram_dio_start, + }; + + if (!probe_o_direct_support(tmpfs)) { + g_test_skip("Filesystem does not support O_DIRECT"); + return; + } + + test_file_common(&args, true); +} =20 static void test_precopy_tcp_plain(void) { @@ -3674,6 +3733,9 @@ int main(int argc, char **argv) migration_test_add("/migration/multifd/file/mapped-ram/live", test_multifd_file_mapped_ram_live); =20 + migration_test_add("/migration/multifd/file/mapped-ram/dio", + test_multifd_file_mapped_ram_dio); + #ifdef CONFIG_GNUTLS migration_test_add("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992604; cv=none; d=zohomail.com; s=zohoarc; b=K1PtXLKTGN/iRRUjkqN+kfAcUQm19te2BYl1wOcNBjjtZcFXEIloEPi+BaOWZIdkiexB2L7mzmPbbjuDOGzqwPkO7rklvYXVISiVqmPiveuxszgFWIW8s6W/eatDjILO5xdgz9bpniueGvbIo5zEj17kD2weez6uYip5Xk1A9Sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992604; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MkrcRNBtpDTsthhpbC7Y92TOWA0h/KuMNbfGLxSxh9U=; b=O8aI1Ohmxapn29bGfS4UHvb7nqjYSYwFnLseUJ4kSBWAls2ax7XfVF0avjrRjEmQms4e+BoDM0z7Vm9bNGlga56FhidoyWB68DReLNDMqGB8ypSXppbyNC2/1BveSeP8LHqZa4OBTt4PqJ/JSFe1FFMTrQgSvglVOT8/Q/+uHjI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171899260412288.86729722941573; Fri, 21 Jun 2024 10:56:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTb-0003Sf-NB; Fri, 21 Jun 2024 13:55:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTa-0003RU-1d for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:06 -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 1sKiTY-0003MD-Cz for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:05 -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 2534E1FB84; Fri, 21 Jun 2024 17:55: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 E106213AAA; Fri, 21 Jun 2024 17:55: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 yPQ3KXW+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992503; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkrcRNBtpDTsthhpbC7Y92TOWA0h/KuMNbfGLxSxh9U=; b=mNXBhqvcvzN2T3kQ3scZLiUQeXSGfSZADZjTDtPfmIyf8FZCtHABMGhlJtx1fNxzfzUy+o BwZ9kLRz90nrHDbW1Rgj2GmhqmsGJDc5PIQL3YAa2hm84XR04kXs64dRT9Q7Fj0uV1DYxT v74NWBZwn14wDJ+S3g4kVkFvKuTlzUw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992503; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkrcRNBtpDTsthhpbC7Y92TOWA0h/KuMNbfGLxSxh9U=; b=syU3YvuY/FLvVg0k5J1qO9joSZdeYMzs3wz3QC5wZ5aIyCVy6DWPL+rCOLyIIHtL7Fj3C6 WTIU9qtzNEScpMBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mNXBhqvc; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=syU3YvuY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992503; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkrcRNBtpDTsthhpbC7Y92TOWA0h/KuMNbfGLxSxh9U=; b=mNXBhqvcvzN2T3kQ3scZLiUQeXSGfSZADZjTDtPfmIyf8FZCtHABMGhlJtx1fNxzfzUy+o BwZ9kLRz90nrHDbW1Rgj2GmhqmsGJDc5PIQL3YAa2hm84XR04kXs64dRT9Q7Fj0uV1DYxT v74NWBZwn14wDJ+S3g4kVkFvKuTlzUw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992503; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkrcRNBtpDTsthhpbC7Y92TOWA0h/KuMNbfGLxSxh9U=; b=syU3YvuY/FLvVg0k5J1qO9joSZdeYMzs3wz3QC5wZ5aIyCVy6DWPL+rCOLyIIHtL7Fj3C6 WTIU9qtzNEScpMBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 14/28] monitor: fdset: Match against O_DIRECT Date: Fri, 21 Jun 2024 14:54:20 -0300 Message-Id: <20240621175434.31180-15-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 2534E1FB84 X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 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: 1718992604928100007 Content-Type: text/plain; charset="utf-8" We're about to enable the use of O_DIRECT in the migration code and due to the alignment restrictions imposed by filesystems we need to make sure the flag is only used when doing aligned IO. The migration will do parallel IO to different regions of a file, so we need to use more than one file descriptor. Those cannot be obtained by duplicating (dup()) since duplicated file descriptors share the file status flags, including O_DIRECT. If one migration channel does unaligned IO while another sets O_DIRECT to do aligned IO, the filesystem would fail the unaligned operation. The add-fd QMP command along with the fdset code are specifically designed to allow the user to pass a set of file descriptors with different access flags into QEMU to be later fetched by code that needs to alternate between those flags when doing IO. Extend the fdset matching to behave the same with the O_DIRECT flag. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- monitor/fds.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/monitor/fds.c b/monitor/fds.c index d8c6b395b0..b5416b5b5d 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -424,6 +424,11 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int fla= gs, Error **errp) int fd =3D -1; int dup_fd; int mon_fd_flags; + int mask =3D O_ACCMODE; + +#ifdef O_DIRECT + mask |=3D O_DIRECT; +#endif =20 if (mon_fdset->id !=3D fdset_id) { continue; @@ -437,7 +442,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int flag= s, Error **errp) return -1; } =20 - if ((flags & O_ACCMODE) =3D=3D (mon_fd_flags & O_ACCMODE)) { + if ((flags & mask) =3D=3D (mon_fd_flags & mask)) { fd =3D mon_fdset_fd->fd; break; } --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992555; cv=none; d=zohomail.com; s=zohoarc; b=Foj62CTBBoacqBEEgdhaGYTxSK2WzHqjbdu3Xz4GMWroR2tQ58daTl4VfjIQMAqExKVXEUdxGRNWbo65gkcSUeK/VkCGh9REW1dKFvs3TKIDWpS5XVrPKSQtCQzriS2hOXGPdx/NoxOPSAj9AkhWRnHUx+5vzA1MhfYGVbf93lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992555; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dpaA8UyxtRDsfB5RjDLzg2FDrDvAArW4wQMiSrS11Zc=; b=XiXd0GVtlSz3c6ZUZYaOUdznLwugYnMepqM0zws58JHoojhrkM0nwL1PyRe89qaSUxi92P9vrCA0LuGn8mM2h8xs3I3vKqgQ1fQGOitfB5jBvViWWmT8doZLbYDfbxtgDi1LibkMkS0GZ7wYNFNhoE3huw5AfzY68i9hdqTagKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992555950227.87419535326092; Fri, 21 Jun 2024 10:55:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTd-0003To-I2; Fri, 21 Jun 2024 13:55:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTb-0003Sw-VM for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:08 -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 1sKiTa-0003MU-3K for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:07 -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 B236121B37; Fri, 21 Jun 2024 17:55: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 879AD13AAA; Fri, 21 Jun 2024 17:55: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 mMVcE3e+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992504; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dpaA8UyxtRDsfB5RjDLzg2FDrDvAArW4wQMiSrS11Zc=; b=juUJvpDyaknp3KZz84/FPUFF8FHPgsUifVWF3l8T4v/HvQ+n7mR18I61XhbImlFBKfoyZ8 2ASmyn00LstDb4ZwiqjuDOhgI4YV4iKTQ1+8RJHc94ssEzJ6gxH/VYesBUBoEdReZclo9p hgcRN9AC6XEqaEQgET8w0c9s65b9SUM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992504; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dpaA8UyxtRDsfB5RjDLzg2FDrDvAArW4wQMiSrS11Zc=; b=ujQRInMHRIEEz51iCcF+GJcJcW2/tLQD048WW0opXtzZxoHaIAms0XGLwO16W562ecjwPl EUGg5eZQrnemHNAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=juUJvpDy; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ujQRInMH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992504; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dpaA8UyxtRDsfB5RjDLzg2FDrDvAArW4wQMiSrS11Zc=; b=juUJvpDyaknp3KZz84/FPUFF8FHPgsUifVWF3l8T4v/HvQ+n7mR18I61XhbImlFBKfoyZ8 2ASmyn00LstDb4ZwiqjuDOhgI4YV4iKTQ1+8RJHc94ssEzJ6gxH/VYesBUBoEdReZclo9p hgcRN9AC6XEqaEQgET8w0c9s65b9SUM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992504; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dpaA8UyxtRDsfB5RjDLzg2FDrDvAArW4wQMiSrS11Zc=; b=ujQRInMHRIEEz51iCcF+GJcJcW2/tLQD048WW0opXtzZxoHaIAms0XGLwO16W562ecjwPl EUGg5eZQrnemHNAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 15/28] migration: Add documentation for fdset with multifd + file Date: Fri, 21 Jun 2024 14:54:21 -0300 Message-Id: <20240621175434.31180-16-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: B236121B37 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass 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: 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: 1718992556747100001 Content-Type: text/plain; charset="utf-8" With the last few changes to the fdset infrastructure, we now allow multifd to use an fdset when migrating to a file. This is useful for the scenario where the management layer wants to have control over the migration file. By receiving the file descriptors directly, QEMU can delegate some high level operating system operations to the management layer (such as mandatory access control). The management layer might also want to add its own headers before the migration stream. Document the "file:/dev/fdset/#" syntax for the multifd migration with mapped-ram. The requirements for the fdset mechanism are: - the fdset must contain two fds that are not duplicates between themselves; - if direct-io is to be used, exactly one of the fds must have the O_DIRECT flag set; - the file must be opened with WRONLY on the migration source side; - the file must be opened with RDONLY on the migration destination side. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- docs/devel/migration/main.rst | 24 +++++++++++++++++++----- docs/devel/migration/mapped-ram.rst | 6 +++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/devel/migration/main.rst b/docs/devel/migration/main.rst index 495cdcb112..784c899dca 100644 --- a/docs/devel/migration/main.rst +++ b/docs/devel/migration/main.rst @@ -47,11 +47,25 @@ over any transport. QEMU interference. Note that QEMU does not flush cached file data/metadata at the end of migration. =20 -In addition, support is included for migration using RDMA, which -transports the page data using ``RDMA``, where the hardware takes care of -transporting the pages, and the load on the CPU is much lower. While the -internals of RDMA migration are a bit different, this isn't really visible -outside the RAM migration code. + The file migration also supports using a file that has already been + opened. A set of file descriptors is passed to QEMU via an "fdset" + (see add-fd QMP command documentation). This method allows a + management application to have control over the migration file + opening operation. There are, however, strict requirements to this + interface if the multifd capability is enabled: + + - the fdset must contain two file descriptors that are not + duplicates between themselves; + - if the direct-io capability is to be used, exactly one of the + file descriptors must have the O_DIRECT flag set; + - the file must be opened with WRONLY on the migration source side + and RDONLY on the migration destination side. + +- rdma migration: support is included for migration using RDMA, which + transports the page data using ``RDMA``, where the hardware takes + care of transporting the pages, and the load on the CPU is much + lower. While the internals of RDMA migration are a bit different, + this isn't really visible outside the RAM migration code. =20 All these migration protocols use the same infrastructure to save/restore state devices. This infrastructure is shared with the diff --git a/docs/devel/migration/mapped-ram.rst b/docs/devel/migration/map= ped-ram.rst index fa4cefd9fc..d352b546e9 100644 --- a/docs/devel/migration/mapped-ram.rst +++ b/docs/devel/migration/mapped-ram.rst @@ -16,7 +16,7 @@ location in the file, rather than constantly being added = to a sequential stream. Having the pages at fixed offsets also allows the usage of O_DIRECT for save/restore of the migration stream as the pages are ensured to be written respecting O_DIRECT alignment -restrictions (direct-io support not yet implemented). +restrictions. =20 Usage ----- @@ -35,6 +35,10 @@ Use a ``file:`` URL for migration: Mapped-ram migration is best done non-live, i.e. by stopping the VM on the source side before migrating. =20 +For best performance enable the ``direct-io`` parameter as well: + + ``migrate_set_parameter direct-io on`` + Use-cases --------- =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992601; cv=none; d=zohomail.com; s=zohoarc; b=iSCNP+vzn5Fo/QBUrQGIWkHYq+oHF0oNb6AfuoeepY5Rq9knctr9amWkxLWtvc5ZdTN6nrfUvYyrnCRk7hGNDibwR3TQwr+SKjNWdqnDEVU6sqrtr94TQnlv0/i5MzjiXh4M5tnSgTxImsQ36H+krK10PcXqgzpVhryT6PCwBdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992601; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KQMSO1PwgZ5E3haVbmGS8ZvQsHMK98RmZZ5KCSDiAQk=; b=lJhsEAvKCzxIiMoiscjANdAnBZQvMsecEBX6qxEMD7YYoAqJicymwjIbOWkn03G8glPSyo35yLzj6s3apGj4MH3jOyKq+q5dik6RJ59c3pEaQB5LzILwqpLEScfpn2LH8Di1XauQ1YXK/ugYcK24duvsBXgGAUF/9c6kz3V9HHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992601706978.4366279024134; Fri, 21 Jun 2024 10:56:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTe-0003UF-Jg; Fri, 21 Jun 2024 13:55:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTd-0003Tf-AS for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:09 -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 1sKiTb-0003Mw-Ho for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55: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 559BF21B40; Fri, 21 Jun 2024 17:55: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 29D0313AAA; Fri, 21 Jun 2024 17:55: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 kDYaOHi+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KQMSO1PwgZ5E3haVbmGS8ZvQsHMK98RmZZ5KCSDiAQk=; b=zBil1pyc6TFNn9IYWrrlJYId3FHP1i1l1oI6CnwalKUOzbqLUEg6FBj/frdyBuCRPf7Oei SAK21W2KwPT8ks7+OFTMz+tXEZlEGoPWp9DZKR/WVqx3DRlDZOb5pp4WWNYyL1rcjd8jVA Kk0Leg1wy9QXo4Qo7FwYpjzW9BjycEo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KQMSO1PwgZ5E3haVbmGS8ZvQsHMK98RmZZ5KCSDiAQk=; b=7GVISZFnhrIhX28wNyOvsl+cAl470JZx7nstS9OnvWNIizXqDlu0yhCXdkHiH4e7Xpwf73 SfsEfi9xY/hEFcAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=zBil1pyc; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7GVISZFn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KQMSO1PwgZ5E3haVbmGS8ZvQsHMK98RmZZ5KCSDiAQk=; b=zBil1pyc6TFNn9IYWrrlJYId3FHP1i1l1oI6CnwalKUOzbqLUEg6FBj/frdyBuCRPf7Oei SAK21W2KwPT8ks7+OFTMz+tXEZlEGoPWp9DZKR/WVqx3DRlDZOb5pp4WWNYyL1rcjd8jVA Kk0Leg1wy9QXo4Qo7FwYpjzW9BjycEo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KQMSO1PwgZ5E3haVbmGS8ZvQsHMK98RmZZ5KCSDiAQk=; b=7GVISZFnhrIhX28wNyOvsl+cAl470JZx7nstS9OnvWNIizXqDlu0yhCXdkHiH4e7Xpwf73 SfsEfi9xY/hEFcAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 16/28] tests/qtest/migration: Add a test for mapped-ram with passing of fds Date: Fri, 21 Jun 2024 14:54:22 -0300 Message-Id: <20240621175434.31180-17-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 559BF21B40 X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -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: 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: 1718992602935100003 Content-Type: text/plain; charset="utf-8" Add a multifd test for mapped-ram with passing of fds into QEMU. This is how libvirt will consume the feature. There are a couple of details to the fdset mechanism: - multifd needs two distinct file descriptors (not duplicated with dup()) so it can enable O_DIRECT only on the channels that do aligned IO. The dup() system call creates file descriptors that share status flags, of which O_DIRECT is one. - the open() access mode flags used for the fds passed into QEMU need to match the flags QEMU uses to open the file. Currently O_WRONLY for src and O_RDONLY for dst. Note that fdset code goes under _WIN32 because fd passing is not supported on Windows. Reviewed-by: Peter Xu [brought back the qmp_remove_fd() call at the end of the tests] Signed-off-by: Fabiano Rosas --- tests/qtest/migration-test.c | 105 ++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 5c41d1b70e..6207305ff8 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2104,11 +2104,18 @@ static void test_precopy_file(void) =20 #ifndef _WIN32 static void fdset_add_fds(QTestState *qts, const char *file, int flags, - int num_fds) + int num_fds, bool direct_io) { for (int i =3D 0; i < num_fds; i++) { int fd; =20 +#ifdef O_DIRECT + /* only secondary channels can use direct-io */ + if (direct_io && i !=3D 0) { + flags |=3D O_DIRECT; + } +#endif + fd =3D open(file, flags, 0660); assert(fd !=3D -1); =20 @@ -2122,8 +2129,8 @@ static void *file_offset_fdset_start_hook(QTestState = *from, QTestState *to) { g_autofree char *file =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); =20 - fdset_add_fds(from, file, O_WRONLY, 1); - fdset_add_fds(to, file, O_RDONLY, 1); + fdset_add_fds(from, file, O_WRONLY, 1, false); + fdset_add_fds(to, file, O_RDONLY, 1, false); =20 return NULL; } @@ -2295,6 +2302,91 @@ static void test_multifd_file_mapped_ram_dio(void) test_file_common(&args, true); } =20 +#ifndef _WIN32 +static void multifd_mapped_ram_fdset_end(QTestState *from, QTestState *to, + void *opaque) +{ + QDict *resp; + QList *fdsets; + + /* + * Remove the fdsets after migration, otherwise a second migration + * would fail due fdset reuse. + */ + qtest_qmp_assert_success(from, "{'execute': 'remove-fd', " + "'arguments': { 'fdset-id': 1}}"); + + /* + * Make sure no fdsets are left after migration, otherwise a + * second migration would fail due fdset reuse. + */ + resp =3D qtest_qmp(from, "{'execute': 'query-fdsets', " + "'arguments': {}}"); + g_assert(qdict_haskey(resp, "return")); + fdsets =3D qdict_get_qlist(resp, "return"); + g_assert(fdsets && qlist_empty(fdsets)); +} + +static void *multifd_mapped_ram_fdset_dio(QTestState *from, QTestState *to) +{ + g_autofree char *file =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); + + fdset_add_fds(from, file, O_WRONLY, 2, true); + fdset_add_fds(to, file, O_RDONLY, 2, true); + + migrate_multifd_mapped_ram_start(from, to); + migrate_set_parameter_bool(from, "direct-io", true); + migrate_set_parameter_bool(to, "direct-io", true); + + return NULL; +} + +static void *multifd_mapped_ram_fdset(QTestState *from, QTestState *to) +{ + g_autofree char *file =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FI= LENAME); + + fdset_add_fds(from, file, O_WRONLY, 2, false); + fdset_add_fds(to, file, O_RDONLY, 2, false); + + migrate_multifd_mapped_ram_start(from, to); + + return NULL; +} + +static void test_multifd_file_mapped_ram_fdset(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", + FILE_TEST_OFFSET); + MigrateCommon args =3D { + .connect_uri =3D uri, + .listen_uri =3D "defer", + .start_hook =3D multifd_mapped_ram_fdset, + .finish_hook =3D multifd_mapped_ram_fdset_end, + }; + + test_file_common(&args, true); +} + +static void test_multifd_file_mapped_ram_fdset_dio(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", + FILE_TEST_OFFSET); + MigrateCommon args =3D { + .connect_uri =3D uri, + .listen_uri =3D "defer", + .start_hook =3D multifd_mapped_ram_fdset_dio, + .finish_hook =3D multifd_mapped_ram_fdset_end, + }; + + if (!probe_o_direct_support(tmpfs)) { + g_test_skip("Filesystem does not support O_DIRECT"); + return; + } + + test_file_common(&args, true); +} +#endif /* !_WIN32 */ + static void test_precopy_tcp_plain(void) { MigrateCommon args =3D { @@ -3736,6 +3828,13 @@ int main(int argc, char **argv) migration_test_add("/migration/multifd/file/mapped-ram/dio", test_multifd_file_mapped_ram_dio); =20 +#ifndef _WIN32 + migration_test_add("/migration/multifd/file/mapped-ram/fdset", + test_multifd_file_mapped_ram_fdset); + migration_test_add("/migration/multifd/file/mapped-ram/fdset/dio", + test_multifd_file_mapped_ram_fdset_dio); +#endif + #ifdef CONFIG_GNUTLS migration_test_add("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992697; cv=none; d=zohomail.com; s=zohoarc; b=hYcW4gNH05UvdkMriToT38aqEoD/cT3zt23tSgYzbNXP079rvRYHloWlVI3aXjilG1pERUOVCDBCuJYK8vcir4kagj1NKPN2w2aWJkQKT+JnRiUOjjxvRwS1PnSVhpdXvW2AKeDvgZappNjboC0InPcY6vGXQyxp7J6p61Csxak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992697; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=70j8TwkjKnr2/xJePnCpz9WVMROSlOSnRNCyDDp8Luw=; b=I3ea4tKaS5/8/JVrweTpm6VHZ6sYKwhE3kERmd2nsdDERn3/W0mfXbDUBtaSbSLUCv587ybnbSdkpW+/Fm/tmIVTqMlVs8erq6gwE32UjZqVRavvRPm2GFucxWO3Vn6eoAEcbbPsbs7gT+I94A35KimY5Xz1KlUYCnmZAgdGHY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992697511590.9700565153607; Fri, 21 Jun 2024 10:58:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTg-0003V1-31; Fri, 21 Jun 2024 13:55:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTe-0003UH-Jj for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:10 -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 1sKiTd-0003NS-42 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:10 -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 EBBE221B37; Fri, 21 Jun 2024 17:55:07 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C0BD913AAA; Fri, 21 Jun 2024 17:55:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uGhjIXq+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992508; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70j8TwkjKnr2/xJePnCpz9WVMROSlOSnRNCyDDp8Luw=; b=AaVK9HQYgm1BY+3RjMXwc5N8bmBkG8nfaHAZccGmXSszI6qEMxHn4JiwHn4PDoMxMYrVVL G0p+LrgNQZ2g0ZCpqWFErVZ5X3Ltd2YmNRVAEzWDnnxVCfWM5UoTR2zqUKB06BHZoKehs9 NNQGU8wIn9D8HhYTOumDJB/C0e56ORY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992508; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70j8TwkjKnr2/xJePnCpz9WVMROSlOSnRNCyDDp8Luw=; b=psX0y6Px0k074w+o2gvJrt01sWfNOrrXKH8fm8A3pR9DRVuTDgnYMJyBHxnpFdFku8qPKW sHgvMnaeos+39NCg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=d8JM8i3u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=PDEnkwsY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992507; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70j8TwkjKnr2/xJePnCpz9WVMROSlOSnRNCyDDp8Luw=; b=d8JM8i3u790YaADJZ4aWzwrjC/ckoz+h1RKIJXg9VLxP2DSC2RwSULUtSM4BADLmMSN0FI 2v+oMLMbt3j8fEFntk+reP7811y6sE1eFS6WGZXEc3dqtiYULjjTeFAxrh1dzSaTwW90+1 xPdcu3W2gXNlGUhe7iW3QXdaC1Zkcik= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992507; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70j8TwkjKnr2/xJePnCpz9WVMROSlOSnRNCyDDp8Luw=; b=PDEnkwsY69WWq+wE/AoAhjvfSeESHlR/VIZbDBn8DRFWiSiIjf5epydUVe0m39dBOJCEgI dVcSPskD16jmGqAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 17/28] migration/multifd: Avoid the final FLUSH in complete() Date: Fri, 21 Jun 2024 14:54:23 -0300 Message-Id: <20240621175434.31180-18-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: EBBE221B37 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; 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: 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: 1718992699299100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu We always do the flush when finishing one round of scan, and during complete() phase we should scan one more round making sure no dirty page existed. In that case we shouldn't need one explicit FLUSH at the end of complete(), as when reaching there all pages should have been flushed. Reviewed-by: Fabiano Rosas Tested-by: Fabiano Rosas Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/ram.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index ceea586b06..edec1a2d07 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3300,10 +3300,6 @@ static int ram_save_complete(QEMUFile *f, void *opaq= ue) } } =20 - if (migrate_multifd() && !migrate_multifd_flush_after_each_section() && - !migrate_mapped_ram()) { - qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_FLUSH); - } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); return qemu_fflush(f); } --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992569; cv=none; d=zohomail.com; s=zohoarc; b=BtcDHCFl1AKGKhvRUBmsfaR6tPrB0LGWH1bEhwxb9eXiyJdgs/K1YGCHRyIxIzWYa/tJk5ENtpyf/WMJL62UraFBvDga+3xl6jTu25yglMEsncMe430HNoCv9yqAqow+0eTTwJ6feqrbZl0ScJAQtFZG7vBKc9THoFK0g8O/Hag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992569; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hXccEqG4nwir6SVIx8qPQJaBfujHLJvf+SwMbJY2WM0=; b=hsDQe0PJRBse83ZWEEnS1WkCbca9OhGF6qSSMxX3BJgh6K2Chr9fplvHKMtnI4wSElinXozjU3kVM4LsK3XcCbo/EHRSHACTeaxuOSSaZDAE2CAjBGiPTUnGZdgJIjQAmOwQb1YGA2/SyZGBzvo267IsFffgLVeWf1cmQzsU3vo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992569476460.59285287731154; Fri, 21 Jun 2024 10:56:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTj-0003W4-Qd; Fri, 21 Jun 2024 13:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTi-0003Vg-65 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:14 -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 1sKiTg-0003Nz-57 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55: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 C84BE1F835; Fri, 21 Jun 2024 17:55: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 63D4213AAA; Fri, 21 Jun 2024 17:55: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 ANevCny+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hXccEqG4nwir6SVIx8qPQJaBfujHLJvf+SwMbJY2WM0=; b=HCCgPD0BuxO0uAwsLnKLfEgKt+B0lJS63l3iUOrbBW4eNvr6rLq2AVcqXVio77RJvwTpz9 ODGteGRDjj4TzZDsOWjmI1ICu6mw6Q3EN0KFZrNWMNbocmyOws2bFMldkAzHFkHbHGsb9g EmemGL0sFuPqR7JS0wsZsPqMWX0PDjg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hXccEqG4nwir6SVIx8qPQJaBfujHLJvf+SwMbJY2WM0=; b=fUVZlS7wy1xDhGwQrl1SK9QUIIAAWiiQtBeMKHMj+FpW4inKSpXb9QpDKIVx7qtF9ubtCi UCcZs1/7IPBKuDDA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ITnmQNcT; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=JP+0o4zM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992509; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hXccEqG4nwir6SVIx8qPQJaBfujHLJvf+SwMbJY2WM0=; b=ITnmQNcTKP4JxxQyvi2+AKz8AIFQFZJAARwtfvN/rbTezWWCDyFlXNzNVzJTCGHppuo92r G3G0sZpEq/RtDrMTq7WfakW8jXVIFv8HB+aLt6cw0dHxhSgigkEIwcytQAlRwNugctV6fz CAb185PhuN141w/7VrhQTMCQDk0Wy1E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992509; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hXccEqG4nwir6SVIx8qPQJaBfujHLJvf+SwMbJY2WM0=; b=JP+0o4zMCHtzR+gh9qID1+Cs8z9B3kCiSu8woaawq5SyJcyWXHh9Em+zp4CKER4B6zsXDy cDSM+cla4B51sEDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , Zhijian Li Subject: [PULL 18/28] migration: Rename thread debug names Date: Fri, 21 Jun 2024 14:54:24 -0300 Message-Id: <20240621175434.31180-19-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: C84BE1F835 X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[fujitsu.com:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 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: 1718992570855100006 Content-Type: text/plain; charset="utf-8" From: Peter Xu The postcopy thread names on dest QEMU are slightly confusing, partly I'll need to blame myself on 36f62f11e4 ("migration: Postcopy preemption preparation on channel creation"). E.g., "fault-fast" reads like a fast version of "fault-default", but it's actually the fast version of "postcopy/listen". Taking this chance, rename all the migration threads with proper rules. Considering we only have 15 chars usable, prefix all threads with "mig/", meanwhile identify src/dst threads properly this time. So now most thread names will look like "mig/DIR/xxx", where DIR will be "src"/"dst", except the bg-snapshot thread which doesn't have a direction. For multifd threads, making them "mig/{src|dst}/{send|recv}_%d". We used to have "live_migration" thread for a very long time, now it's called "mig/src/main". We may hope to have "mig/dst/main" soon but not yet. Reviewed-by: Fabiano Rosas Reviewed-by: Zhijian Li (Fujitsu) Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/colo.c | 2 +- migration/migration.c | 6 +++--- migration/multifd.c | 6 +++--- migration/postcopy-ram.c | 4 ++-- migration/savevm.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index f96c2ee069..6449490221 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -935,7 +935,7 @@ void coroutine_fn colo_incoming_co(void) assert(bql_locked()); assert(migration_incoming_colo_enabled()); =20 - qemu_thread_create(&th, "COLO incoming", colo_process_incoming_thread, + qemu_thread_create(&th, "mig/dst/colo", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); =20 mis->colo_incoming_co =3D qemu_coroutine_self(); diff --git a/migration/migration.c b/migration/migration.c index e03c80b3aa..f9b69af62f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2431,7 +2431,7 @@ static int open_return_path_on_source(MigrationState = *ms) =20 trace_open_return_path_on_source(); =20 - qemu_thread_create(&ms->rp_state.rp_thread, "return path", + qemu_thread_create(&ms->rp_state.rp_thread, "mig/src/rp-thr", source_return_path_thread, ms, QEMU_THREAD_JOINABLE= ); ms->rp_state.rp_thread_created =3D true; =20 @@ -3770,10 +3770,10 @@ void migrate_fd_connect(MigrationState *s, Error *e= rror_in) } =20 if (migrate_background_snapshot()) { - qemu_thread_create(&s->thread, "bg_snapshot", + qemu_thread_create(&s->thread, "mig/snapshot", bg_migration_thread, s, QEMU_THREAD_JOINABLE); } else { - qemu_thread_create(&s->thread, "live_migration", + qemu_thread_create(&s->thread, "mig/src/main", migration_thread, s, QEMU_THREAD_JOINABLE); } s->migration_thread_running =3D true; diff --git a/migration/multifd.c b/migration/multifd.c index d82885fdbb..0b4cbaddfe 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1069,7 +1069,7 @@ static bool multifd_tls_channel_connect(MultiFDSendPa= rams *p, args->p =3D p; =20 p->tls_thread_created =3D true; - qemu_thread_create(&p->tls_thread, "multifd-tls-handshake-worker", + qemu_thread_create(&p->tls_thread, "mig/src/tls", multifd_tls_handshake_thread, args, QEMU_THREAD_JOINABLE); return true; @@ -1190,7 +1190,7 @@ bool multifd_send_setup(void) p->packet->magic =3D cpu_to_be32(MULTIFD_MAGIC); p->packet->version =3D cpu_to_be32(MULTIFD_VERSION); } - p->name =3D g_strdup_printf("multifdsend_%d", i); + p->name =3D g_strdup_printf("mig/src/send_%d", i); p->page_size =3D qemu_target_page_size(); p->page_count =3D page_count; p->write_flags =3D 0; @@ -1604,7 +1604,7 @@ int multifd_recv_setup(Error **errp) + sizeof(uint64_t) * page_count; p->packet =3D g_malloc0(p->packet_len); } - p->name =3D g_strdup_printf("multifdrecv_%d", i); + p->name =3D g_strdup_printf("mig/dst/recv_%d", i); p->normal =3D g_new0(ram_addr_t, page_count); p->zero =3D g_new0(ram_addr_t, page_count); p->page_count =3D page_count; diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 3419779548..97701e6bb2 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1238,7 +1238,7 @@ int postcopy_ram_incoming_setup(MigrationIncomingStat= e *mis) return -1; } =20 - postcopy_thread_create(mis, &mis->fault_thread, "fault-default", + postcopy_thread_create(mis, &mis->fault_thread, "mig/dst/fault", postcopy_ram_fault_thread, QEMU_THREAD_JOINABLE= ); mis->have_fault_thread =3D true; =20 @@ -1258,7 +1258,7 @@ int postcopy_ram_incoming_setup(MigrationIncomingStat= e *mis) * This thread needs to be created after the temp pages because * it'll fetch RAM_CHANNEL_POSTCOPY PostcopyTmpPage immediately. */ - postcopy_thread_create(mis, &mis->postcopy_prio_thread, "fault-fas= t", + postcopy_thread_create(mis, &mis->postcopy_prio_thread, "mig/dst/p= reempt", postcopy_preempt_thread, QEMU_THREAD_JOINAB= LE); mis->preempt_thread_status =3D PREEMPT_THREAD_CREATED; } diff --git a/migration/savevm.c b/migration/savevm.c index c621f2359b..e71410d8c1 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2129,7 +2129,7 @@ static int loadvm_postcopy_handle_listen(MigrationInc= omingState *mis) } =20 mis->have_listen_thread =3D true; - postcopy_thread_create(mis, &mis->listen_thread, "postcopy/listen", + postcopy_thread_create(mis, &mis->listen_thread, "mig/dst/listen", postcopy_ram_listen_thread, QEMU_THREAD_DETACHE= D); trace_loadvm_postcopy_handle_listen("return"); =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992546; cv=none; d=zohomail.com; s=zohoarc; b=Zps+2qfEijovTGrCMOSkS81rOUUnmh7aVNZ+UzM6gWrCKJA2/gfm+tF1IkwE+hNv2N0MwD0+2apUYJ38zO70enNbPxrx0kbDRk4Se9AbfD44imaljgat849aGPPhYFqT1Wyikhbsnx5SryZ69PnxKCUsuShGxquxxy6N+kNpKTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992546; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MgVF8+WS1C+1Kgj090nmE1mi0TfygDEbDV5LO8SpQ18=; b=UQ3yWR0Us7CvSnR9aNE1vI7lOjFmmdF8s4djlqjhGPl6ts37voJZ9DHnaVfSAZWHcKTeuY5OtbU+z4f49BoSmCiB3XbjUgO5mAcpAbnp0zY+qInHVIWm6LWF4OoWT+4x6jhITWY+/NMu+HEnvyttpcD7qQkiEvdRe4BnK3tgQF4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171899254672897.75651940873274; Fri, 21 Jun 2024 10:55:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTj-0003W3-Mi; Fri, 21 Jun 2024 13:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTi-0003Vp-HL for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:14 -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 1sKiTg-0003O8-Mb for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:14 -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 6AD7321B37; Fri, 21 Jun 2024 17:55: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 403E213ACD; Fri, 21 Jun 2024 17:55:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id eGn0AX6+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MgVF8+WS1C+1Kgj090nmE1mi0TfygDEbDV5LO8SpQ18=; b=dgUkTz8n1Z/HyDRMkXmbVIA+NRlhpP5sI4YoMlBVz+qAuqFwQdM01P3t7Q6TnA/JgyJg7P rsBzUn0opXjMiehUvQMrstGoY1N4Uhq+eS3B6nJ5y/J57j4irG7PGoSOOaqHWEbLyBBXXF 7DtB8syD6iO3jG8GTb4Gr8ZW13AYxTM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MgVF8+WS1C+1Kgj090nmE1mi0TfygDEbDV5LO8SpQ18=; b=q0FJJGzh0wGnayL7OoHy8DrJD8ASzyGPQp9E0Yb4AcmRBjM0aT0X0a55b2V8ovnz11spjW yZ9AcuSZuDBhp/Cw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MgVF8+WS1C+1Kgj090nmE1mi0TfygDEbDV5LO8SpQ18=; b=dgUkTz8n1Z/HyDRMkXmbVIA+NRlhpP5sI4YoMlBVz+qAuqFwQdM01P3t7Q6TnA/JgyJg7P rsBzUn0opXjMiehUvQMrstGoY1N4Uhq+eS3B6nJ5y/J57j4irG7PGoSOOaqHWEbLyBBXXF 7DtB8syD6iO3jG8GTb4Gr8ZW13AYxTM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MgVF8+WS1C+1Kgj090nmE1mi0TfygDEbDV5LO8SpQ18=; b=q0FJJGzh0wGnayL7OoHy8DrJD8ASzyGPQp9E0Yb4AcmRBjM0aT0X0a55b2V8ovnz11spjW yZ9AcuSZuDBhp/Cw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 19/28] migration: Use MigrationStatus instead of int Date: Fri, 21 Jun 2024 14:54:25 -0300 Message-Id: <20240621175434.31180-20-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1718992549161100004 Content-Type: text/plain; charset="utf-8" From: Peter Xu QEMU uses "int" in most cases even if it stores MigrationStatus. I don't know why, so let's try to do that right and see what blows up.. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 24 +++++++----------------- migration/migration.h | 9 +++++---- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f9b69af62f..795b30f0d0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -413,7 +413,7 @@ void migration_incoming_state_destroy(void) yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 -static void migrate_generate_event(int new_state) +static void migrate_generate_event(MigrationStatus new_state) { if (migrate_events()) { qapi_event_send_migration(new_state); @@ -1296,8 +1296,6 @@ static void fill_destination_migration_info(Migration= Info *info) } =20 switch (mis->state) { - case MIGRATION_STATUS_NONE: - return; case MIGRATION_STATUS_SETUP: case MIGRATION_STATUS_CANCELLING: case MIGRATION_STATUS_CANCELLED: @@ -1313,6 +1311,8 @@ static void fill_destination_migration_info(Migration= Info *info) info->has_status =3D true; fill_destination_postcopy_migration_info(info); break; + default: + return; } info->status =3D mis->state; =20 @@ -1360,7 +1360,8 @@ void qmp_migrate_start_postcopy(Error **errp) =20 /* shared migration helpers */ =20 -void migrate_set_state(int *state, int old_state, int new_state) +void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, + MigrationStatus new_state) { assert(new_state < MIGRATION_STATUS__MAX); if (qatomic_cmpxchg(state, old_state, new_state) =3D=3D old_state) { @@ -1567,7 +1568,7 @@ bool migration_in_postcopy(void) } } =20 -bool migration_postcopy_is_alive(int state) +bool migration_postcopy_is_alive(MigrationStatus state) { switch (state) { case MIGRATION_STATUS_POSTCOPY_ACTIVE: @@ -1612,20 +1613,9 @@ bool migration_is_idle(void) case MIGRATION_STATUS_COMPLETED: case MIGRATION_STATUS_FAILED: return true; - case MIGRATION_STATUS_SETUP: - case MIGRATION_STATUS_CANCELLING: - case MIGRATION_STATUS_ACTIVE: - case MIGRATION_STATUS_POSTCOPY_ACTIVE: - case MIGRATION_STATUS_COLO: - case MIGRATION_STATUS_PRE_SWITCHOVER: - case MIGRATION_STATUS_DEVICE: - case MIGRATION_STATUS_WAIT_UNPLUG: + default: return false; - case MIGRATION_STATUS__MAX: - g_assert_not_reached(); } - - return false; } =20 bool migration_is_active(void) diff --git a/migration/migration.h b/migration/migration.h index 6af01362d4..38aa1402d5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -160,7 +160,7 @@ struct MigrationIncomingState { /* PostCopyFD's for external userfaultfds & handlers of shared memory = */ GArray *postcopy_remote_fds; =20 - int state; + MigrationStatus state; =20 /* * The incoming migration coroutine, non-NULL during qemu_loadvm_state= (). @@ -301,7 +301,7 @@ struct MigrationState { /* params from 'migrate-set-parameters' */ MigrationParameters parameters; =20 - int state; + MigrationStatus state; =20 /* State related to return path */ struct { @@ -459,7 +459,8 @@ struct MigrationState { bool rdma_migration; }; =20 -void migrate_set_state(int *state, int old_state, int new_state); +void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, + MigrationStatus new_state); =20 void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); @@ -479,7 +480,7 @@ int migrate_init(MigrationState *s, Error **errp); bool migration_is_blocked(Error **errp); /* True if outgoing migration has entered postcopy phase */ bool migration_in_postcopy(void); -bool migration_postcopy_is_alive(int state); +bool migration_postcopy_is_alive(MigrationStatus state); MigrationState *migrate_get_current(void); bool migration_has_failed(MigrationState *); bool migrate_mode_is_cpr(MigrationState *); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992704; cv=none; d=zohomail.com; s=zohoarc; b=RAUXSv/d3wVkX2pl+BcRCF5LFT0EeMhmkOMIFN4ViySWc7W9n8mPPyrwyQdYPEsEP8Snft5lvTFWX8aNG5n2mfyIVEptFNpcnokU+cg+gJgr720h4Y1A4swl2Fb6o041MIuUeyTWSuGA7qawGm3aXbPbaFvjCoCF5vrBRZi8uGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992704; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DGlDNuyeK6ZUFejVGI4gg5g94gsU8TO4M2YH0XyWtrQ=; b=JT1KgP4qSKLScWNIS+jX8ckZxg7D2lks2UlnG9ovHz5y08Wa3aQEqeAryUbAHiB7Xg8J1fxUHx/huoTBdVTGP937FIWAJkoFDLCIyp8bOioFfyJIcw+XbURO0bNn3YjbK5jRENlg8CvhH+cP9sxSs3KFhcsrfM7fYyGvp1Mo3iY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992704346656.9936575573628; Fri, 21 Jun 2024 10:58:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTm-0003XL-8H; Fri, 21 Jun 2024 13:55:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTj-0003W8-U5 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:15 -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 1sKiTi-0003OL-9R for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55: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-out1.suse.de (Postfix) with ESMTPS id 176D121B41; Fri, 21 Jun 2024 17:55:13 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D683713AAA; Fri, 21 Jun 2024 17:55: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 wM2qJn++dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992513; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DGlDNuyeK6ZUFejVGI4gg5g94gsU8TO4M2YH0XyWtrQ=; b=B1ZkBgmn/2O9P6pJHQ+10vIYtaT3AXJHdLhD1sYlWDSPejDQfhRv5U8l1pG9lqFp3P4/P+ fWzK3KII+TtThp8dqq/g8QMQ/kO7ARRzsBdVLHDhh8Lhl/8TQR3GS1/xyOl6PqwhZ1unVe bl8AzVCSuItOglEzIvTOey+FF8vuHxo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992513; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DGlDNuyeK6ZUFejVGI4gg5g94gsU8TO4M2YH0XyWtrQ=; b=sUq0MOgo2Yq2EDGcBFv9RauaFGYcluTZy5e+VaL7KFGtzPYVFXsd+LRKRkvbtblyFT7aqB gaCyI6b/273X0OAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992513; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DGlDNuyeK6ZUFejVGI4gg5g94gsU8TO4M2YH0XyWtrQ=; b=B1ZkBgmn/2O9P6pJHQ+10vIYtaT3AXJHdLhD1sYlWDSPejDQfhRv5U8l1pG9lqFp3P4/P+ fWzK3KII+TtThp8dqq/g8QMQ/kO7ARRzsBdVLHDhh8Lhl/8TQR3GS1/xyOl6PqwhZ1unVe bl8AzVCSuItOglEzIvTOey+FF8vuHxo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992513; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DGlDNuyeK6ZUFejVGI4gg5g94gsU8TO4M2YH0XyWtrQ=; b=sUq0MOgo2Yq2EDGcBFv9RauaFGYcluTZy5e+VaL7KFGtzPYVFXsd+LRKRkvbtblyFT7aqB gaCyI6b/273X0OAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 20/28] migration: Cleanup incoming migration setup state change Date: Fri, 21 Jun 2024 14:54:26 -0300 Message-Id: <20240621175434.31180-21-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -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: 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: 1718992705330100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu Destination QEMU can setup incoming ports for two purposes: either a fresh new incoming migration, in which QEMU will switch to SETUP for channel establishment, or a paused postcopy migration, in which QEMU will stay in POSTCOPY_PAUSED until kicking off the RECOVER phase. Now the state machine worked on dest node for the latter, only because migrate_set_state() implicitly will become a noop if the current state check failed. It wasn't clear at all. Clean it up by providing a helper migration_incoming_state_setup() doing proper checks over current status. Postcopy-paused will be explicitly checked now, and then we can bail out for unknown states. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 795b30f0d0..41a88fc50a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -618,6 +618,29 @@ bool migrate_uri_parse(const char *uri, MigrationChann= el **channel, return true; } =20 +static bool +migration_incoming_state_setup(MigrationIncomingState *mis, Error **errp) +{ + MigrationStatus current =3D mis->state; + + if (current =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED) { + /* + * Incoming postcopy migration will stay in PAUSED state even if + * reconnection happened. + */ + return true; + } + + if (current !=3D MIGRATION_STATUS_NONE) { + error_setg(errp, "Illegal migration incoming state: %s", + MigrationStatus_str(current)); + return false; + } + + migrate_set_state(&mis->state, current, MIGRATION_STATUS_SETUP); + return true; +} + static void qemu_start_incoming_migration(const char *uri, bool has_channe= ls, MigrationChannelList *channels, Error **errp) @@ -656,8 +679,9 @@ static void qemu_start_incoming_migration(const char *u= ri, bool has_channels, return; } =20 - migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, - MIGRATION_STATUS_SETUP); + if (!migration_incoming_state_setup(mis, errp)) { + return; + } =20 if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { SocketAddress *saddr =3D &addr->u.socket; --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992636; cv=none; d=zohomail.com; s=zohoarc; b=kw7o8e9hz8PIhT0l6VZu6OdOdW9SGC/Oqb59Yey1vg3Xywj79N2AKgPsnfhELr0UAH9X0so86a4feg5zAV4OWXoQ9sO1+s1N1CJnMoE/xxAXkri8xcq4cL0Ih3jyqTyoGD2Yj//J+PJQTfYdpIPGGOjiqXCo0VXI9aqp0gWnLiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992636; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gMbd/ElX3CkcMwgl0EpCXiqh6IT/R7fJ6N/RrAdDXlA=; b=gE7enLScceuysrG4A+AONElVwL9Ok2gTpfyF3/ErW2C1nJ01wn+czqRIumb1Z2qULciLf1BqTziDgoW+OXaN8I8MhuZT709cOM2XNJiot5l7j9CJNLYRtyxZ28T0yrXOxqDtx79gRUBTBfuKsBPtG5AZSpA6QFmTP4K8D5TioSU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992636311953.0071776038492; Fri, 21 Jun 2024 10:57:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTo-0003Xq-Sb; Fri, 21 Jun 2024 13:55:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTm-0003XQ-Lv for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:18 -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 1sKiTk-0003Om-Bm for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:18 -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 23F8C21B37; Fri, 21 Jun 2024 17:55:15 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 79CF913AAA; Fri, 21 Jun 2024 17:55:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KBP2D4G+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gMbd/ElX3CkcMwgl0EpCXiqh6IT/R7fJ6N/RrAdDXlA=; b=On+Sx1EK3cOKU0akIEYLs8HaCQEurGqz4yVONW5l2alUmOv1wkZXy6BGU26/9O6+QA82rm i5RM6hTZ4GydirqzPvfa18ntQiYar4ipxOuY2ulxIrYGtZ6IGxFwPeCmbU86i2jdxQAtfx 9Zlzbs8vjcD5svDvnXHyPQeeOgjX/zI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gMbd/ElX3CkcMwgl0EpCXiqh6IT/R7fJ6N/RrAdDXlA=; b=lPPVUlNXfAHmLoqsn1VXsoYghT02aszY1wuLxnPJBiG9NAkRsf7Em2p3sERtvW6mK8u199 6hYxOHrWzfh7ToAQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=On+Sx1EK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=lPPVUlNX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gMbd/ElX3CkcMwgl0EpCXiqh6IT/R7fJ6N/RrAdDXlA=; b=On+Sx1EK3cOKU0akIEYLs8HaCQEurGqz4yVONW5l2alUmOv1wkZXy6BGU26/9O6+QA82rm i5RM6hTZ4GydirqzPvfa18ntQiYar4ipxOuY2ulxIrYGtZ6IGxFwPeCmbU86i2jdxQAtfx 9Zlzbs8vjcD5svDvnXHyPQeeOgjX/zI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gMbd/ElX3CkcMwgl0EpCXiqh6IT/R7fJ6N/RrAdDXlA=; b=lPPVUlNXfAHmLoqsn1VXsoYghT02aszY1wuLxnPJBiG9NAkRsf7Em2p3sERtvW6mK8u199 6hYxOHrWzfh7ToAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , Jiri Denemark , Prasad Pandit Subject: [PULL 21/28] migration/postcopy: Add postcopy-recover-setup phase Date: Fri, 21 Jun 2024 14:54:27 -0300 Message-Id: <20240621175434.31180-22-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 23F8C21B37 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; 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: 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: 1718992637201100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu This patch adds a migration state on src called "postcopy-recover-setup". The new state will describe the intermediate step starting from when the src QEMU received a postcopy recovery request, until the migration channels are properly established, but before the recovery process take place. The request came from Libvirt where Libvirt currently rely on the migration state events to detect migration state changes. That works for most of the migration process but except postcopy recovery failures at the beginning. Currently postcopy recovery only has two major states: - postcopy-paused: this is the state that both sides of QEMU will be in for a long time as long as the migration channel was interrupted. - postcopy-recover: this is the state where both sides of QEMU handshake with each other, preparing for a continuation of postcopy which used to be interrupted. The issue here is when the recovery port is invalid, the src QEMU will take the URI/channels, noticing the ports are not valid, and it'll silently keep in the postcopy-paused state, with no event sent to Libvirt. In this case, the only thing Libvirt can do is to poll the migration status with a proper interval, however that's less optimal. Considering that this is the only case where Libvirt won't get a notification from QEMU on such events, let's add postcopy-recover-setup state to mimic what we have with the "setup" state of a newly initialized migration, describing the phase of connection establishment. With that, postcopy recovery will have two paths to go now, and either path will guarantee an event generated. Now the events will look like this during a recovery process on src QEMU: - Initially when the recovery is initiated on src, QEMU will go from "postcopy-paused" -> "postcopy-recover-setup". Old QEMUs don't have this event. - Depending on whether the channel re-establishment is succeeded: - In succeeded case, src QEMU will move from "postcopy-recover-setup" to "postcopy-recover". Old QEMUs also have this event. - In failure case, src QEMU will move from "postcopy-recover-setup" to "postcopy-paused" again. Old QEMUs don't have this event. This guarantees that Libvirt will always receive a notification for recovery process properly. One thing to mention is, such new status is only needed on src QEMU not both. On dest QEMU, the state machine doesn't change. Hence the events don't change either. It's done like so because dest QEMU may not have an explicit point of setup start. E.g., it can happen that when dest QEMUs doesn't use migrate-recover command to use a new URI/channel, but the old URI/channels can be reused in recovery, in which case the old ports simply can work again after the network routes are fixed up. Add a new helper postcopy_is_paused() detecting whether postcopy is still paused, taking RECOVER_SETUP into account too. When using it on both src/dst, a slight change is done altogether to always wait for the semaphore before checking the status, because for both sides a sem_post() will be required for a recovery. Cc: Jiri Denemark Cc: Prasad Pandit Reviewed-by: Fabiano Rosas Buglink: https://issues.redhat.com/browse/RHEL-38485 Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 40 ++++++++++++++++++++++++++++++++++------ migration/postcopy-ram.c | 6 ++++++ migration/postcopy-ram.h | 3 +++ migration/savevm.c | 4 ++-- qapi/migration.json | 4 ++++ 5 files changed, 49 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 41a88fc50a..3dea06d577 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1117,6 +1117,7 @@ bool migration_is_setup_or_active(void) case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_PAUSED: + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: case MIGRATION_STATUS_POSTCOPY_RECOVER: case MIGRATION_STATUS_SETUP: case MIGRATION_STATUS_PRE_SWITCHOVER: @@ -1139,6 +1140,7 @@ bool migration_is_running(void) case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_PAUSED: + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: case MIGRATION_STATUS_POSTCOPY_RECOVER: case MIGRATION_STATUS_SETUP: case MIGRATION_STATUS_PRE_SWITCHOVER: @@ -1276,6 +1278,7 @@ static void fill_source_migration_info(MigrationInfo = *info) case MIGRATION_STATUS_PRE_SWITCHOVER: case MIGRATION_STATUS_DEVICE: case MIGRATION_STATUS_POSTCOPY_PAUSED: + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: case MIGRATION_STATUS_POSTCOPY_RECOVER: /* TODO add some postcopy stats */ populate_time_info(info, s); @@ -1482,9 +1485,30 @@ static void migrate_error_free(MigrationState *s) =20 static void migrate_fd_error(MigrationState *s, const Error *error) { + MigrationStatus current =3D s->state; + MigrationStatus next; + assert(s->to_dst_file =3D=3D NULL); - migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); + + switch (current) { + case MIGRATION_STATUS_SETUP: + next =3D MIGRATION_STATUS_FAILED; + break; + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: + /* Never fail a postcopy migration; switch back to PAUSED instead = */ + next =3D MIGRATION_STATUS_POSTCOPY_PAUSED; + break; + default: + /* + * This really shouldn't happen. Just be careful to not crash a VM + * just for this. Instead, dump something. + */ + error_report("%s: Illegal migration status (%s) detected", + __func__, MigrationStatus_str(current)); + return; + } + + migrate_set_state(&s->state, current, next); migrate_set_error(s, error); } =20 @@ -1585,6 +1609,7 @@ bool migration_in_postcopy(void) switch (s->state) { case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_PAUSED: + case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: case MIGRATION_STATUS_POSTCOPY_RECOVER: return true; default: @@ -1972,6 +1997,9 @@ static bool migrate_prepare(MigrationState *s, bool r= esume, Error **errp) return false; } =20 + migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_PAUSED, + MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP); + /* This is a resume, skip init status */ return true; } @@ -3004,9 +3032,9 @@ static MigThrError postcopy_pause(MigrationState *s) * We wait until things fixed up. Then someone will setup the * status back for us. */ - while (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED) { + do { qemu_sem_wait(&s->postcopy_pause_sem); - } + } while (postcopy_is_paused(s->state)); =20 if (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER) { /* Woken up by a recover procedure. Give it a shot */ @@ -3702,7 +3730,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) { Error *local_err =3D NULL; uint64_t rate_limit; - bool resume =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED; + bool resume =3D (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP); int ret; =20 /* @@ -3769,7 +3797,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) =20 if (resume) { /* Wakeup the main migration thread to do the recovery */ - migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_PAUSED, + migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_RECOVER_SET= UP, MIGRATION_STATUS_POSTCOPY_RECOVER); qemu_sem_post(&s->postcopy_pause_sem); return; diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 97701e6bb2..1c374b7ea1 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1770,3 +1770,9 @@ void *postcopy_preempt_thread(void *opaque) =20 return NULL; } + +bool postcopy_is_paused(MigrationStatus status) +{ + return status =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED || + status =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP; +} diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index ecae941211..a6df1b2811 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -13,6 +13,8 @@ #ifndef QEMU_POSTCOPY_RAM_H #define QEMU_POSTCOPY_RAM_H =20 +#include "qapi/qapi-types-migration.h" + /* Return true if the host supports everything we need to do postcopy-ram = */ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, Error **errp); @@ -193,5 +195,6 @@ enum PostcopyChannels { void postcopy_preempt_new_channel(MigrationIncomingState *mis, QEMUFile *f= ile); void postcopy_preempt_setup(MigrationState *s); int postcopy_preempt_establish_channel(MigrationState *s); +bool postcopy_is_paused(MigrationStatus status); =20 #endif diff --git a/migration/savevm.c b/migration/savevm.c index e71410d8c1..deb57833f8 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2864,9 +2864,9 @@ static bool postcopy_pause_incoming(MigrationIncoming= State *mis) error_report("Detected IO failure for postcopy. " "Migration paused."); =20 - while (mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED) { + do { qemu_sem_wait(&mis->postcopy_pause_sem_dst); - } + } while (postcopy_is_paused(mis->state)); =20 trace_postcopy_pause_incoming_continued(); =20 diff --git a/qapi/migration.json b/qapi/migration.json index de6c8b0444..0f24206bce 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -142,6 +142,9 @@ # # @postcopy-paused: during postcopy but paused. (since 3.0) # +# @postcopy-recover-setup: setup phase for a postcopy recovery process, +# preparing for a recovery phase to start. (since 9.1) +# # @postcopy-recover: trying to recover from a paused postcopy. (since # 3.0) # @@ -166,6 +169,7 @@ { 'enum': 'MigrationStatus', 'data': [ 'none', 'setup', 'cancelling', 'cancelled', 'active', 'postcopy-active', 'postcopy-paused', + 'postcopy-recover-setup', 'postcopy-recover', 'completed', 'failed', 'colo', 'pre-switchover', 'device', 'wait-unplug' ] } ## --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992627; cv=none; d=zohomail.com; s=zohoarc; b=njyJl3/PSxI0YzhvIBoAb9FDEsYDvURL6sxD7wzbZgXWWZ8wv62wMhCtYBuZ8kX/Yl/Wth+ls7TDkdsj56NfHbvIUnEOJgTu7NYfJsOYUGo4JOyG8HNPtkkA8DA+r+EZtbCrivXbMAXVMBH/YBnv9OYJj2Jsxy87asueHPoGSs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992627; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=efojn5wV30laV0QjhernOtFVCmnPaNi8u6WawLOknLc=; b=ftrXnHuXNdSxf++ziNhvb3OekhJwxT24Fw3TYl9XtMG/+DfcAlvqAJXADoCMG8rWFyGkQAO81Uj8d2LoPXHE6byj8yoGY6cV7je5f+7X1j9D0ctzZSxAgH3USXJOj/IN2P6lMnm0S1mrLBIN/3pvkbx7wbNgYxPW7i4NOjCsOoU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992627887939.1997650605016; Fri, 21 Jun 2024 10:57:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTq-0003YU-E9; Fri, 21 Jun 2024 13:55:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTn-0003Xd-Mu for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:19 -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 1sKiTl-0003Oz-VW for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:19 -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 BF30A1F835; Fri, 21 Jun 2024 17:55:16 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8F2B513AAA; Fri, 21 Jun 2024 17:55:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mKFWFYO+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efojn5wV30laV0QjhernOtFVCmnPaNi8u6WawLOknLc=; b=jA7epGcqdAjlQlGm+QwWNZsNxYEAMh9AZGN3lpffpg0EPbOJa3XG2rcVbugrygDnObAdAq X06Ie6cWFVt8eku/fg3vDyw1Is3LUrf/u45tBFsuf2pdLy+rVGaHr+Hkd5hxZ/itf1bRJ5 s1ATx3cNlaml6WiS9fJ4SZa8tTN2ox8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efojn5wV30laV0QjhernOtFVCmnPaNi8u6WawLOknLc=; b=BpvNzRo4heX09psgfhh3nyv3suzDyDec/VXOyrAn0rqU/5A+Gu0GbgQex5efoPnHPuGp83 YHkI3gg6DJt0AKDQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jA7epGcq; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BpvNzRo4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efojn5wV30laV0QjhernOtFVCmnPaNi8u6WawLOknLc=; b=jA7epGcqdAjlQlGm+QwWNZsNxYEAMh9AZGN3lpffpg0EPbOJa3XG2rcVbugrygDnObAdAq X06Ie6cWFVt8eku/fg3vDyw1Is3LUrf/u45tBFsuf2pdLy+rVGaHr+Hkd5hxZ/itf1bRJ5 s1ATx3cNlaml6WiS9fJ4SZa8tTN2ox8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efojn5wV30laV0QjhernOtFVCmnPaNi8u6WawLOknLc=; b=BpvNzRo4heX09psgfhh3nyv3suzDyDec/VXOyrAn0rqU/5A+Gu0GbgQex5efoPnHPuGp83 YHkI3gg6DJt0AKDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 22/28] migration/docs: Update postcopy recover session for SETUP phase Date: Fri, 21 Jun 2024 14:54:28 -0300 Message-Id: <20240621175434.31180-23-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: BF30A1F835 X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 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: 1718992629063100003 Content-Type: text/plain; charset="utf-8" From: Peter Xu Firstly, the "Paused" state was added in the wrong place before. The state machine section was describing PostcopyState, rather than MigrationStatus. Drop the Paused state descriptions. Then in the postcopy recover session, add more information on the state machine for MigrationStatus in the lines. Add the new RECOVER_SETUP phase. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu [fix typo s/reconnects/reconnect] Signed-off-by: Fabiano Rosas --- docs/devel/migration/postcopy.rst | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/devel/migration/postcopy.rst b/docs/devel/migration/postc= opy.rst index 6c51e96d79..82e7a848c6 100644 --- a/docs/devel/migration/postcopy.rst +++ b/docs/devel/migration/postcopy.rst @@ -99,17 +99,6 @@ ADVISE->DISCARD->LISTEN->RUNNING->END (although it can't do the cleanup it would do as it finishes a normal migration). =20 - - Paused - - Postcopy can run into a paused state (normally on both sides when - happens), where all threads will be temporarily halted mostly due to - network errors. When reaching paused state, migration will make sure - the qemu binary on both sides maintain the data without corrupting - the VM. To continue the migration, the admin needs to fix the - migration channel using the QMP command 'migrate-recover' on the - destination node, then resume the migration using QMP command 'migrate' - again on source node, with resume=3Dtrue flag set. - - End =20 The listen thread can now quit, and perform the cleanup of migration @@ -221,7 +210,8 @@ paused postcopy migration. =20 The recovery phase normally contains a few steps: =20 - - When network issue occurs, both QEMU will go into PAUSED state + - When network issue occurs, both QEMU will go into **POSTCOPY_PAUSED** + migration state. =20 - When the network is recovered (or a new network is provided), the admin can setup the new channel for migration using QMP command @@ -229,9 +219,20 @@ The recovery phase normally contains a few steps: =20 - On source host, the admin can continue the interrupted postcopy migration using QMP command 'migrate' with resume=3Dtrue flag set. + Source QEMU will go into **POSTCOPY_RECOVER_SETUP** state trying to + re-establish the channels. =20 - - After the connection is re-established, QEMU will continue the postcopy - migration on both sides. + - When both sides of QEMU successfully reconnect using a new or fixed up + channel, they will go into **POSTCOPY_RECOVER** state, some handshake + procedure will be needed to properly synchronize the VM states between + the two QEMUs to continue the postcopy migration. For example, there + can be pages sent right during the window when the network is + interrupted, then the handshake will guarantee pages lost in-flight + will be resent again. + + - After a proper handshake synchronization, QEMU will continue the + postcopy migration on both sides and go back to **POSTCOPY_ACTIVE** + state. Postcopy migration will continue. =20 During a paused postcopy migration, the VM can logically still continue running, and it will not be impacted from any page access to pages that --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992648; cv=none; d=zohomail.com; s=zohoarc; b=f4m+nlaDlWzIRzgkIy3bm/hXz2jcOynFpDRbeEXOihXaw0IjK/YFFhYT4dNiezKETLBu5iV1jMUAS/+rPObkJOMUJTsNNzJKvoP+AFA/XcJ794Y5qb9PVa5bvDmNgUEl5ShwBFp+FhSBDzFFsDCctlzGmqYPh9B3B6/fpkiNtOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992648; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S7FeEXGMcDSenWm4U8X664XX4ySenbLtOwTL8HqhioI=; b=loPRMOyiks2k5QRb9lkpVFw1F48mQT6BveUEBFehGbfQbSse+gCFqlAtdTM2S7B0LfgjFIVFPNEdNv2WvgmrpS3pt87kNrb1DFr3Xp0jRkBvNpfcZAwTA951Qb4MjcXRLbALvtSIfQ+sn5Q2VCoxQzx+7VQGE8/l049TlY4mHM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992648414255.42991840286334; Fri, 21 Jun 2024 10:57:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTr-0003Yi-9d; Fri, 21 Jun 2024 13:55:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTp-0003YI-RD for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:21 -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 1sKiTn-0003Qn-Lw for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:21 -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 60CE221B41; Fri, 21 Jun 2024 17:55:18 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3615113AAA; Fri, 21 Jun 2024 17:55:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kLcxO4S+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992518; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7FeEXGMcDSenWm4U8X664XX4ySenbLtOwTL8HqhioI=; b=euxbH9qokLJFtjSf7kZOPZYpj0VFHFyT+S3SZG/8gBmTfQlPAeXOoLgQgKgUukVlYrtcFB Tx9rjobCsOFs3YEpDrQyjXyYYqEDsD05CcKrfPzhbrKlNKRgRQvkpx6RFFct+b0Y6cnMO0 CobR1YwIuP1biOxHLOEajw/lGFCrXtA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992518; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7FeEXGMcDSenWm4U8X664XX4ySenbLtOwTL8HqhioI=; b=QH7jPEJxiQsYfYRe409bEax91AksfeATLk2v/sOnQhOc7KjTKT0r1JPlDV0NtrdI0sxRh1 DTm8eOrQHPwFk0Dg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992518; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7FeEXGMcDSenWm4U8X664XX4ySenbLtOwTL8HqhioI=; b=euxbH9qokLJFtjSf7kZOPZYpj0VFHFyT+S3SZG/8gBmTfQlPAeXOoLgQgKgUukVlYrtcFB Tx9rjobCsOFs3YEpDrQyjXyYYqEDsD05CcKrfPzhbrKlNKRgRQvkpx6RFFct+b0Y6cnMO0 CobR1YwIuP1biOxHLOEajw/lGFCrXtA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992518; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7FeEXGMcDSenWm4U8X664XX4ySenbLtOwTL8HqhioI=; b=QH7jPEJxiQsYfYRe409bEax91AksfeATLk2v/sOnQhOc7KjTKT0r1JPlDV0NtrdI0sxRh1 DTm8eOrQHPwFk0Dg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 23/28] tests/migration-tests: Drop most WIN32 ifdefs for postcopy failure tests Date: Fri, 21 Jun 2024 14:54:29 -0300 Message-Id: <20240621175434.31180-24-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1718992649141100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu Most of them are not needed, we can stick with one ifdef inside postcopy_recover_fail() so as to cover the scm right tricks only. The tests won't run on windows anyway due to has_uffd always false. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- tests/qtest/migration-test.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 6207305ff8..b7dea1aabb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1364,9 +1364,9 @@ static void wait_for_postcopy_status(QTestState *one,= const char *status) "completed", NULL }); } =20 -#ifndef _WIN32 static void postcopy_recover_fail(QTestState *from, QTestState *to) { +#ifndef _WIN32 int ret, pair1[2], pair2[2]; char c; =20 @@ -1428,8 +1428,8 @@ static void postcopy_recover_fail(QTestState *from, Q= TestState *to) close(pair1[1]); close(pair2[0]); close(pair2[1]); +#endif } -#endif /* _WIN32 */ =20 static void test_postcopy_recovery_common(MigrateCommon *args) { @@ -1469,7 +1469,6 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) wait_for_postcopy_status(to, "postcopy-paused"); wait_for_postcopy_status(from, "postcopy-paused"); =20 -#ifndef _WIN32 if (args->postcopy_recovery_test_fail) { /* * Test when a wrong socket specified for recover, and then the @@ -1478,7 +1477,6 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) postcopy_recover_fail(from, to); /* continue with a good recovery */ } -#endif /* _WIN32 */ =20 /* * Create a new socket to emulate a new channel that is different @@ -1507,7 +1505,6 @@ static void test_postcopy_recovery(void) test_postcopy_recovery_common(&args); } =20 -#ifndef _WIN32 static void test_postcopy_recovery_double_fail(void) { MigrateCommon args =3D { @@ -1516,7 +1513,6 @@ static void test_postcopy_recovery_double_fail(void) =20 test_postcopy_recovery_common(&args); } -#endif /* _WIN32 */ =20 #ifdef CONFIG_GNUTLS static void test_postcopy_recovery_tls_psk(void) @@ -3782,10 +3778,8 @@ int main(int argc, char **argv) test_postcopy_preempt); migration_test_add("/migration/postcopy/preempt/recovery/plain", test_postcopy_preempt_recovery); -#ifndef _WIN32 migration_test_add("/migration/postcopy/recovery/double-failures", test_postcopy_recovery_double_fail); -#endif /* _WIN32 */ if (is_x86) { migration_test_add("/migration/postcopy/suspend", test_postcopy_suspend); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992605; cv=none; d=zohomail.com; s=zohoarc; b=BSFXvAcpGFaiB/UpYO9w7MLc4DEqdcNgy0pHbXtyXA9yJAjMuN2JWfruzu0kqzzOKS2KgQXyOgBlrtGcn7h4VHKNI00Je+4i/8EjvjIbck5ya2/s7xBGlfDZQH4QNbRQrnN2BJZPn1aPS95HTfE6RtK876chbkLwrNiz4KB4ziY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992605; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7Aaj/WoDV5uAm41cMA1Jz8VwWrLFuTsQAw9Ij2plECo=; b=VREpT3Ri7Mv4qSiIUoOEi7Wlf7idmjnLjTPa5XSSDVnWGPfSnZTtW0qHihfCUsBNyt4+lgVTMMBoNdh1RnjcYIyHCv9wPNutrNy/mYdkxLBeeL6mSexSBFPUZchSA4rJ5qa+gPvPNyBf9qv0josDZwCeGlXFqADZuXrDYWbjQ/s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992605213750.4160699458724; Fri, 21 Jun 2024 10:56:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTt-0003hL-LJ; Fri, 21 Jun 2024 13:55:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTr-0003Yv-Ky for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:23 -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 1sKiTp-0003bi-Jh for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:23 -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 05D0321B40; Fri, 21 Jun 2024 17:55:20 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CDFF313AAA; Fri, 21 Jun 2024 17:55:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OJ98JIa+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992520; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Aaj/WoDV5uAm41cMA1Jz8VwWrLFuTsQAw9Ij2plECo=; b=UqeZyirSgl4zrPxBJ4R4HhItS1QsGvxT8utKE/w4CoQ4/qhGRJZl5GLIqMsCJA2GUJElXw NVZ6rBAwAHYVfIjfkzlDTkbjqPY/R2jxi+Tkuf1Q24Dew/GCYJpQEFDj1xP6kVFzNQqEES zr+qIE/iEhUJXsjqKWmqvGpzn/z13ig= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992520; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Aaj/WoDV5uAm41cMA1Jz8VwWrLFuTsQAw9Ij2plECo=; b=WwEYt153PR7cBHHj5r8DV+EpqHeQweOsMBmqjPGGPxa7TYYZE0R3fyIMZZxp7dkJt7NVWy lZeL3WYaqcBTVHAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992520; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Aaj/WoDV5uAm41cMA1Jz8VwWrLFuTsQAw9Ij2plECo=; b=UqeZyirSgl4zrPxBJ4R4HhItS1QsGvxT8utKE/w4CoQ4/qhGRJZl5GLIqMsCJA2GUJElXw NVZ6rBAwAHYVfIjfkzlDTkbjqPY/R2jxi+Tkuf1Q24Dew/GCYJpQEFDj1xP6kVFzNQqEES zr+qIE/iEhUJXsjqKWmqvGpzn/z13ig= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992520; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Aaj/WoDV5uAm41cMA1Jz8VwWrLFuTsQAw9Ij2plECo=; b=WwEYt153PR7cBHHj5r8DV+EpqHeQweOsMBmqjPGGPxa7TYYZE0R3fyIMZZxp7dkJt7NVWy lZeL3WYaqcBTVHAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 24/28] tests/migration-tests: Always enable migration events Date: Fri, 21 Jun 2024 14:54:30 -0300 Message-Id: <20240621175434.31180-25-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.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: 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: 1718992607006100019 Content-Type: text/plain; charset="utf-8" From: Peter Xu Libvirt should always enable it, so it'll be nice qtest also cover that for all tests on both sides. migrate_incoming_qmp() used to enable it only on dst, now we enable them on both, as we'll start to sanity check events even on the src QEMU. We'll need to leave the one in migrate_incoming_qmp(), because virtio-net-failover test uses that one only, and it relies on the events to work. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 1 + tests/qtest/migration-test.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index 0ac49ceb54..2ca4425d71 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -258,6 +258,7 @@ void migrate_incoming_qmp(QTestState *to, const char *u= ri, const char *fmt, ...) g_assert(!qdict_haskey(args, "uri")); qdict_put_str(args, "uri", uri); =20 + /* This function relies on the event to work, make sure it's enabled */ migrate_set_capability(to, "events", true); =20 rsp =3D qtest_qmp(to, "{ 'execute': 'migrate-incoming', 'arguments': %= p}", diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b7dea1aabb..32e31fff86 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -852,6 +852,13 @@ static int test_migrate_start(QTestState **from, QTest= State **to, unlink(shmem_path); } =20 + /* + * Always enable migration events. Libvirt always uses it, let's try + * to mimic as closer as that. + */ + migrate_set_capability(*from, "events", true); + migrate_set_capability(*to, "events", true); + return 0; } =20 --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992731; cv=none; d=zohomail.com; s=zohoarc; b=hPrJNnx1ugcBnA8Jib/FLYbYUMbNpH1AcA4Cmzu/kW9jYyx17yp34OFu+o/k8IBOexVVbtByyAzYdtWZHX2ZpZErJ9Oxf41b+ulXoHvKT4S0vm+9Qt7xpOpsmio9vxVrX2bOsUja4YcgUdxv6JqI1PxZrUbEcz18MYaFymvFfj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992731; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=em0feHkBfRn3xT6Jmq/15z88Iy4x3quX1jEyjvPUW1A=; b=hdxq9uPOhPHpQjNVzDv8hmao3lwxtpiuFKzcOBHYL+OborWVO+0uVCiZRPnsYtLBEghFKoC0HuJFfNEl1jFaKko7FQ2pBPHonDM6xfYFcxXzCAhplrH8kGm7Gbk3YikL43mjvIXW0L4C42Y0ZR53g9W+i6p4AO1maFp8cKD/+hQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992731810535.6596928776584; Fri, 21 Jun 2024 10:58:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTv-0003tn-UI; Fri, 21 Jun 2024 13:55:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTt-0003gk-Az for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:25 -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 1sKiTq-0003d1-Qz for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:24 -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 9DB2621B37; Fri, 21 Jun 2024 17:55:21 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 723A513AAA; Fri, 21 Jun 2024 17:55:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CP8hDoi+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992521; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=em0feHkBfRn3xT6Jmq/15z88Iy4x3quX1jEyjvPUW1A=; b=IAJeIIm9d97q5ABOBeRFa6L3iyQ4eLsNACfc2eRgRnzG2Jxj0mYbHvoFa5TYFKMbXXSClO J/2WBt7Z9D3gNybJBTMa+79T/RnoUtuWQX3eRTaMRDAXUnxAIwG/b2sTfdscZWB2PzTMfL 3LOb42eIfQlqUwoVTBo23iUpV5x3NEA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992521; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=em0feHkBfRn3xT6Jmq/15z88Iy4x3quX1jEyjvPUW1A=; b=+udtzZgfKCSLmg9m0+tgNIWwxouPAhtXsvLv2KMJQNAWmbZODGIXaCNrie+6OuShHJ094g HetJMqSwcEEgRhBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992521; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=em0feHkBfRn3xT6Jmq/15z88Iy4x3quX1jEyjvPUW1A=; b=IAJeIIm9d97q5ABOBeRFa6L3iyQ4eLsNACfc2eRgRnzG2Jxj0mYbHvoFa5TYFKMbXXSClO J/2WBt7Z9D3gNybJBTMa+79T/RnoUtuWQX3eRTaMRDAXUnxAIwG/b2sTfdscZWB2PzTMfL 3LOb42eIfQlqUwoVTBo23iUpV5x3NEA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992521; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=em0feHkBfRn3xT6Jmq/15z88Iy4x3quX1jEyjvPUW1A=; b=+udtzZgfKCSLmg9m0+tgNIWwxouPAhtXsvLv2KMJQNAWmbZODGIXaCNrie+6OuShHJ094g HetJMqSwcEEgRhBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 25/28] tests/migration-tests: migration_event_wait() Date: Fri, 21 Jun 2024 14:54:31 -0300 Message-Id: <20240621175434.31180-26-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -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: 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: 1718992733955100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu Introduce a small helper to wait for a migration event, generalized from the incoming migration path. Make the helper easier to use by allowing it to keep waiting until the expected event is received. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 31 ++++++++++++++++++++++--------- tests/qtest/migration-helpers.h | 2 ++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index 2ca4425d71..84f49db85e 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -249,7 +249,7 @@ void migrate_set_capability(QTestState *who, const char= *capability, void migrate_incoming_qmp(QTestState *to, const char *uri, const char *fmt= , ...) { va_list ap; - QDict *args, *rsp, *data; + QDict *args, *rsp; =20 va_start(ap, fmt); args =3D qdict_from_vjsonf_nofail(fmt, ap); @@ -272,14 +272,7 @@ void migrate_incoming_qmp(QTestState *to, const char *= uri, const char *fmt, ...) g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); =20 - rsp =3D qtest_qmp_eventwait_ref(to, "MIGRATION"); - g_assert(qdict_haskey(rsp, "data")); - - data =3D qdict_get_qdict(rsp, "data"); - g_assert(qdict_haskey(data, "status")); - g_assert_cmpstr(qdict_get_str(data, "status"), =3D=3D, "setup"); - - qobject_unref(rsp); + migration_event_wait(to, "setup"); } =20 /* @@ -518,3 +511,23 @@ bool probe_o_direct_support(const char *tmpfs) return true; } #endif + +/* + * Wait for a "MIGRATION" event. This is what Libvirt uses to track + * migration status changes. + */ +void migration_event_wait(QTestState *s, const char *target) +{ + QDict *response, *data; + const char *status; + bool found; + + do { + response =3D qtest_qmp_eventwait_ref(s, "MIGRATION"); + data =3D qdict_get_qdict(response, "data"); + g_assert(data); + status =3D qdict_get_str(data, "status"); + found =3D (strcmp(status, target) =3D=3D 0); + qobject_unref(response); + } while (!found); +} diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index 50095fca4a..72dba369fb 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -63,4 +63,6 @@ static inline bool probe_o_direct_support(const char *tmp= fs) } #endif void migration_test_add(const char *path, void (*fn)(void)); +void migration_event_wait(QTestState *s, const char *target); + #endif /* MIGRATION_HELPERS_H */ --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992572; cv=none; d=zohomail.com; s=zohoarc; b=Hok5LZXDACHV3uhi4cITPoPgqfPC8WrCRS61r4TJpJsCUFnmDZmsvBih3jrLlLeTsjMrwxl9fjS1SLaB8gfNnvj+NOxKP1euXvbom0xV7Kcb8fZdPrY205kD6RZHEXwjVzJ8F0y5+Ueye0t26UbhP7fmc1Nln/NZeiey0G4FTeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992572; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sB5+79GfgNvdFWLzsaQtJ0tJEUDEdIavcTii06vymnY=; b=Lrm7lhuILlOjeSMVoIgD/lDVoS40wonusEGFmy2lblRQYWN0T2idvmzN3TWvZo+eRphq5dnrtv5AgsmTUbptEHBujbh9A0dhxymP2+hoyfBYSYKmrXj51Nywwpl0x1EVstvcwOx7+r1tEofNTnrH/Z9pUur8mIYTlVm5Kl6RG34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992572034192.19114616211414; Fri, 21 Jun 2024 10:56:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTw-0003yS-Pg; Fri, 21 Jun 2024 13:55:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTu-0003kG-5l for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:26 -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 1sKiTs-0003f1-G3 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:25 -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 3EC8B1FB83; Fri, 21 Jun 2024 17:55:23 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 150EA13AAA; Fri, 21 Jun 2024 17:55:21 +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 YNoeM4m+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sB5+79GfgNvdFWLzsaQtJ0tJEUDEdIavcTii06vymnY=; b=CuQQI8nf9ziYIJA8uY8xZKyAStAAxbSEYXAjYx8aC22NUCBE4fPy+ycircREEgyNvSmkpO zb7lyCvdnO82/naTVhlqeisvlSyb3iKFVuv7I7lme+epEQHBFOFE1Xf1cSdgymYSCHGsYd YiULIa85hk3nzjYceXKOGeBF5NiGMV0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sB5+79GfgNvdFWLzsaQtJ0tJEUDEdIavcTii06vymnY=; b=C//05ODuji+Kh6GOSyp9euLfx4/eepTg8/pxlWLJjZYjZeFJfMMaMdlSss9L76cmbS/Agp Maw7dM4z8DP8B0Dw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sB5+79GfgNvdFWLzsaQtJ0tJEUDEdIavcTii06vymnY=; b=CuQQI8nf9ziYIJA8uY8xZKyAStAAxbSEYXAjYx8aC22NUCBE4fPy+ycircREEgyNvSmkpO zb7lyCvdnO82/naTVhlqeisvlSyb3iKFVuv7I7lme+epEQHBFOFE1Xf1cSdgymYSCHGsYd YiULIa85hk3nzjYceXKOGeBF5NiGMV0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sB5+79GfgNvdFWLzsaQtJ0tJEUDEdIavcTii06vymnY=; b=C//05ODuji+Kh6GOSyp9euLfx4/eepTg8/pxlWLJjZYjZeFJfMMaMdlSss9L76cmbS/Agp Maw7dM4z8DP8B0Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 26/28] tests/migration-tests: Verify postcopy-recover-setup status Date: Fri, 21 Jun 2024 14:54:32 -0300 Message-Id: <20240621175434.31180-27-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; 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: 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: 1718992572808100011 Content-Type: text/plain; charset="utf-8" From: Peter Xu Making sure the postcopy-recover-setup status is present in the postcopy failure unit test. Note that it only applies to src QEMU not dest. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/migration-test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 32e31fff86..e61096adfe 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1413,6 +1413,12 @@ static void postcopy_recover_fail(QTestState *from, = QTestState *to) migrate_recover(to, "fd:fd-mig"); migrate_qmp(from, to, "fd:fd-mig", NULL, "{'resume': true}"); =20 + /* + * Source QEMU has an extra RECOVER_SETUP phase, dest doesn't have it. + * Make sure it appears along the way. + */ + migration_event_wait(from, "postcopy-recover-setup"); + /* * Make sure both QEMU instances will go into RECOVER stage, then test * kicking them out using migrate-pause. --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992619; cv=none; d=zohomail.com; s=zohoarc; b=ZbV3wofkzIbbhq8jc2XoyhQ5hBo399BbHHuEtcGqicHmDFIk4gcauAu4qaFt/G9fQJcEzgJkYyMfzq8Ft4mq2NELpenvErR8eST0mXx9S3E+Q3Pigbvl3+Lv5JcbSPiUV8YuxHNtUxn1drMZqD1IHowpZcpCcZJjsnneOWuIZs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992619; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Us4frndFyCNSheambPS6o9NAb9jTM2+BpJbWyRSqIMg=; b=elTdUmRcfoHm8smMxHDDK5QXTEV8f41fyNlsmMt1tSDXxK6mYT32km1WlcxN9Bmp3/gSf1er3vLAXEJfDMq5qS/NQTlDgd1FBXeSB/XTiuOTkdR8o5csBiI3ZeDgQ/9jzM4V4Bp833dv30mpuSnvZvpZPgyoyuZJxwv8j5CodV4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992619850835.136018629276; Fri, 21 Jun 2024 10:56:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiTx-00042S-SY; Fri, 21 Jun 2024 13:55:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTw-0003xM-GN for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:28 -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 1sKiTu-0003fc-AF for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:28 -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 DBABC1F7F2; Fri, 21 Jun 2024 17:55:24 +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 AEA4113AAA; Fri, 21 Jun 2024 17:55:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qItLHIu+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Us4frndFyCNSheambPS6o9NAb9jTM2+BpJbWyRSqIMg=; b=BQ7bELo1mCPd5Tft168IFyFhmVnoXwg/+5/wtJpuvmkjd8/NdCpO9kQR9mf1QyrQ19Zjux X2tnOOk9OXUnNsktiJ0ZP+7EvtagIfMpxGiXcI1mcjuuEqzzlUNFlvE2NE78wDeu2VTZ3g +o9gp/VJBE2PJRm4J+Gae7ovIXBLBnw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Us4frndFyCNSheambPS6o9NAb9jTM2+BpJbWyRSqIMg=; b=9Oe0Be0z+qcwCnCLtLbhnO+UqrQG0TFBwMWr91lqHNpE1sFsKi53e3JYuwHugu5iwhsiFY VLL8m7kuWxJEbgAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=BQ7bELo1; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9Oe0Be0z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Us4frndFyCNSheambPS6o9NAb9jTM2+BpJbWyRSqIMg=; b=BQ7bELo1mCPd5Tft168IFyFhmVnoXwg/+5/wtJpuvmkjd8/NdCpO9kQR9mf1QyrQ19Zjux X2tnOOk9OXUnNsktiJ0ZP+7EvtagIfMpxGiXcI1mcjuuEqzzlUNFlvE2NE78wDeu2VTZ3g +o9gp/VJBE2PJRm4J+Gae7ovIXBLBnw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Us4frndFyCNSheambPS6o9NAb9jTM2+BpJbWyRSqIMg=; b=9Oe0Be0z+qcwCnCLtLbhnO+UqrQG0TFBwMWr91lqHNpE1sFsKi53e3JYuwHugu5iwhsiFY VLL8m7kuWxJEbgAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson Subject: [PULL 27/28] tests/migration-tests: Cover postcopy failure on reconnect Date: Fri, 21 Jun 2024 14:54:33 -0300 Message-Id: <20240621175434.31180-28-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: DBABC1F7F2 X-Spam-Score: -3.01 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 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: 1718992621055100011 Content-Type: text/plain; charset="utf-8" From: Peter Xu Make sure there will be an event for postcopy recovery, irrelevant of whether the reconnect will success, or when the failure happens. The added new case is to fail early in postcopy recovery, in which case it didn't even reach RECOVER stage on src (and in real life it'll be the same to dest, but the test case is just slightly more involved due to the dual socketpair setup). To do that, rename the postcopy_recovery_test_fail to reflect either stage to fail, instead of a boolean. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Signed-off-by: Fabiano Rosas --- tests/qtest/migration-test.c | 95 +++++++++++++++++++++++++++++------- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e61096adfe..571fc1334c 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -73,6 +73,17 @@ static QTestMigrationState dst_state; #define QEMU_ENV_SRC "QTEST_QEMU_BINARY_SRC" #define QEMU_ENV_DST "QTEST_QEMU_BINARY_DST" =20 +typedef enum PostcopyRecoveryFailStage { + /* + * "no failure" must be 0 as it's the default. OTOH, real failure + * cases must be >0 to make sure they trigger by a "if" test. + */ + POSTCOPY_FAIL_NONE =3D 0, + POSTCOPY_FAIL_CHANNEL_ESTABLISH, + POSTCOPY_FAIL_RECOVERY, + POSTCOPY_FAIL_MAX +} PostcopyRecoveryFailStage; + #if defined(__linux__) #include #include @@ -693,7 +704,7 @@ typedef struct { /* Postcopy specific fields */ void *postcopy_data; bool postcopy_preempt; - bool postcopy_recovery_test_fail; + PostcopyRecoveryFailStage postcopy_recovery_fail_stage; } MigrateCommon; =20 static int test_migrate_start(QTestState **from, QTestState **to, @@ -1371,12 +1382,16 @@ static void wait_for_postcopy_status(QTestState *on= e, const char *status) "completed", NULL }); } =20 -static void postcopy_recover_fail(QTestState *from, QTestState *to) +static void postcopy_recover_fail(QTestState *from, QTestState *to, + PostcopyRecoveryFailStage stage) { #ifndef _WIN32 + bool fail_early =3D (stage =3D=3D POSTCOPY_FAIL_CHANNEL_ESTABLISH); int ret, pair1[2], pair2[2]; char c; =20 + g_assert(stage > POSTCOPY_FAIL_NONE && stage < POSTCOPY_FAIL_MAX); + /* Create two unrelated socketpairs */ ret =3D qemu_socketpair(PF_LOCAL, SOCK_STREAM, 0, pair1); g_assert_cmpint(ret, =3D=3D, 0); @@ -1410,6 +1425,14 @@ static void postcopy_recover_fail(QTestState *from, = QTestState *to) ret =3D send(pair2[1], &c, 1, 0); g_assert_cmpint(ret, =3D=3D, 1); =20 + if (stage =3D=3D POSTCOPY_FAIL_CHANNEL_ESTABLISH) { + /* + * This will make src QEMU to fail at an early stage when trying to + * resume later, where it shouldn't reach RECOVER stage at all. + */ + close(pair1[1]); + } + migrate_recover(to, "fd:fd-mig"); migrate_qmp(from, to, "fd:fd-mig", NULL, "{'resume': true}"); =20 @@ -1419,28 +1442,53 @@ static void postcopy_recover_fail(QTestState *from,= QTestState *to) */ migration_event_wait(from, "postcopy-recover-setup"); =20 + if (fail_early) { + /* + * When fails at reconnection, src QEMU will automatically goes + * back to PAUSED state. Making sure there is an event in this + * case: Libvirt relies on this to detect early reconnection + * errors. + */ + migration_event_wait(from, "postcopy-paused"); + } else { + /* + * We want to test "fail later" at RECOVER stage here. Make sure + * both QEMU instances will go into RECOVER stage first, then test + * kicking them out using migrate-pause. + * + * Explicitly check the RECOVER event on src, that's what Libvirt + * relies on, rather than polling. + */ + migration_event_wait(from, "postcopy-recover"); + wait_for_postcopy_status(from, "postcopy-recover"); + + /* Need an explicit kick on src QEMU in this case */ + migrate_pause(from); + } + /* - * Make sure both QEMU instances will go into RECOVER stage, then test - * kicking them out using migrate-pause. + * For all failure cases, we'll reach such states on both sides now. + * Check them. */ - wait_for_postcopy_status(from, "postcopy-recover"); + wait_for_postcopy_status(from, "postcopy-paused"); wait_for_postcopy_status(to, "postcopy-recover"); =20 /* - * This would be issued by the admin upon noticing the hang, we should - * make sure we're able to kick this out. + * Kick dest QEMU out too. This is normally not needed in reality + * because when the channel is shutdown it should also happen on src. + * However here we used separate socket pairs so we need to do that + * explicitly. */ - migrate_pause(from); - wait_for_postcopy_status(from, "postcopy-paused"); - - /* Do the same test on dest */ migrate_pause(to); wait_for_postcopy_status(to, "postcopy-paused"); =20 close(pair1[0]); - close(pair1[1]); close(pair2[0]); close(pair2[1]); + + if (stage !=3D POSTCOPY_FAIL_CHANNEL_ESTABLISH) { + close(pair1[1]); + } #endif } =20 @@ -1482,12 +1530,12 @@ static void test_postcopy_recovery_common(MigrateCo= mmon *args) wait_for_postcopy_status(to, "postcopy-paused"); wait_for_postcopy_status(from, "postcopy-paused"); =20 - if (args->postcopy_recovery_test_fail) { + if (args->postcopy_recovery_fail_stage) { /* * Test when a wrong socket specified for recover, and then the * ability to kick it out, and continue with a correct socket. */ - postcopy_recover_fail(from, to); + postcopy_recover_fail(from, to, args->postcopy_recovery_fail_stage= ); /* continue with a good recovery */ } =20 @@ -1518,10 +1566,19 @@ static void test_postcopy_recovery(void) test_postcopy_recovery_common(&args); } =20 -static void test_postcopy_recovery_double_fail(void) +static void test_postcopy_recovery_fail_handshake(void) { MigrateCommon args =3D { - .postcopy_recovery_test_fail =3D true, + .postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_RECOVERY, + }; + + test_postcopy_recovery_common(&args); +} + +static void test_postcopy_recovery_fail_reconnect(void) +{ + MigrateCommon args =3D { + .postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_CHANNEL_ESTABLISH, }; =20 test_postcopy_recovery_common(&args); @@ -3791,8 +3848,10 @@ int main(int argc, char **argv) test_postcopy_preempt); migration_test_add("/migration/postcopy/preempt/recovery/plain", test_postcopy_preempt_recovery); - migration_test_add("/migration/postcopy/recovery/double-failures", - test_postcopy_recovery_double_fail); + migration_test_add("/migration/postcopy/recovery/double-failures/h= andshake", + test_postcopy_recovery_fail_handshake); + migration_test_add("/migration/postcopy/recovery/double-failures/r= econnect", + test_postcopy_recovery_fail_reconnect); if (is_x86) { migration_test_add("/migration/postcopy/suspend", test_postcopy_suspend); --=20 2.35.3 From nobody Mon Nov 25 02:07:29 2024 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=1718992569; cv=none; d=zohomail.com; s=zohoarc; b=k8ypmgGVowlxdnwSqE7/eW09B/v0o8q37PEtTtspbvOSPc78sY3lIrwTU4UUMVbUXoNltAvMGRTjczAATTCIc2pNsn5EhVE8U/HkfLk4mEXREhTLQSraAvxOkQ5Vy3mFLUaxGcWfpRFVuEqpnx5rI9JZ6OE9nABTpmKZzowauOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718992569; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3h9OV1SdhGCz8ynGA79uWbpu/f484+imUaupxHcoFAI=; b=ObdNboT4xktv/Blmwi8esyCm9gvpuKalHkHKmFY1p2hpDK/fp1q6g7UGnwsVJMj4D/Wqewj5VDoIoCGPadKeRE4AOyfkurgKvgvm2kbrox0ADEaqoEBO7i8Ty2QQjymUswmEEOpKxUlyDv5ipHZLR1R5ukZLnxrWoOy3kbmBRMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718992569664118.56051243267495; Fri, 21 Jun 2024 10:56:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiU0-000445-07; Fri, 21 Jun 2024 13:55:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiTx-00042Y-Tw for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:29 -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 1sKiTw-0003gb-9P for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:55:29 -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 F067C21B40; Fri, 21 Jun 2024 17:55:26 +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 5304E13AAA; Fri, 21 Jun 2024 17:55:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iEaPBo2+dWZNawAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 17:55:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992527; 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=3h9OV1SdhGCz8ynGA79uWbpu/f484+imUaupxHcoFAI=; b=o4K74RssZZUn0+/RVxUDzwAZeCA23GhPwgWNzKA/KE+fkGie4PUBeG/8DPt7/+G2dHEZxm 6lESO1+hywNhmB8v1Bw1T/NpJfRAi9EbZI05jguCNd5fegQzKZQQ0wx3R+PGaUGDIGs7hV XX266/KbuZE46dk7HDTuhHroGWo74JE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992527; 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=3h9OV1SdhGCz8ynGA79uWbpu/f484+imUaupxHcoFAI=; b=7ijQBXW0Q8WWKwKbLu5UliOwDt0WklFNL3web2qBqHhVfruFQJXZZvsq6bd8UM9vEJj8UI sl9Escxstdkql5DQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718992526; 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=3h9OV1SdhGCz8ynGA79uWbpu/f484+imUaupxHcoFAI=; b=qapceGvL1/WDP2oIcazhBHUrYZETI3vJE/83B5JtvJ7q3nZzDwt743NqgGrsE0UnkK6A/9 S+BOlwd1mBQC3q8Fv8TndxF6j78ZkvJPszHVDcGbDtxMavc6EF5A2k7jnHDSCm/ZQ0wQYU 7FANij17BzUImG0k2bpOOuFvKUf+zno= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718992526; 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=3h9OV1SdhGCz8ynGA79uWbpu/f484+imUaupxHcoFAI=; b=LvE+syifUHm/yK0z94+FOBLhvnQ55jlocB15k3VHfZzTGClfqTnDxQdGsylxM0UGL68F48 wEXTE+VejMgJpWCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li Zhijian Subject: [PULL 28/28] migration: Remove unused VMSTATE_ARRAY_TEST() macro Date: Fri, 21 Jun 2024 14:54:34 -0300 Message-Id: <20240621175434.31180-29-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240621175434.31180-1-farosas@suse.de> References: <20240621175434.31180-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.30 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[linaro.org:email,fujitsu.com:email] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1718992570824100005 From: Philippe Mathieu-Daud=C3=A9 Last use of VMSTATE_ARRAY_TEST() was removed in commit 46baa9007f ("migration/i386: Remove old non-softfloat 64bit FP support"), we can safely get rid of it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Li Zhijian Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- include/migration/vmstate.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 294d2d8486..f313f2f408 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -388,16 +388,6 @@ extern const VMStateInfo vmstate_info_qlist; .offset =3D vmstate_offset_varray(_state, _field, _type), \ } =20 -#define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\ - .name =3D (stringify(_field)), \ - .field_exists =3D (_test), \ - .num =3D (_num), \ - .info =3D &(_info), \ - .size =3D sizeof(_type), \ - .flags =3D VMS_ARRAY, \ - .offset =3D vmstate_offset_array(_state, _field, _type, _num),\ -} - #define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _= type) { \ .name =3D (stringify(_field)), \ .version_id =3D (_version), \ --=20 2.35.3