|
|
29b115 |
From 14e49ad3b98f01c1ad6fe456469d40a96a43dc3c Mon Sep 17 00:00:00 2001
|
|
|
29b115 |
From: Gavin Shan <gshan@redhat.com>
|
|
|
29b115 |
Date: Wed, 11 May 2022 18:01:35 +0800
|
|
|
29b115 |
Subject: [PATCH 05/16] hw/arm/virt: Fix CPU's default NUMA node ID
|
|
|
29b115 |
|
|
|
29b115 |
RH-Author: Gavin Shan <gshan@redhat.com>
|
|
|
29b115 |
RH-MergeRequest: 86: hw/arm/virt: Fix the default CPU topology
|
|
|
29b115 |
RH-Commit: [5/6] 5336f62bc0c53c0417db1d71ef89544907bc28c0 (gwshan/qemu-rhel-9)
|
|
|
29b115 |
RH-Bugzilla: 2041823
|
|
|
29b115 |
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Andrew Jones <drjones@redhat.com>
|
|
|
29b115 |
|
|
|
29b115 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2041823
|
|
|
29b115 |
|
|
|
29b115 |
When CPU-to-NUMA association isn't explicitly provided by users,
|
|
|
29b115 |
the default one is given by mc->get_default_cpu_node_id(). However,
|
|
|
29b115 |
the CPU topology isn't fully considered in the default association
|
|
|
29b115 |
and this causes CPU topology broken warnings on booting Linux guest.
|
|
|
29b115 |
|
|
|
29b115 |
For example, the following warning messages are observed when the
|
|
|
29b115 |
Linux guest is booted with the following command lines.
|
|
|
29b115 |
|
|
|
29b115 |
/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
|
|
|
29b115 |
-accel kvm -machine virt,gic-version=host \
|
|
|
29b115 |
-cpu host \
|
|
|
29b115 |
-smp 6,sockets=2,cores=3,threads=1 \
|
|
|
29b115 |
-m 1024M,slots=16,maxmem=64G \
|
|
|
29b115 |
-object memory-backend-ram,id=mem0,size=128M \
|
|
|
29b115 |
-object memory-backend-ram,id=mem1,size=128M \
|
|
|
29b115 |
-object memory-backend-ram,id=mem2,size=128M \
|
|
|
29b115 |
-object memory-backend-ram,id=mem3,size=128M \
|
|
|
29b115 |
-object memory-backend-ram,id=mem4,size=128M \
|
|
|
29b115 |
-object memory-backend-ram,id=mem4,size=384M \
|
|
|
29b115 |
-numa node,nodeid=0,memdev=mem0 \
|
|
|
29b115 |
-numa node,nodeid=1,memdev=mem1 \
|
|
|
29b115 |
-numa node,nodeid=2,memdev=mem2 \
|
|
|
29b115 |
-numa node,nodeid=3,memdev=mem3 \
|
|
|
29b115 |
-numa node,nodeid=4,memdev=mem4 \
|
|
|
29b115 |
-numa node,nodeid=5,memdev=mem5
|
|
|
29b115 |
:
|
|
|
29b115 |
alternatives: patching kernel code
|
|
|
29b115 |
BUG: arch topology borken
|
|
|
29b115 |
the CLS domain not a subset of the MC domain
|
|
|
29b115 |
<the above error log repeats>
|
|
|
29b115 |
BUG: arch topology borken
|
|
|
29b115 |
the DIE domain not a subset of the NODE domain
|
|
|
29b115 |
|
|
|
29b115 |
With current implementation of mc->get_default_cpu_node_id(),
|
|
|
29b115 |
CPU#0 to CPU#5 are associated with NODE#0 to NODE#5 separately.
|
|
|
29b115 |
That's incorrect because CPU#0/1/2 should be associated with same
|
|
|
29b115 |
NUMA node because they're seated in same socket.
|
|
|
29b115 |
|
|
|
29b115 |
This fixes the issue by considering the socket ID when the default
|
|
|
29b115 |
CPU-to-NUMA association is provided in virt_possible_cpu_arch_ids().
|
|
|
29b115 |
With this applied, no more CPU topology broken warnings are seen
|
|
|
29b115 |
from the Linux guest. The 6 CPUs are associated with NODE#0/1, but
|
|
|
29b115 |
there are no CPUs associated with NODE#2/3/4/5.
|
|
|
29b115 |
|
|
|
29b115 |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
29b115 |
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
29b115 |
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
|
|
|
29b115 |
Message-id: 20220503140304.855514-6-gshan@redhat.com
|
|
|
29b115 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
29b115 |
(cherry picked from commit 4c18bc192386dfbca530e7f550e0992df657818a)
|
|
|
29b115 |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
29b115 |
---
|
|
|
29b115 |
hw/arm/virt.c | 4 +++-
|
|
|
29b115 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
29b115 |
|
|
|
29b115 |
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
|
|
29b115 |
index a87c8d396a..95d012d6eb 100644
|
|
|
29b115 |
--- a/hw/arm/virt.c
|
|
|
29b115 |
+++ b/hw/arm/virt.c
|
|
|
29b115 |
@@ -2545,7 +2545,9 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
|
|
|
29b115 |
|
|
|
29b115 |
static int64_t virt_get_default_cpu_node_id(const MachineState *ms, int idx)
|
|
|
29b115 |
{
|
|
|
29b115 |
- return idx % ms->numa_state->num_nodes;
|
|
|
29b115 |
+ int64_t socket_id = ms->possible_cpus->cpus[idx].props.socket_id;
|
|
|
29b115 |
+
|
|
|
29b115 |
+ return socket_id % ms->numa_state->num_nodes;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
|
|
|
29b115 |
--
|
|
|
29b115 |
2.31.1
|
|
|
29b115 |
|