Hi, this is a proposal for a common tree for memory hotplug and NUMA policy patches.
The common base for these tree is Igor's "memory device" QOM hierarchy, that subsumes and improves on the "-numa mem" concept that I had proposed. These patches include a basic conversion of his QOM hierarchy to -object. Stefan and Igor are looking at improving -object, but this is not required to build on this series. Thanks to the memory device object, NUMA nodes' memory allocation be expressed easily via a new suboption "-numa node,memdev=ID". For example: -object memory-ram,size=1024M,id=ram-node0 \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ -object memory-ram,size=1024M,id=ram-node1 \ -numa node,nodeid=1,cpus=1,memdev=ram-node1 \ -m 2048 memdev=ID is alternative to mem=SIZE: if you use memdev for one node, you must use it for all of them. When memdev is in use, the single large RAM memory region is replaced by a container region, with all memdevs layed out one after another. The integration between boards and the NUMA subsystem is done by a new function in numa.c, memory_region_allocate_system_memory. Thus, boards have to request NUMA-aware allocation explicitly. This however is not a change compared to Wanlong's patches: both the early ones that hardcoded the "pc.ram" memory region name, and the latest version that similarly introduced a function for boards to call (memory_region_set_mem_policy in his patches). Wanlong can then proceed to add policy properties (hostnode, policy) to backends/hostmem-ram.c, and these will be automatically applicable to hotpluggable memory as well. I'm quite happy with the design of both series. It took quite a long time, but it shows the power of the host/guest separation that is already present in -blockdev/-chardev/-netdev. You can find this at refs/heads/numa in my github repository, where I included also the monitor object-add/object-del patches. Paolo Igor Mammedov (3): qapi: add SIZE type parser to string_input_visitor vl: convert -m to QemuOpts add memdev backend infrastructure Paolo Bonzini (6): QemuOpts: introduce qemu_find_opts_singleton qom: fix leak for objects created with -object qom: catch errors in object_property_add_child pc: pass QEMUMachineInitArgs to pc_memory_init numa: introduce memory_region_allocate_system_memory numa: add -numa node,memdev= option Wanlong Gao (5): NUMA: move numa related code to new file numa.c NUMA: check if the total numa memory size is equal to ram_size NUMA: Add numa_info structure to contain numa nodes info NUMA: convert -numa option to use OptsVisitor NUMA: expand MAX_NODES from 64 to 128 Makefile.target | 2 +- backends/Makefile.objs | 2 + backends/hostmem-ram.c | 46 ++++++++ backends/hostmem.c | 116 ++++++++++++++++++++ cpus.c | 14 --- hw/i386/pc.c | 27 ++--- hw/i386/pc_piix.c | 8 +- hw/i386/pc_q35.c | 4 +- include/hw/i386/pc.h | 7 +- include/qemu/config-file.h | 2 + include/sysemu/cpus.h | 1 - include/sysemu/hostmem.h | 63 +++++++++++ include/sysemu/sysemu.h | 21 +++- monitor.c | 2 +- numa.c | 259 ++++++++++++++++++++++++++++++++++++++++++++ qapi-schema.json | 34 ++++++ qapi/string-input-visitor.c | 18 +++ qemu-options.hx | 7 +- qom/object.c | 9 +- util/qemu-config.c | 14 +++ vl.c | 221 ++++++++++--------------------------- 21 files changed, 664 insertions(+), 213 deletions(-) create mode 100644 backends/hostmem-ram.c create mode 100644 backends/hostmem.c create mode 100644 include/sysemu/hostmem.h create mode 100644 numa.c -- 1.8.4.2