From nobody Wed Jan 15 14:47:09 2025 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 1704983810541925.1494420250341; Thu, 11 Jan 2024 06:36:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7694B1CDF; Thu, 11 Jan 2024 09:36:49 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7284A1D20; Thu, 11 Jan 2024 09:27:42 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B5D8C191A; Thu, 11 Jan 2024 09:26:59 -0500 (EST) 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 420E51C7E for ; Thu, 11 Jan 2024 09:26:55 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-127-7rQjms0ZM0uNStY3aVKSCw-1; Thu, 11 Jan 2024 09:26:53 -0500 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 B32EC1C068D8 for ; Thu, 11 Jan 2024 14:26:52 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.45.226.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BDBC3C25 for ; Thu, 11 Jan 2024 14:26:52 +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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 7rQjms0ZM0uNStY3aVKSCw-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [PATCH v2 07/11] qemu: Make monitor aware of CPU clusters Date: Thu, 11 Jan 2024 15:26:39 +0100 Message-ID: <20240111142644.658765-8-abologna@redhat.com> In-Reply-To: <20240111142644.658765-1-abologna@redhat.com> References: <20240111142644.658765-1-abologna@redhat.com> 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: S3XYNKOZDSWPKWBOC2OOVIPSNKSL6752 X-Message-ID-Hash: S3XYNKOZDSWPKWBOC2OOVIPSNKSL6752 X-MailFrom: abologna@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"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704983811152100001 This makes it so libvirt can obtain accurate information about guest CPUs from QEMU, and should make it possible to correctly perform operations such as CPU hotplug. Of course this is mostly moot at the moment: only aarch64 can use CPU clusters, and CPU hotplug is not yet implemented on that architecture. Signed-off-by: Andrea Bolognani Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_monitor.c | 2 ++ src/qemu/qemu_monitor.h | 2 ++ src/qemu/qemu_monitor_json.c | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3a00fb689e..e2a1bf2c13 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9900,11 +9900,12 @@ qemuDomainRefreshVcpuInfo(virDomainObj *vm, =20 if (validTIDs) VIR_DEBUG("vCPU[%zu] PID %llu is valid " - "(node=3D%d socket=3D%d die=3D%d core=3D%d thread=3D= %d)", + "(node=3D%d socket=3D%d die=3D%d cluster=3D%d core= =3D%d thread=3D%d)", i, (unsigned long long)info[i].tid, info[i].node_id, info[i].socket_id, info[i].die_id, + info[i].cluster_id, info[i].core_id, info[i].thread_id); } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dfad4ee1ea..a1773d86d4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1501,6 +1501,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfo *cpus, cpus[i].qemu_id =3D -1; cpus[i].socket_id =3D -1; cpus[i].die_id =3D -1; + cpus[i].cluster_id =3D -1; cpus[i].core_id =3D -1; cpus[i].thread_id =3D -1; cpus[i].node_id =3D -1; @@ -1658,6 +1659,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl !vcpus[mainvcpu].online; vcpus[mainvcpu].socket_id =3D hotplugvcpus[i].socket_id; vcpus[mainvcpu].die_id =3D hotplugvcpus[i].die_id; + vcpus[mainvcpu].cluster_id =3D hotplugvcpus[i].cluster_id; vcpus[mainvcpu].core_id =3D hotplugvcpus[i].core_id; vcpus[mainvcpu].thread_id =3D hotplugvcpus[i].thread_id; vcpus[mainvcpu].node_id =3D hotplugvcpus[i].node_id; diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index c4af9b407d..981c609e9f 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -590,6 +590,7 @@ struct qemuMonitorQueryHotpluggableCpusEntry { int node_id; int socket_id; int die_id; + int cluster_id; int core_id; int thread_id; =20 @@ -613,6 +614,7 @@ struct _qemuMonitorCPUInfo { * all entries are -1 */ int socket_id; int die_id; + int cluster_id; int core_id; int thread_id; int node_id; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9cb0f3d1d8..e114b6bfb1 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7579,12 +7579,14 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSON= Value *vcpu, entry->node_id =3D -1; entry->socket_id =3D -1; entry->die_id =3D -1; + entry->cluster_id =3D -1; entry->core_id =3D -1; entry->thread_id =3D -1; =20 ignore_value(virJSONValueObjectGetNumberInt(props, "node-id", &entry->= node_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "socket-id", &entry= ->socket_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "die-id", &entry->d= ie_id)); + ignore_value(virJSONValueObjectGetNumberInt(props, "cluster-id", &entr= y->cluster_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "core-id", &entry->= core_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "thread-id", &entry= ->thread_id)); =20 @@ -7622,6 +7624,9 @@ qemuMonitorQueryHotpluggableCpusEntrySort(const void = *p1, if (a->die_id !=3D b->die_id) return a->die_id - b->die_id; =20 + if (a->cluster_id !=3D b->cluster_id) + return a->cluster_id - b->cluster_id; + if (a->core_id !=3D b->core_id) return a->core_id - b->core_id; =20 --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org