From nobody Sun Dec 14 06:37:34 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=1751637336; cv=none; d=zohomail.com; s=zohoarc; b=YlxroKJ0EqhIjA2+PgCPnesPBEgnRxYjQ1y/hwZtK6J8bTTwqt+VyKj7+YuwuFrkjYi036Kx/Z3DL1X6Q0YxZAGpyA5WzcuiU1kHWYYHowBVx2g3eh7E0jlPoMPG1agL4pBgUqbZjuFAtJ4WE1oLxK1ysWLQY8CzHw3LuT24XxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751637336; 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=czP2Dc1lATtgpKQkWIzdAM9qOQN+QJ73Qu/EjNS9xto=; b=NJKh6UsGP6QsTIueLejsxigpsc858OGMRpomfxP2NuzlkESHOpMRXpEoIzVitDVBHNOGFRfVpfv406cA2h5l4gTWviomYA30M7yDIy3XP+kCUpzSQ92XxJFgXlHKZA2MxGMIedIkQMdojFeHHppB/7VhyD3UnMpV4pwn/+kurEQ= 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 1751637336208604.5129161254689; Fri, 4 Jul 2025 06:55:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 187641582; Fri, 4 Jul 2025 09:55:35 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 291511442; Fri, 4 Jul 2025 09:53:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 479F61401; Fri, 4 Jul 2025 09:53:31 -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 75EE81573 for ; Fri, 4 Jul 2025 09:53:20 -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-225-bPYNvqfVP6OEqeAfrINSKg-1; Fri, 04 Jul 2025 09:53:19 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 405A418089B6 for ; Fri, 4 Jul 2025 13:53:18 +0000 (UTC) Received: from orkuz (unknown [10.45.225.129]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BDD771803AFF for ; Fri, 4 Jul 2025 13:53:17 +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=1751637200; 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=CcaqUaOe11POF+lX0GMbA8ORSudi7ZsXW12/wwlwp4s=; b=EbqXVjCEKfjHjSsoNRdGdoJLNEgp7KyAi8+MxtAEdGpLkc1I34oz3hQpm0sp4f68qmbHcA GR14I5WLBNIpvzdnbKQj6M9qqHBDITzlqN2coR6fGASUkA+IpXnbW0tIuWreOyq99sLVNH F4LCAnXPACHLMwhhJqNN4nm/4a/bQ34= X-MC-Unique: bPYNvqfVP6OEqeAfrINSKg-1 X-Mimecast-MFC-AGG-ID: bPYNvqfVP6OEqeAfrINSKg_1751637198 To: devel@lists.libvirt.org Subject: [PATCH 5/6] qemu: Implement VIR_CONNECT_BASELINE_CPU_IGNORE_HOST Date: Fri, 4 Jul 2025 15:53:03 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 9ARmyvUPU9IccOioUPo2Rsim6Far8y8_YTsTSRE0vBA_1751637198 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: F4VPUY6YIWYM52HKFXY6J2TOQYUZD4Q4 X-Message-ID-Hash: F4VPUY6YIWYM52HKFXY6J2TOQYUZD4Q4 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: 1751637338334116600 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark Signed-off-by: Jiri Denemark --- src/qemu/qemu_driver.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2c06e50454..cf7407ce2d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11970,13 +11970,20 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr co= nn, size_t i; =20 virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); + VIR_CONNECT_BASELINE_CPU_MIGRATABLE | + VIR_CONNECT_BASELINE_CPU_IGNORE_HOST, NULL); =20 if (virConnectBaselineHypervisorCPUEnsureACL(conn) < 0) goto cleanup; =20 migratable =3D !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE); =20 + if ((flags & VIR_CONNECT_BASELINE_CPU_IGNORE_HOST) && ncpus < 2) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("ignoring host is only allowed when computing bas= eline from multiple CPUs")); + goto cleanup; + } + if (!(cpus =3D virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_AUTO))) goto cleanup; =20 @@ -11999,14 +12006,19 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr co= nn, } =20 if (ARCH_IS_X86(arch)) { - int rc =3D virQEMUCapsGetCPUFeatures(qemuCaps, virttype, - migratable, &features); - if (rc < 0) - goto cleanup; - if (features && rc =3D=3D 0) { - /* We got only migratable features from QEMU if we asked for t= hem, - * no further filtering in virCPUBaseline is desired. */ - migratable =3D false; + if (flags & VIR_CONNECT_BASELINE_CPU_IGNORE_HOST) { + VIR_DEBUG("Not adding host's features as VIR_CONNECT_BASELINE_= CPU_IGNORE_HOST was set"); + g_clear_pointer(&cpuModels, virObjectUnref); + } else { + int rc =3D virQEMUCapsGetCPUFeatures(qemuCaps, virttype, + migratable, &features); + if (rc < 0) + goto cleanup; + if (features && rc =3D=3D 0) { + /* We got only migratable features from QEMU if we asked f= or them, + * no further filtering in virCPUBaseline is desired. */ + migratable =3D false; + } } =20 if (!(cpu =3D virCPUBaseline(arch, cpus, ncpus, cpuModels, --=20 2.50.0