From nobody Tue Sep 9 03:17:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1747032918; cv=none; d=zohomail.com; s=zohoarc; b=jYIYmF4Bv7z0pv1unrTiwiyxFMomqD6vBQYgCFZZ/OuV+bfaTF8Lfg07j1E2EFGW0JziZhUU7tJpAnlH9eqDvbdnDuv8omV8gPOAkSloXQ3L83AiJ5ZwErQ0+d/ieenUNeR1MdKAqlLEcBkGNT4dVYNzaYlK+KPQeY0hYyZ9pjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747032918; 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:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=kVwN/17QU88z72DMYyu0dumL2BQdoQk+B1DoUUmepC4=; b=ccVRZKPxAHGnBqyBSc6h/vWVk3Uloc0C/9Euv9rJgKCrTv1n9k3EDmrKIReIdMeRb8sjd87PyPS5QOl8x4aZDsy1CyBsOlg6abDTd60H+Kw6h/IHlc88eLoT/39xw+NHmh/W4SXITZ4e3shuLwlPvJO2UXFfW4NJqSC+okNzjOY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1747032918244170.49599960202352; Sun, 11 May 2025 23:55:18 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 42354168C; Mon, 12 May 2025 02:55:17 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 72C1215B8; Mon, 12 May 2025 02:55:00 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1659015B4; Mon, 12 May 2025 02:54:57 -0400 (EDT) Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D5E5612A7 for ; Mon, 12 May 2025 02:54:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1747032888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZWrGNqC9Pg7ebN0m8shKLPzwYbvXpCYLhZnoARh0kYU=; b=ZFb6Elpm1jAEREF1M/q6CdzdHFDMHVA43RImgWE1msQmunmLQtwpiFKxwyuFcbRJhutOw/ d1h7zYtza5lRdzufb9txzF21JkumUOC9p2H9UlX++tb9sC1cwr/5dK58jJ2z++IaxG3Ykg EvO9NStTUXHvBElSGSy7bA1NI42DpOY= To: devel@lists.libvirt.org Subject: [PATCH v3] qemu: fix qemuMigrationCapability enum Date: Mon, 12 May 2025 09:53:10 +0300 Message-Id: <20250512065309.51858-1-frolov@swemel.ru> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PNAGLMTQQTDRLTICIZ5THZ4VURSW3V3D X-Message-ID-Hash: PNAGLMTQQTDRLTICIZ5THZ4VURSW3V3D X-MailFrom: frolov@swemel.ru X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: sdl.libvirt@linuxtesting.org, Dmitry Frolov X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Dmitry Frolov via Devel Reply-To: Dmitry Frolov X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1747032921931116600 Content-Type: text/plain; charset="utf-8" Enum variable of type qemuMigrationCapability is checked for zero in src/qemu/qemu_migration_params.c:729. "if (item->optional) { ..." Actualy, QEMU_MIGRATION_CAP_XBZRLE enum constant has value 0. So, at least, the condition is incorrect. Adding QEMU_MIGRATION_CAP_NONE =3D=3D 0 to enum has several advantages: - less invasive - allows comparing with 0 - this approach is wide used in libvirt - no need to document anything and only one disadvantage: - 0-th bit will be reserved (won`t be used) in the corresponding bitmaps. v1: introducing a separate enum for optional capabilities v2: another approach: fix only the incorrect condition v3: third way: add 0-th constanat to enum Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov --- src/qemu/qemu_migration_params.c | 1 + src/qemu/qemu_migration_params.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index c10660d6f2..ad6ab04a4b 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -92,6 +92,7 @@ VIR_ENUM_IMPL(qemuMigrationCompressMethod, =20 VIR_ENUM_IMPL(qemuMigrationCapability, QEMU_MIGRATION_CAP_LAST, + "none", "xbzrle", "auto-converge", "rdma-pin-all", diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index 17fc63f527..60e6413b3c 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -28,6 +28,7 @@ #include "virenum.h" =20 typedef enum { + QEMU_MIGRATION_CAP_NONE, QEMU_MIGRATION_CAP_XBZRLE, QEMU_MIGRATION_CAP_AUTO_CONVERGE, QEMU_MIGRATION_CAP_RDMA_PIN_ALL, --=20 2.34.1