From nobody Sun Dec 14 06:38:17 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=1751637316; cv=none; d=zohomail.com; s=zohoarc; b=Q7pZliWufrmnPAorZ06TwQ1ghHNAUjNa0KTrqCkBoD85NidAB13oBeLU8y3zsrysRTrRTm2+Vsu0NagSk+O+RyXs6TEREbt/mnixDyj+yjukGTJCouFS2NyIg1LqFTcBUhx6CMAiIY/x9vkrYuZsOJN4xdAt7EaLaiBgL2BtaBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751637316; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=am4zoHlRsv8NVKJuzshk6xJwZIkVZqvgBtR6veyT/Mc=; b=OZAWqZbWqlMxznUl6Uw4HJOA5gcRqo33wwwktOQnSlj1bLtXPRXJ4+2shfdiT6iphOZI/OFjSQTWV7NLkc31XCsDRfCyuXQ5uDlLMyX5D+vJjIe506oAdEBCv6/LVWw8jVBS+ouTM0Ru4B1ZPLlG99DTnqd5mEdG2bEsCVU0tY8= 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 1751637316863552.4707033972334; Fri, 4 Jul 2025 06:55:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E8F781444; Fri, 4 Jul 2025 09:55:15 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5B2661512; Fri, 4 Jul 2025 09:53:35 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EF4131523; Fri, 4 Jul 2025 09:53:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 A7CF91540 for ; Fri, 4 Jul 2025 09:53:18 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-202-e9-EWwIwPx-p7fYaKZoLPA-1; Fri, 04 Jul 2025 09:53:17 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 544061800343 for ; Fri, 4 Jul 2025 13:53:16 +0000 (UTC) Received: from orkuz (unknown [10.45.225.129]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CC76419560A7 for ; Fri, 4 Jul 2025 13:53:15 +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=1751637198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OXQg3rNac5H4aZvw/Tv5EIndiT0k4j03AETBc+jhzWc=; b=OxFOX1JJAPu+bw+ZGa5vE06p5GL+Ebjv8UoI9O83nelSzl6pQJNylOHLkRuhLSgax94BG+ ds0gX3ediJ2d/PUx2/L2sl5AVm5TStuvqWfxpE0sXDjWgZ+JYC6x7vnmsW0TqYb5wvTAwI 6Y4noy/ZJJMG2vjY2e0QBQmJeiTuCoY= X-MC-Unique: e9-EWwIwPx-p7fYaKZoLPA-1 X-Mimecast-MFC-AGG-ID: e9-EWwIwPx-p7fYaKZoLPA_1751637196 To: devel@lists.libvirt.org Subject: [PATCH 4/6] Introduce VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag Date: Fri, 4 Jul 2025 15:53:02 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sFU8p_b-8oRSQ4HpCUMC3TDIVsZOpdAxNOh5jyXCbQE_1751637196 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: S3T55LQCXFMCQLIPW77IRDI4EGFMNV55 X-Message-ID-Hash: S3T55LQCXFMCQLIPW77IRDI4EGFMNV55 X-MailFrom: jdenemar@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 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: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1751637318073116600 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark With this new flag virConnectHypervisorBaselineCPU can be used on any host (rather than being limited to hosts described by individual CPUs passed to the API). Using the flag makes the API behave similarly to the old virConnectBaselineCPU. The main difference is the CPU definition accepted by both APIs: the old one only accepts host CPU definition, i.e., without 'policy' attributes as seen in the host capabilities XML. Signed-off-by: Jiri Denemark --- include/libvirt/libvirt-host.h | 3 +++ src/libvirt-host.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index 91214ea21b..19043235b2 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -974,6 +974,9 @@ typedef enum { VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES =3D (1 << 0), /* filter out non-migratable features (Since: 1.2.14) */ VIR_CONNECT_BASELINE_CPU_MIGRATABLE =3D (1 << 1), + /* when computing a baseline from several CPUs, do not make the result + * dependent on the current host (Since: 11.5.0) */ + VIR_CONNECT_BASELINE_CPU_IGNORE_HOST =3D (1 << 2), } virConnectBaselineCPUFlags; =20 char *virConnectBaselineCPU(virConnectPtr conn, diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 8d2107fd62..da75f5f30b 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -1305,7 +1305,8 @@ virConnectBaselineCPU(virConnectPtr conn, * it on another host results in an undefined behavior as the computed CPU * model is influenced by the hypervisor (the result may use an unexpected= CPU * model or some features may disabled even though they are supported on a= ll - * input CPUs). + * input CPUs). The undefined behavior can be avoided using + * VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag (see below). * * This is different from virConnectBaselineCPU() which doesn't consider a= ny * hypervisor abilities when computing the best CPU. @@ -1333,6 +1334,11 @@ virConnectBaselineCPU(virConnectPtr conn, * If @flags includes VIR_CONNECT_BASELINE_CPU_MIGRATABLE, the resulting * CPU will not include features that block migration. * + * If @flags contains VIR_CONNECT_BASELINE_CPU_IGNORE_HOST and @ncpus > 1,= the + * API will not consider hypervisor abilities when computing the baseline.= With + * this flag baseline can be safely computed on any host (even those not + * described in @xmlCPUs). + * * Returns XML description of the computed CPU (caller frees) or NULL on e= rror. * * Since: 4.4.0 --=20 2.50.0