From nobody Wed Dec 17 07:06:18 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=1744032313; cv=none; d=zohomail.com; s=zohoarc; b=YcuUBzR+fpUJB3W/JXBQaLhMKT3VQvSFBQA1CBKesWmI47455rnwmMgaG7/F4kINMQ7uDNer9jRcYxk5fm59yWSg7783eVdQE4UFp46Lz48534XhuF+/V4/pvmc/zYufbtYGXiKxk4Tmyb1FFLyS/RLDTOLDKH2TIqvbhgsDPPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744032313; 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=3QeJysm5dVtMmmLV+D9uJ1AXV8BQVFAvDZ81FTAMO1U=; b=V4anvv41O28dVIrBwfeKZ5EHWi7eVt5UghXEAJRAyIc+KE/uc44HQfQC1HjpOXZxAPtH28QZomSuoX1ggqFv7yKDCn6DQqXZIw2cxP22E0PwzrftM3bYtCV6fD9WtpfVMx9Lte07XspWCtRiRv68Iq3ALvZR/XvjCQcH9CGzbbE= 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 1744032313098360.27154205796296; Mon, 7 Apr 2025 06:25:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2619515E4; Mon, 7 Apr 2025 09:25:12 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DD791168B; Mon, 7 Apr 2025 09:24:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AF2481290; Mon, 7 Apr 2025 09:24:25 -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 B073B11C8 for ; Mon, 7 Apr 2025 09:24:24 -0400 (EDT) Received: from mx-prod-mc-05.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-166-E_ob-9IROfKLtQC6r171Uw-1; Mon, 07 Apr 2025 09:24:23 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 601B919560BB for ; Mon, 7 Apr 2025 13:24:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5817D1955BC0; Mon, 7 Apr 2025 13:24:21 +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=1744032264; 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=CbAKJVhQurNN1TlbDJlJfjBgdf66YMECYYn/2IBg2XA=; b=ZaOMW5j4ChWdcIG9AUxvc7kg2kOZY0WW74/h0I+Xaj9O8DgWgqjNISNIo+guRhd9GsK6Ai IMKdoPTL6/p8Tlxg82b4azUxRBlQE6iS+wiDohdWhrtnUqAFwb+k9ZVdFuLu8dAPDZU/mq NSEVugxB2H7h9+pPgxUd4YD5vgAHfdM= X-MC-Unique: E_ob-9IROfKLtQC6r171Uw-1 X-Mimecast-MFC-AGG-ID: E_ob-9IROfKLtQC6r171Uw_1744032262 To: devel@lists.libvirt.org Subject: [PATCH 1/5] virHostCPUGetInfoPopulateLinux: Use automatic memory freeing Date: Mon, 7 Apr 2025 15:24:13 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: tIclnS242UBi02UozTp5v0aHH7FxikIqeQMTvuxeS_0_1744032262 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CAZ4BHSKMDW5HVP4RYOQURBTULUXJIEX X-Message-ID-Hash: CAZ4BHSKMDW5HVP4RYOQURBTULUXJIEX X-MailFrom: pkrempa@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: Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744032315458019100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use 'g_autfree' for the two temporary strings. 'sysfs_cpudir' was used in two places, one of which is in a loop. Add another helper variable for it and declare the other one in the loop. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/util/virhostcpu.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 3b4a11effb..c4138076d9 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -644,8 +644,8 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, int threads_per_subcore =3D 0; unsigned int node; int ret =3D -1; - char *sysfs_nodedir =3D NULL; - char *sysfs_cpudir =3D NULL; + g_autofree char *sysfs_nodedir =3D NULL; + g_autofree char *sysfs_cpudir_fallback =3D NULL; int direrr; *mhz =3D 0; @@ -707,6 +707,8 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, threads_per_subcore =3D 0; while ((direrr =3D virDirRead(nodedir, &nodedirent, sysfs_nodedir)) > = 0) { + char *sysfs_cpudir =3D NULL; + if (sscanf(nodedirent->d_name, "node%u", &node) !=3D 1) continue; @@ -723,8 +725,6 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, &nodethreads, &offline)) < 0) goto cleanup; - VIR_FREE(sysfs_cpudir); - *cpus +=3D nodecpus; if (nodesockets > *sockets) @@ -744,11 +744,9 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, goto done; fallback: - VIR_FREE(sysfs_cpudir); - - sysfs_cpudir =3D g_strdup_printf("%s/cpu", SYSFS_SYSTEM_PATH); + sysfs_cpudir_fallback =3D g_strdup_printf("%s/cpu", SYSFS_SYSTEM_PATH); - if ((nodecpus =3D virHostCPUParseNode(sysfs_cpudir, arch, + if ((nodecpus =3D virHostCPUParseNode(sysfs_cpudir_fallback, arch, present_cpus_map, online_cpus_map, threads_per_subcore, @@ -799,8 +797,6 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, ret =3D 0; cleanup: - VIR_FREE(sysfs_nodedir); - VIR_FREE(sysfs_cpudir); return ret; } --=20 2.49.0 From nobody Wed Dec 17 07:06:18 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=1744032334; cv=none; d=zohomail.com; s=zohoarc; b=lxoZYa4Xn59DCXFOu1M4YwrNxwfxQPqyvI8iedPt4GEO0YZ6gsIv8UtE7hBtCGkcQkRsIQlt1qjkUMc0o7WRh/o3QcKCeiw2EUCYI1Do8dAIxI5C5MKtcSyzqEWQQ/s1vmyvfEqaqqdkXvVs5MZ8zMMYJoT5QRPtanJR52zkvDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744032334; 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=uxC7l5vRorzHZCh23tmlMl/nCO6vSd8dVLhysojYau4=; b=bdo/MRazNaNSWJpnXOnQv2XWMj6lzSD/HJ5IwgT4KQSnr2tWLlHb9TtUoSQCGKBG+OWDCr9hoUzPn9MU2qzlmFLQadTE0KZR0HLHPvpwu9GKhYPkygdVo6xB3Xl6LQbLN7wGeWrm+6vvBGFhY5OKk563wHUWtkRKnlrMXxE0oL8= 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 1744032334372434.25555811730453; Mon, 7 Apr 2025 06:25:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 51FC616F4; Mon, 7 Apr 2025 09:25:33 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 81CBF16DE; Mon, 7 Apr 2025 09:24:34 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1D95B11C8; Mon, 7 Apr 2025 09:24:28 -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 7675D11C8 for ; Mon, 7 Apr 2025 09:24:27 -0400 (EDT) Received: from mx-prod-mc-06.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-114-MhrX_8rePfqicn2vA3Acng-1; Mon, 07 Apr 2025 09:24:25 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DC32418001FC for ; Mon, 7 Apr 2025 13:24:23 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DB08D1955BC0; Mon, 7 Apr 2025 13:24:22 +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=1744032267; 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=Pnrqg3wuexVPinJKYyTl0enRi17kdc0l3YJbeR8sAp4=; b=PMXTh3A/0oa5j18OlcwFl4huWUsI9L/Zx+ThrXDcucmP7VRTls196jEc0c2S359fz8vi3v mabsR7Q5uap9w8Wk/ZlWJNfut12Ca+jbbMPLfIbTyqAPahmfyPQcehgNgRCoZcZL9hRd3n EQEFkj7qBR7pw7BAMP6D25vAbypbjmM= X-MC-Unique: MhrX_8rePfqicn2vA3Acng-1 X-Mimecast-MFC-AGG-ID: MhrX_8rePfqicn2vA3Acng_1744032264 To: devel@lists.libvirt.org Subject: [PATCH 2/5] virHostCPUGetInfoPopulateLinux: Remove 'cleanup' Date: Mon, 7 Apr 2025 15:24:14 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: TE3-1F_1ZhmBui83rrppJxAkq2S1lw_0xZcesAJLzU8_1744032264 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HCVMTT7L7FOFTI6Q6DC65D7HXELI5MCI X-Message-ID-Hash: HCVMTT7L7FOFTI6Q6DC65D7HXELI5MCI X-MailFrom: pkrempa@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: Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744032337598019100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa As the cleanup section is empty; the code can now return directly on errors. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/util/virhostcpu.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index c4138076d9..2c4c75731c 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -643,7 +643,6 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, int nodecpus, nodecores, nodesockets, nodethreads, offline =3D 0; int threads_per_subcore =3D 0; unsigned int node; - int ret =3D -1; g_autofree char *sysfs_nodedir =3D NULL; g_autofree char *sysfs_cpudir_fallback =3D NULL; int direrr; @@ -659,12 +658,11 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, /* Get information about what CPUs are present in the host and what * CPUs are online, so that we don't have to so for each node */ - present_cpus_map =3D virHostCPUGetPresentBitmap(); - if (!present_cpus_map) - goto cleanup; - online_cpus_map =3D virHostCPUGetOnlineBitmap(); - if (!online_cpus_map) - goto cleanup; + if (!(present_cpus_map =3D virHostCPUGetPresentBitmap())) + return -1; + + if (!(online_cpus_map =3D virHostCPUGetOnlineBitmap())) + return -1; /* OK, we've parsed clock speed out of /proc/cpuinfo. Get the * core, node, socket, thread and topology information from /sys @@ -699,7 +697,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, * On hosts other than POWER this will be 0, in which case a simpler * thread-counting logic will be used */ if ((threads_per_subcore =3D virHostCPUGetThreadsPerSubcore(arch)) < 0) - goto cleanup; + return -1; /* If the subcore configuration is not valid, just pretend subcores * are not in use and count threads one by one */ @@ -723,7 +721,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, threads_per_subcore, &nodesockets, &nodecores, &nodethreads, &offline)) < 0) - goto cleanup; + return -1; *cpus +=3D nodecpus; @@ -738,7 +736,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, } if (direrr < 0) - goto cleanup; + return -1; if (*cpus && *nodes) goto done; @@ -752,7 +750,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, threads_per_subcore, &nodesockets, &nodecores, &nodethreads, &offline)) < 0) - goto cleanup; + return -1; *nodes =3D 1; *cpus =3D nodecpus; @@ -764,17 +762,17 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, /* There should always be at least one cpu, socket, node, and thread. = */ if (*cpus =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no CPUs found")); - goto cleanup; + return -1; } if (*sockets =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no sockets found")= ); - goto cleanup; + return -1; } if (*threads =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no threads found")= ); - goto cleanup; + return -1; } /* Now check if the topology makes sense. There are machines that don't @@ -794,10 +792,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, *threads =3D 1; } - ret =3D 0; - - cleanup: - return ret; + return 0; } # define TICK_TO_NSEC (1000ull * 1000ull * 1000ull / sysconf(_SC_CLK_TCK)) --=20 2.49.0 From nobody Wed Dec 17 07:06:18 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=1744032358; cv=none; d=zohomail.com; s=zohoarc; b=U/6QWE8FT1x6Wcx9d7YJf++PHJiVQblXEoJsQWO7idZwkyJIz7YCZkHj4uY4OgXloOOmIGZdbClOBnT/+JqHLqesifLK0oN2W/7ZlA9GDM1moLvLP6cAqc2hOdbMalOykcLJr+cio/Ab4sz5jilKR2WtJwEXOufm+4csdjjpNvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744032358; 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=u2SX+dqBN4a8hKutMPBokWngEUkoaIF3NKx0+ridO48=; b=SEqg4TQl3rtzCDXUTsfKd4sRsK2cf0H+lmEucSHezv1/WFlo+XNLoLpk/RQ2SbPBFabhBMDkqDM/BcCysq2qMJQYYyF8maNTKK7/EswPz3l9CVGaNyAm5fYCIiOPCJDTzAJKMa/F4yjjmkmyJR99z86w76FzqhHgCSHYL8dLScA= 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 1744032358079156.00548566980888; Mon, 7 Apr 2025 06:25:58 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1EC6415CC; Mon, 7 Apr 2025 09:25:57 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C402F15DC; Mon, 7 Apr 2025 09:24:36 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5BB5211C8; Mon, 7 Apr 2025 09:24:28 -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 E2EDF11D5 for ; Mon, 7 Apr 2025 09:24:27 -0400 (EDT) Received: from mx-prod-mc-01.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-356-d50cFJ7sPb2PSG1Yx_uZAw-1; Mon, 07 Apr 2025 09:24:26 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 653E119560BB for ; Mon, 7 Apr 2025 13:24:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F00F1955BC0; Mon, 7 Apr 2025 13:24:24 +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=1744032267; 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=0KjhfDUSg1JvJ+c36/suJ68TQHEda7OfOiGL53TPSb0=; b=AZ0NIGb8IgrQfFb59lIEbErTf9V8Dov2+75VJRJwnJt8zzIsUgcH/we6GEXdJ5ltbYk2Me d55zSzHoswwyNTNmfbAv0uKGgTCvsvf1C9Xn6lCLovF+izR1Fbywd10A6WcNhj8VsBg1Nd FTx73nMccsfXi95dSNnTxmXyHJAhiso= X-MC-Unique: d50cFJ7sPb2PSG1Yx_uZAw-1 X-Mimecast-MFC-AGG-ID: d50cFJ7sPb2PSG1Yx_uZAw_1744032265 To: devel@lists.libvirt.org Subject: [PATCH 3/5] libvirt-host: Clarify/fix description of the CPU frequency field Date: Mon, 7 Apr 2025 15:24:15 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5F7pjJYVPSzp5-3A7aZ7zt3RlNCsXChFgnVkoHDueMo_1744032265 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZNSYX5KUQIGXQ47MVAW2VQGIPVID4BVN X-Message-ID-Hash: ZNSYX5KUQIGXQ47MVAW2VQGIPVID4BVN X-MailFrom: pkrempa@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: Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744032359499019100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The 'virNodeInfo' field for CPU frequency is named 'mhz'. The docs were mentioning 'mHZ', which is neither the field name nor proper spelling of the unit. Reword the paragraph to mention "CPU frequency" instead and explicitly name the field in virNodeInfo struct. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/libvirt-host.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 51a1200c44..9845549e36 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -410,9 +410,9 @@ virConnectGetMaxVcpus(virConnectPtr conn, * Use of this API is strongly discouraged as the information provided * is not guaranteed to be accurate on all hardware platforms. * - * The mHZ value merely reflects the speed that the first CPU in the - * machine is currently running at. This speed may vary across CPUs - * and changes continually as the host OS throttles. + * The CPU frequency value (field 'mhz' in virNodeInfo) merely reflects the + * speed that the first CPU in the machine is currently running at. This s= peed + * may vary across CPUs and changes continually as the host OS throttles. * * The nodes/sockets/cores/threads data is potentially inaccurate as * it assumes a symmetric installation. If one NUMA node has more @@ -420,7 +420,7 @@ virConnectGetMaxVcpus(virConnectPtr conn, * wrong. It is also not able to report about CPU dies. * * Applications are recommended to use the virConnectGetCapabilities() - * call instead, which provides all the information except CPU mHZ, + * call instead, which provides all the information except CPU frequency, * in a more accurate representation. * * Returns 0 in case of success and -1 in case of failure. --=20 2.49.0 From nobody Wed Dec 17 07:06:18 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=1744032374; cv=none; d=zohomail.com; s=zohoarc; b=kzBV9zJ5QcUC30Q1ZRnSoDGlgCM3h0XUFqD2Xg6ZXiAXIIjcFbeDQu00L9JUytx19mAz7Crp+52MWhHp2hswSZh4sgsjWFoZp7vESvOjPQC4rcu5/vmOz8aRh7LSM8aBxokb2KLNAdxXzybUKwzmGW3+04y3ukpZ0F7jF2+4Tv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744032374; 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=aKZDZGupdU+L3mkErISgw0FiTgHjWleu/6x4ONhvGj8=; b=fZM1CzV4BeFuA0WP9s4c1/zjv/6Gu0DANeSo9KIdq42Ib+iI/eUxSfaUw74HN7wBUqaXnhOSfKlRv50llI0KhDWydV8WY/UU82eE0yuwi7Zc9U8cg1tg3GbnMvmdDLZJJppzU+P0eG+a8svD5ieyOdWSZNEcXjXuRlkdPiN7mN8= 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 1744032374698583.9947017521193; Mon, 7 Apr 2025 06:26:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1FB0A1663; Mon, 7 Apr 2025 09:26:14 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7359A1707; Mon, 7 Apr 2025 09:24:39 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BBD651295; Mon, 7 Apr 2025 09:24:29 -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 42AA911C8 for ; Mon, 7 Apr 2025 09:24:29 -0400 (EDT) Received: from mx-prod-mc-03.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-450-Uod7iizROoOglvBZIgE0kQ-1; Mon, 07 Apr 2025 09:24:27 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E18CA19560BC for ; Mon, 7 Apr 2025 13:24:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D942F1955BC2; Mon, 7 Apr 2025 13:24:25 +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=1744032269; 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=3uj4j+a0W4zU/+M+RjoZKf+FLTnKyM2DmIcF4wzLek8=; b=BYUzZHe0eW94HWgxJKFrI7wnjjOo1n4gZl29YphRnKUeeCVVPrj6LDPWOMVI0wO4A9coKx ZUBjVHsDCZF/Fp+TrhEKVih6rzJ9q+mQQEflf5+8Nk5eX0xu2Ws2RlTmHaX9/jOgmnjaGf 4v/2DXMOyt8gRxKW1TjmcRi1wsDsbOs= X-MC-Unique: Uod7iizROoOglvBZIgE0kQ-1 X-Mimecast-MFC-AGG-ID: Uod7iizROoOglvBZIgE0kQ_1744032267 To: devel@lists.libvirt.org Subject: [PATCH 4/5] virNodeGetInfo: Improve description of the case when fake data is reported Date: Mon, 7 Apr 2025 15:24:16 +0200 Message-ID: <5ea49340b5c18696a96bb3cc05f359945140c62f.1744032236.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 9-cK101mX0LqTn_3IN1exUJtye9E3W8V0phS22PgNBw_1744032267 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KUEMADNDHEUPBADYUOLFGPCPX52M7PCV X-Message-ID-Hash: KUEMADNDHEUPBADYUOLFGPCPX52M7PCV X-MailFrom: pkrempa@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: Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744032375751019000 Content-Type: text/plain; charset="utf-8" From: Peter Krempa virNodeGetInfo due to the rigid desing of the filled struct can't faithfully represent all topologies. Improve the description when that happens and outline the fallback topology. The function docs already state that users ought to use virConnectGetCapabilities() instead. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/libvirt-host.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 9845549e36..d82ff993c2 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -414,10 +414,13 @@ virConnectGetMaxVcpus(virConnectPtr conn, * speed that the first CPU in the machine is currently running at. This s= peed * may vary across CPUs and changes continually as the host OS throttles. * - * The nodes/sockets/cores/threads data is potentially inaccurate as - * it assumes a symmetric installation. If one NUMA node has more - * sockets populated that another NUMA node this information will be - * wrong. It is also not able to report about CPU dies. + * The virNodeInfo structure is not extensible thus only supports global + * nodes/sockets/cores/threads (sockets/cores/threads is per NUMA node) + * topology information. If the host CPU has any further groupings (e.g. + * dies, clusters, etc) or the NUMA topology is non-symmetrical the struct= ure + * can't faithfully represent the system. In such cases a fake topology + * (nodes =3D 1, sockets =3D 1, cores =3D number of host cpus, threads =3D= 1) which + * only correctly represents the total host CPU count is reported. * * Applications are recommended to use the virConnectGetCapabilities() * call instead, which provides all the information except CPU frequency, --=20 2.49.0 From nobody Wed Dec 17 07:06:18 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=1744032394; cv=none; d=zohomail.com; s=zohoarc; b=TMUX6cd4SaSpDMww6uCDKXoHIDi1oP5gRcwxxRdcNQRhprUWYgdEU0qYH807/xaG/ghBfGsPkR41slBTr+oRlSreKuWFFMFnMBfFaCqxIbgGWz1ze1WlD2ynzkVXbu0Y8hC7R0ODEHI9v4UXPOYa7Q/3C3byNPerC5Xc/YV+GcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744032394; 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=NTeN/dCwfinUFqodfOxsO7cSX9GLpWms7mblISitoRk=; b=G0T/1U39WhTCsK4EkIA5+h611XcR6N1+PUM92veErtMEXDk31ZY2IrtTFcKUjJknZ+Sou6WeYh4lwUrKC6twyT4nDvX15fCybo8W/EuYzhAhLsJ33byBoCf6vN2+24dtDEJWP3eMm7owfoVB8ZmaIe3C3+9i6RwYI5P3aYmUPR0= 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 1744032394481745.0776670443261; Mon, 7 Apr 2025 06:26:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CD84F163A; Mon, 7 Apr 2025 09:26:33 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5DC1716ED; Mon, 7 Apr 2025 09:25:21 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0EBD6160E; Mon, 7 Apr 2025 09:25:16 -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 19FE6161E for ; Mon, 7 Apr 2025 09:25:02 -0400 (EDT) Received: from mx-prod-mc-04.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-553-Xc9PK9o5OSCQI40KDW1i3g-1; Mon, 07 Apr 2025 09:24:29 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 780D41955DC6 for ; Mon, 7 Apr 2025 13:24:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6F4B21955BC0; Mon, 7 Apr 2025 13:24:27 +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=1744032301; 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=GmWKxahapmaRPu9rbvXHxNkBbDCplDmkqquFee/pRkI=; b=c3zIrHy6e8jCNdYh45My+yAFfXf3/qWb2Tjol8/8xHjikWt5ZOYVpqstzSbTt90w0BXyEy lDJDRd/FGKNMunmX814OA2rv6fFg1BO5EdCB7h4Ea/TiO5AzX9vux4iw24LfB6/7Pmvk5K NBuQDeoEK+xLeoraQJ5w+Xol36Emovs= X-MC-Unique: Xc9PK9o5OSCQI40KDW1i3g-1 X-Mimecast-MFC-AGG-ID: Xc9PK9o5OSCQI40KDW1i3g_1744032268 To: devel@lists.libvirt.org Subject: [PATCH 5/5] manpages: virsh: Use disclaimer from 'virNodeGetInfo()' for 'virsh nodeinfo' Date: Mon, 7 Apr 2025 15:24:17 +0200 Message-ID: <8e9ad20974797f33dd4f76f652e3f6106ff9624b.1744032236.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HIK-V52GZi8xC9WS0ZIKu0oL5GI_drzuQDr2wZcRrtg_1744032268 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HJ3T6RGB4XR233VNFYDC35JDNR25Q4SB X-Message-ID-Hash: HJ3T6RGB4XR233VNFYDC35JDNR25Q4SB X-MailFrom: pkrempa@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: Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744032395564019000 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Adapt the disclarimer about the data not being accurate in many cases from the API docs to the virsh command using the aforementioned API. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- docs/manpages/virsh.rst | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index b609b9647f..cef9959f16 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -427,10 +427,25 @@ nodeinfo nodeinfo Returns basic information about the node, like number and type of CPU, -and size of the physical memory. The output corresponds to virNodeInfo -structure. Specifically, the "CPU socket(s)" field means number of CPU -sockets per NUMA cell. The information libvirt displays is dependent -upon what each architecture may provide. +and size of the physical memory. + +Use of this command is strongly discouraged as the information provided +is not guaranteed to be accurate on all hardware platforms. + +The *CPU frequency* value merely reflects the speed that the first CPU in = the +machine is currently running at. This speed may vary across CPUs and chang= es +continually as the host OS throttles. + +The data structure used to fetch the data is not extensible thus only supp= orts +global nodes/sockets/cores/threads (sockets/cores/threads is per NUMA node) +topology information. If the host CPU has any further groupings (e.g. +dies, clusters, etc) or the NUMA topology is non-symmetrical the data stru= cture +can't faithfully represent the system. In such cases a fake topology +(nodes =3D 1, sockets =3D 1, cores =3D number of host cpus, threads =3D 1)= which +only correctly represents the total host CPU count is reported. + +Recommended replacement is to use the *capabilities* command which reports +the data (except frequency) under ``/capabilities/host/topology`` XPath. nodecpumap --=20 2.49.0