Message ID | 20210615013309.2833323-7-danielhb413@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | pSeries base FORM2 NUMA affinity support | expand |
Daniel Henrique Barboza <danielhb413@gmail.com> writes: > The spapr-nvdimm driver is able to operate in two ways. The first > one is as a regular memory in which the NUMA node of the parent > pc-dimm class is used. The second mode, as persistent memory, allows for > a different NUMA node to be used based on the locality of the device. > > At this moment we don't have a way to express this second NUMA node for > the persistent memory mode. This patch introduces a new 'device-node' > property that will be used by the PPC64 spapr-nvdimm driver to set a > second NUMA node for the nvdimm. if device-node is not specified on the commandline, we should default to the same value of node= attribute? Right now I am finding this default to 0. -aneesh
On 6/15/21 6:33 AM, Aneesh Kumar K.V wrote: > Daniel Henrique Barboza <danielhb413@gmail.com> writes: > >> The spapr-nvdimm driver is able to operate in two ways. The first >> one is as a regular memory in which the NUMA node of the parent >> pc-dimm class is used. The second mode, as persistent memory, allows for >> a different NUMA node to be used based on the locality of the device. >> >> At this moment we don't have a way to express this second NUMA node for >> the persistent memory mode. This patch introduces a new 'device-node' >> property that will be used by the PPC64 spapr-nvdimm driver to set a >> second NUMA node for the nvdimm. > > if device-node is not specified on the commandline, we should default to > the same value of node= attribute? Right now I am finding this default > to 0. I agree. I fixed it in the next version to default to the 'node' value when 'device-node' is omitted. Daniel > > -aneesh >
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 7397b67156..030ccf7575 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -96,6 +96,29 @@ static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name, g_free(value); } +static void nvdimm_get_device_node(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + NVDIMMDevice *nvdimm = NVDIMM(obj); + uint8_t value = nvdimm->device_node; + + visit_type_uint8(v, name, &value, errp); +} + +static void nvdimm_set_device_node(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + NVDIMMDevice *nvdimm = NVDIMM(obj); + uint8_t value; + + if (!visit_type_uint8(v, name, &value, errp)) { + return; + } + + nvdimm->device_node = value; +} static void nvdimm_init(Object *obj) { @@ -105,6 +128,11 @@ static void nvdimm_init(Object *obj) object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid, nvdimm_set_uuid, NULL, NULL); + + object_property_add(obj, NVDIMM_DEVICE_NODE, "uint8", + nvdimm_get_device_node, + nvdimm_set_device_node, + NULL, NULL); } static void nvdimm_finalize(Object *obj) diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h index bcf62f825c..430169322f 100644 --- a/include/hw/mem/nvdimm.h +++ b/include/hw/mem/nvdimm.h @@ -49,6 +49,7 @@ OBJECT_DECLARE_TYPE(NVDIMMDevice, NVDIMMClass, NVDIMM) #define NVDIMM_LABEL_SIZE_PROP "label-size" +#define NVDIMM_DEVICE_NODE "device-node" #define NVDIMM_UUID_PROP "uuid" #define NVDIMM_UNARMED_PROP "unarmed" @@ -89,6 +90,17 @@ struct NVDIMMDevice { * The PPC64 - spapr requires each nvdimm device have a uuid. */ QemuUUID uuid; + + /* + * The spapr-nvdimm (PPC64 NVDIMM) driver supports two modes of + * operation: regular memory and persistent memory. When using the + * device as regular memory, the NUMA nodeid that comes from + * PC_DIMM_NODEPROP is to be used. When used as persistent memory, + * the guest should consider the 'device-node' instead since it + * indicates the locality of the device to an established NUMA + * node, which is more relevant to this type of usage. + */ + uint8_t device_node; }; struct NVDIMMClass {
The spapr-nvdimm driver is able to operate in two ways. The first one is as a regular memory in which the NUMA node of the parent pc-dimm class is used. The second mode, as persistent memory, allows for a different NUMA node to be used based on the locality of the device. At this moment we don't have a way to express this second NUMA node for the persistent memory mode. This patch introduces a new 'device-node' property that will be used by the PPC64 spapr-nvdimm driver to set a second NUMA node for the nvdimm. CC: Shivaprasad G Bhat <sbhat@linux.ibm.com> CC: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- hw/mem/nvdimm.c | 28 ++++++++++++++++++++++++++++ include/hw/mem/nvdimm.h | 12 ++++++++++++ 2 files changed, 40 insertions(+)