From nobody Mon Feb 9 04:46:02 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1713357598941937.2845597732547; Wed, 17 Apr 2024 05:39:58 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DC1C1179C; Wed, 17 Apr 2024 08:39:57 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 691D11C5C; Wed, 17 Apr 2024 08:37:42 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DE65A1C27; Wed, 17 Apr 2024 08:37:36 -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 D7D5B1C6B for ; Wed, 17 Apr 2024 08:36:52 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-96-ynv4V_PhPt-7FV858Ne19A-1; Wed, 17 Apr 2024 08:36:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64532806602 for ; Wed, 17 Apr 2024 12:36:50 +0000 (UTC) Received: from orkuz (unknown [10.45.224.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id F074618209F for ; Wed, 17 Apr 2024 12:36:49 +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.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: ynv4V_PhPt-7FV858Ne19A-1 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH v2 4/4] qemu: Change return type of qemuDomainFixupCPUs to void Date: Wed, 17 Apr 2024 14:36:11 +0200 Message-ID: <2b5c50ec2cc6cb64b62144166053c2fcc82219a4.1713357265.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: PG4T2WPCXDREF5LIVLKZKEHGC422HIK3 X-Message-ID-Hash: PG4T2WPCXDREF5LIVLKZKEHGC422HIK3 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1713357600457100001 The function never fails. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- Notes: Version 2: - virCPUDefCopy never returns NULL - do not remove !*origCPU check in qemuDomainFixupCPUs - make sure origCPU is set when reconnecting to running domains src/qemu/qemu_domain.c | 12 ++++-------- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_process.c | 8 +++----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3dfabfda2f..3469f0d40c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11050,29 +11050,27 @@ qemuDomainUpdateCPU(virDomainObj *vm, * * This function can only be used on an active domain or when restoring a * domain which was running. - * - * Returns 0 on success, -1 on error. */ -int +void qemuDomainFixupCPUs(virDomainObj *vm, virCPUDef **origCPU) { virArch arch =3D vm->def->os.arch; =20 if (!ARCH_IS_X86(arch)) - return 0; + return; =20 if (!vm->def->cpu || vm->def->cpu->mode !=3D VIR_CPU_MODE_CUSTOM || !vm->def->cpu->model) - return 0; + return; =20 /* Missing origCPU means QEMU created exactly the same virtual CPU whi= ch * we asked for or libvirt was too old to mess up the translation from * host-model. */ if (!*origCPU) - return 0; + return; =20 if (virCPUDefFindFeature(vm->def->cpu, "cmt")) { g_autoptr(virCPUDef) fixedCPU =3D virCPUDefCopyWithoutModel(vm->de= f->cpu); @@ -11093,8 +11091,6 @@ qemuDomainFixupCPUs(virDomainObj *vm, virCPUDefFree(*origCPU); *origCPU =3D g_steal_pointer(&fixedOrig); } - - return 0; } =20 =20 diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 264817eef9..a3089ea449 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -985,7 +985,7 @@ qemuDomainUpdateCPU(virDomainObj *vm, virCPUDef *cpu, virCPUDef **origCPU); =20 -int +void qemuDomainFixupCPUs(virDomainObj *vm, virCPUDef **origCPU); =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7fdb9ac23a..686f6ed6c1 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8278,9 +8278,8 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, /* No cookie means libvirt which saved the domain was too old to mess = up * the CPU definitions. */ - if (cookie && - qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) - return -1; + if (cookie) + qemuDomainFixupCPUs(vm, &cookie->cpu); =20 if (cookie && !cookie->slirpHelper) priv->disableSlirp =3D true; @@ -8926,8 +8925,7 @@ qemuProcessRefreshCPU(virQEMUDriver *driver, * case the host-model is known to not contain features which QEMU * doesn't know about. */ - if (qemuDomainFixupCPUs(vm, &priv->origCPU) < 0) - return -1; + qemuDomainFixupCPUs(vm, &priv->origCPU); } =20 return 0; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org