All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] ndctl list should show more hardware information
@ 2017-07-05  9:12 Yasunori Goto
  2017-07-05 17:23 ` Dan Williams
  0 siblings, 1 reply; 9+ messages in thread
From: Yasunori Goto @ 2017-07-05  9:12 UTC (permalink / raw)
  To: NVDIMM-ML

Hello,

   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.

   This is the first trial patch. So any comments are welcome.

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
---
diff --git a/util/json.c b/util/json.c
index b718d74..749a358 100644
--- a/util/json.c
+++ b/util/json.c
@@ -68,6 +68,9 @@ 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);
+	short phys_id = ndctl_dimm_get_phys_id(dimm);
+	char buf[11];
 	struct json_object *jobj;
 
 	if (!jdimm)
@@ -85,6 +88,18 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm)
 		json_object_object_add(jdimm, "id", jobj);
 	}
 
+	snprintf(buf, 11, "0x%08x", handle);
+	jobj = json_object_new_string(buf);
+	if (!jobj)
+		goto err;
+	json_object_object_add(jdimm, "handle", jobj);
+
+	snprintf(buf, 7, "0x%04x", phys_id );
+	jobj = json_object_new_string(buf);
+	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
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-07-06 14:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-05  9:12 [RFC/PATCH] ndctl list should show more hardware information Yasunori Goto
2017-07-05 17:23 ` Dan Williams
2017-07-05 18:08   ` Linda Knippers
2017-07-05 18:27     ` Dan Williams
2017-07-06  4:13       ` Yasunori Goto
2017-07-06  5:41         ` Dan Williams
2017-07-06  5:48           ` Yasunori Goto
2017-07-06 13:31           ` Linda Knippers
2017-07-06 14:47             ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.