Skip to contentSkip to conversation

ndctl list should show more hardware information

PATCH Superseded Yasunori Goto 1 participant 1 message Jul 6, 2017 libnvdimm: non-volatile memory device

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ndctl list should show more hardware information

Hi,

I made v2 patch. Please check it.

--
Change log
v2 : - use json_object_new_int() for each data.
- check MAX value for each data.
- phys_id becomes unsigned short from signed short.

---
The current "id" data of dimm (ndctl list -D) shows the information of DIMM module vendor or serial number. However, I think it is not enough.

If a NVDIMM becomes broken, users need to know its physical place rather than vendor or serial number to replace the NVDIMM.

There are 2 candidate of such information.
a) NFIT Device Handle (_ADR of the NVDIMM device)
This date includes node controller id and socket id.
b) NVDIMM Physical ID (Handle for the SMBIOS Memory Device (Type 17)). The dmidecode can show this handle with more information like "Locator" So, user can find the location of NVDIMM.

At first, I think _ADR is enough information.

However, when I talked with our firmware team about this requirement, they said it may not be good data, because the node contoller ID is not stable on our server due to "partitioning" feature.
(Our server can have plural partition on one box, and may have plural

    node 0.)

So, I make the ndctl shows not only NFIT Device Handle but also NVDIMM Physical ID. Then, user can find the location with dmidecode.

---

util/json.c +16 -0
index b718d74..a6775a0 100644
@@ -68,6 +68,8 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm)
 {
 	struct json_object *jdimm = json_object_new_object();
 	const char *id = ndctl_dimm_get_unique_id(dimm);
+	unsigned int handle = ndctl_dimm_get_handle(dimm);
+	unsigned short phys_id = ndctl_dimm_get_phys_id(dimm);
 	struct json_object *jobj;
 
 	if (!jdimm)
@@ -85,6 +87,20 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm)
 		json_object_object_add(jdimm, "id", jobj);
 	}
 
+	if (handle < UINT_MAX) {
+		jobj = json_object_new_int(handle);
+		if (!jobj)
+			goto err;
+		json_object_object_add(jdimm, "handle", jobj);
+	}
+
+	if (phys_id < USHRT_MAX) {
+		jobj = json_object_new_int(phys_id);
+		if (!jobj)
+			goto err;
+		json_object_object_add(jdimm, "phys_id", jobj);
+	}
+
 	if (!ndctl_dimm_is_enabled(dimm)) {
 		jobj = json_object_new_string("disabled");
 		if (!jobj)

---
Yasunori Goto

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm