On Mon, Jun 15, 2015 at 11:17:59AM +0200, Igor Mammedov wrote: > On Fri, 12 Jun 2015 14:30:26 +0530 > Bharata B Rao <bhar...@linux.vnet.ibm.com> wrote: > > > Start storing the (start_addr, size, nodeid) of the pc-dimm memory > > in numa_info so that this information can be used to lookup > > node by address. > > > > Signed-off-by: Bharata B Rao <bhar...@linux.vnet.ibm.com> > > --- > > hw/mem/pc-dimm.c | 4 ++++ > > include/sysemu/numa.h | 10 ++++++++++ > > numa.c | 26 ++++++++++++++++++++++++++ > > 3 files changed, 40 insertions(+) > > > > diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c > > index 98971b7..bb04862 100644 > > --- a/hw/mem/pc-dimm.c > > +++ b/hw/mem/pc-dimm.c > > @@ -97,6 +97,7 @@ void pc_dimm_memory_plug(DeviceState *dev, > > MemoryHotplugState *hpms, > > > > memory_region_add_subregion(&hpms->mr, addr - hpms->base, mr); > > vmstate_register_ram(mr, dev); > > + numa_set_mem_node_id(addr, memory_region_size(mr), dimm->node); > > > > out: > > error_propagate(errp, local_err); > > @@ -105,6 +106,9 @@ out: > > void pc_dimm_memory_unplug(DeviceState *dev, MemoryHotplugState *hpms, > > MemoryRegion *mr) > > { > > + PCDIMMDevice *dimm = PC_DIMM(dev); > > + > > + numa_unset_mem_node_id(dimm->addr, memory_region_size(mr), dimm->node); > Wouldn't that cause pc-dimm range appear in SRAT table?
I don't think so. numa_set_mem_node_id() and numa_unset_mem_node_id() APIs store/remove address range and node id information of realized pc-dimm device in/from a linked list in numa_info structure so that we can lookup the node id for a given address from numa.c in a self-contained manner. So unless I am missing something, I don't see this affecting ACPI/SRAT table in any way. > Before this pc-dimm-s are only added as ACPI devices but don't > advertised in SRAT ACPI table. > > Perhaps make it up to target to decide if it want's to > report dimms with numa_unset_mem_node_id() and not in generic code. Regards, Bharata.