From nobody Tue Sep 9 09:44:49 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=1746547313; cv=none; d=zohomail.com; s=zohoarc; b=VxTnhPblIHt5tijYc9M08lBlG0E4wjvY8u1mXF1xns0Qy6xZh2WpXo+sNu+KP7gCpuPjwxHad9tFOt8PhdxMZmsvAtV89sCY3eG0mvSOgCCqOscqy2fg2AvRbQ+JK+wKu2YozJ1l8ybXR9pMX3cLyHcyguvP3DdvAwb9npLkMwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746547313; 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:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=ptRxJOC69yJPL+mryRaPdD5PaK7Yiu2qVLuTpe4H+vU=; b=PUpXE/4IW9VDjTQXQm10ShO6IjNF1uBa0DWvsa5zU/ILnLLEoyGKVKAkzc/WrVeFINgLlrWSdOBq91XfdyD9cRSKeru2XPZ/o2+uYdpOXN0jr9U5ypmA21bBzkVnhjj6x9Z631OkCk3Za5BmbkDyfABLZIwrouLMGbp/mANbhlI= 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 1746547313887192.32822577836475; Tue, 6 May 2025 09:01:53 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5884E1504; Tue, 6 May 2025 12:01:53 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1AECA135A; Tue, 6 May 2025 12:00:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E3C29156C; Tue, 6 May 2025 12:00:54 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 82A041424 for ; Tue, 6 May 2025 12:00:45 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-aHBNvdxMNvizjwLGPDdbxg-1; Tue, 06 May 2025 12:00:44 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A6291955E94; Tue, 6 May 2025 16:00:41 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.127]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 364B81956094; Tue, 6 May 2025 16:00:34 +0000 (UTC) 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_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,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=redhat.com; s=mimecast20190719; t=1746547245; h=from:from:reply-to:subject:subject: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=+NpR0xYOkKIQmVHmAyuyMZPnLq40++Dt46hOxtxCL3s=; b=dB2dDyo7V2JRtIHZjBXWkjlLEwTHQNrjEsNmSxJHK9g/RCslcqHUVcMHkSVJ6v1JqgeUl3 XTn0BlU3V0mwU3ABXR2oCrvVEWYoBXjbGRvIDscKW+X53pXfWgYCAnYQN/n9395uclaO0S YnNQCEEymQOFGLx2FnB+96RYlUPetyU= X-MC-Unique: aHBNvdxMNvizjwLGPDdbxg-1 X-Mimecast-MFC-AGG-ID: aHBNvdxMNvizjwLGPDdbxg_1746547241 To: qemu-devel@nongnu.org Subject: [PATCH v3 2/5] include/hw/boards: cope with dev/rc versions in deprecation checks Date: Tue, 6 May 2025 17:00:21 +0100 Message-ID: <20250506160024.2380244-3-berrange@redhat.com> In-Reply-To: <20250506160024.2380244-1-berrange@redhat.com> References: <20250506160024.2380244-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HYLF77NWS7TNET6QGQH6PMIV5QZO5W2T X-Message-ID-Hash: HYLF77NWS7TNET6QGQH6PMIV5QZO5W2T X-MailFrom: berrange@redhat.com 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: Yanan Wang , "Michael S. Tsirkin" , devel@lists.libvirt.org, Marcel Apfelbaum , Zhao Liu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Maydell , John Snow 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9_via_Devel?= Reply-To: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1746547316118019000 Content-Type: text/plain; charset="utf-8" When VERSION is set to a development snapshot (micro >=3D 50), or a release candidate (micro >=3D 90) we have an off-by-1 in determining deprecation and deletion thresholds for versioned machine types. In such cases we need to use the next major/minor version in threshold checks. This adapts the deprecation macros to do "next version" prediction when seeing a dev/rc version number. This ensures users of release candidates get an accurate view of machines that will be deprecated/deleted in the final release. This requires hardcoding our current release policy of 3 releases per year, with a major bump at the start of each year, and that dev/rc versions have micro >=3D 50. Signed-off-by: Daniel P. Berrang=C3=A9 --- include/hw/boards.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 74a8e96b2e..a6784fe984 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -650,11 +650,42 @@ struct MachineState { " years old are subject to deletion after " \ stringify(MACHINE_VER_DELETION_MAJOR) " years" =20 -#define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \ +#define _MACHINE_VER_IS_CURRENT_EXPIRED(cutoff, major, minor) \ (((QEMU_VERSION_MAJOR - major) > cutoff) || \ (((QEMU_VERSION_MAJOR - major) =3D=3D cutoff) && \ (QEMU_VERSION_MINOR - minor) >=3D 0)) =20 +#define _MACHINE_VER_IS_NEXT_MINOR_EXPIRED(cutoff, major, minor) \ + (((QEMU_VERSION_MAJOR - major) > cutoff) || \ + (((QEMU_VERSION_MAJOR - major) =3D=3D cutoff) && \ + ((QEMU_VERSION_MINOR + 1) - minor) >=3D 0)) + +#define _MACHINE_VER_IS_NEXT_MAJOR_EXPIRED(cutoff, major, minor) \ + ((((QEMU_VERSION_MAJOR + 1) - major) > cutoff) || \ + ((((QEMU_VERSION_MAJOR + 1) - major) =3D=3D cutoff) && \ + (0 - minor) >=3D 0)) + +/* + * - The first check applies to formal releases + * - The second check applies to dev snapshots / release candidates + * where the next major version is the same. + * e.g. 9.0.50, 9.1.50, 9.0.90, 9.1.90 + * - The third check applies to dev snapshots / release candidates + * where the next major version will change. + * e.g. 9.2.50, 9.2.90 + * + * NB: this assumes we do 3 minor releases per year, before bumping major, + * and dev snapshots / release candidates are numbered with micro >=3D 50 + * If this ever changes the logic below will need modifying.... + */ +#define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \ + ((QEMU_VERSION_MICRO < 50 && \ + _MACHINE_VER_IS_CURRENT_EXPIRED(cutoff, major, minor)) || \ + (QEMU_VERSION_MICRO >=3D 50 && QEMU_VERSION_MINOR < 2 && \ + _MACHINE_VER_IS_NEXT_MINOR_EXPIRED(cutoff, major, minor)) || \ + (QEMU_VERSION_MICRO >=3D 50 && QEMU_VERSION_MINOR =3D=3D 2 && \ + _MACHINE_VER_IS_NEXT_MAJOR_EXPIRED(cutoff, major, minor))) + #define _MACHINE_VER_IS_EXPIRED2(cutoff, major, minor) \ _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) #define _MACHINE_VER_IS_EXPIRED3(cutoff, major, minor, micro) \ --=20 2.49.0