summaryrefslogtreecommitdiffstats
path: root/numa.c
diff options
context:
space:
mode:
authorDavid Hildenbrand2019-06-19 11:49:06 +0200
committerMichael S. Tsirkin2019-07-04 23:00:32 +0200
commitcae02c3480b806ce1fb30a3a5c54ae1b43a412e7 (patch)
tree119d23c97320676e2419a7a68fec40d8bf53ae43 /numa.c
parenthmp: Handle virtio-pmem when printing memory device infos (diff)
downloadqemu-cae02c3480b806ce1fb30a3a5c54ae1b43a412e7.tar.gz
qemu-cae02c3480b806ce1fb30a3a5c54ae1b43a412e7.tar.xz
qemu-cae02c3480b806ce1fb30a3a5c54ae1b43a412e7.zip
numa: Handle virtio-pmem in NUMA stats
Account the memory to node 0 for now. Once (if ever) virtio-pmem supports NUMA, we can account it to the right node. Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20190619094907.10131-7-pagupta@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r--numa.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/numa.c b/numa.c
index 955ec0c830..cfcdb8d943 100644
--- a/numa.c
+++ b/numa.c
@@ -549,6 +549,7 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
MemoryDeviceInfoList *info_list = qmp_memory_device_list();
MemoryDeviceInfoList *info;
PCDIMMDeviceInfo *pcdimm_info;
+ VirtioPMEMDeviceInfo *vpi;
for (info = info_list; info; info = info->next) {
MemoryDeviceInfo *value = info->value;
@@ -556,22 +557,21 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
if (value) {
switch (value->type) {
case MEMORY_DEVICE_INFO_KIND_DIMM:
- pcdimm_info = value->u.dimm.data;
- break;
-
case MEMORY_DEVICE_INFO_KIND_NVDIMM:
- pcdimm_info = value->u.nvdimm.data;
- break;
-
- default:
- pcdimm_info = NULL;
- break;
- }
-
- if (pcdimm_info) {
+ pcdimm_info = value->type == MEMORY_DEVICE_INFO_KIND_DIMM ?
+ value->u.dimm.data : value->u.nvdimm.data;
node_mem[pcdimm_info->node].node_mem += pcdimm_info->size;
node_mem[pcdimm_info->node].node_plugged_mem +=
pcdimm_info->size;
+ break;
+ case MEMORY_DEVICE_INFO_KIND_VIRTIO_PMEM:
+ vpi = value->u.virtio_pmem.data;
+ /* TODO: once we support numa, assign to right node */
+ node_mem[0].node_mem += vpi->size;
+ node_mem[0].node_plugged_mem += vpi->size;
+ break;
+ default:
+ g_assert_not_reached();
}
}
}