Skip to contentSkip to conversation

ndctl: Microsoft _DSM's support for "ndctl list --health" option

PATCH In review Lijun Pan 2 participants 3 messages Mar 23, 2017 – Mar 24, 2017

Subsystems (2)
lore
Share & tools
lore

Lijun Pan

author
#0 lore raw

PATCH 1/2 ndctl: Microsoft _DSM's support for "ndctl list --health" option

From: Lijun Pan <[email protected]>

Add Microsoft's specific _DSM interface to retrieve the NVDIMM health data from the server platforms supporting this interface. Please refer to Microsoft _DSM spec[1] and JESD245A[2].

[1]. https://msdn.microsoft.com/library/windows/hardware/mt604741
[2]. https://www.jedec.org/sites/default/files/docs/JESD245A.pdf

Cc Stuart Hayes <[email protected]>
---
 ndctl/Makefile.am      |   3 +-
 ndctl/builtin-list.c   |   6 ++-
 ndctl/lib/libndctl.c   |   5 ++
 ndctl/lib/libndctl.sym |   1 +
 ndctl/lib/ndctl-msft.h |  57 ++++++++++++++++++++++
 ndctl/libndctl.h.in    |   1 +
 ndctl/util/json-msft.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++
 util/json.h            |   1 +
 8 files changed, 197 insertions(+), 2 deletions(-)
 create mode 100644 ndctl/lib/ndctl-msft.h
 create mode 100644 ndctl/util/json-msft.c
ndctl/Makefile.am +2 -1
index c563e94..f85f9cb 100644
@@ -10,7 +10,8 @@ ndctl_SOURCES = ndctl.c \
 		 ../util/log.c \
 		builtin-list.c \
 		builtin-test.c \
-		../util/json.c
+		../util/json.c \
+		util/json-msft.c
 
 if ENABLE_SMART
 ndctl_SOURCES += util/json-smart.c
ndctl/builtin-list.c +5 -1
index e8d0070..d4e1d23 100644
@@ -349,7 +349,11 @@ int cmd_list(int argc, const char **argv, void *ctx)
 			if (list.health) {
 				struct json_object *jhealth;
 
-				jhealth = util_dimm_health_to_json(dimm);
+				if (ndctl_dimm_get_dsm_family(dimm) == NVDIMM_FAMILY_MSFT)
+					jhealth = util_dimm_health_to_json_msft(dimm);
+				else
+					jhealth = util_dimm_health_to_json(dimm);
+
 				if (jhealth)
 					json_object_object_add(jdimm, "health",
 							jhealth);
ndctl/lib/libndctl.c +5 -0
index 565c969..019db9a 100644
@@ -1361,6 +1361,11 @@ NDCTL_EXPORT unsigned char ndctl_dimm_get_manufacturing_location(
 	return dimm->manufacturing_location;
 }
 
+NDCTL_EXPORT unsigned long ndctl_dimm_get_dsm_family(struct ndctl_dimm *dimm)
+{
+	return dimm->dsm_family;
+}
+
 NDCTL_EXPORT unsigned short ndctl_dimm_get_format(struct ndctl_dimm *dimm)
 {
 	return dimm->format[0];
ndctl/lib/libndctl.sym +1 -0
index be2e368..b1d6e6f 100644
@@ -48,6 +48,7 @@ global:
 	ndctl_dimm_get_subsystem_vendor;
 	ndctl_dimm_get_subsystem_device;
 	ndctl_dimm_get_subsystem_revision;
+	ndctl_dimm_get_dsm_family;
 	ndctl_dimm_get_format;
 	ndctl_dimm_get_formats;
 	ndctl_dimm_get_formatN;
ndctl/lib/ndctl-msft.h new file +57 -0

57 lines not on this page · raw message

ndctl/libndctl.h.in +1 -0
index c27581d..fb2c6e1 100644
@@ -129,6 +129,7 @@ unsigned short ndctl_dimm_get_subsystem_device(struct ndctl_dimm *dimm);
 unsigned short ndctl_dimm_get_manufacturing_date(struct ndctl_dimm *dimm);
 unsigned char ndctl_dimm_get_manufacturing_location(struct ndctl_dimm *dimm);
 unsigned short ndctl_dimm_get_subsystem_revision(struct ndctl_dimm *dimm);
+unsigned long ndctl_dimm_get_dsm_family(struct ndctl_dimm *dimm);
 unsigned short ndctl_dimm_get_format(struct ndctl_dimm *dimm);
 int ndctl_dimm_get_formats(struct ndctl_dimm *dimm);
 int ndctl_dimm_get_formatN(struct ndctl_dimm *dimm, int i);
ndctl/util/json-msft.c new file +125 -0

125 lines not on this page · raw message

util/json.h +1 -0
index a9afb2d..3a41977 100644
@@ -29,4 +29,5 @@ static inline struct json_object *util_dimm_health_to_json(
 	return NULL;
 }
 #endif
+struct json_object *util_dimm_health_to_json_msft(struct ndctl_dimm *dimm);
 #endif /* __NDCTL_JSON_H__ */
Signature · 6 lines
1.8.3.1

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

PATCH 2/2 ndctl: add msft-dsm command

From: Lijun Pan <[email protected]>

"ndctl msft-dsm" shows more generic NVDIMM info (except health) via calling _DSM functions.

Cc Stuart Hayes <[email protected]>
---
 Documentation/Makefile.am        |   1 +
 Documentation/ndctl-msft-dsm.txt |  83 ++++++++++++++++++
 builtin.h                        |   1 +
 ndctl/Makefile.am                |   1 +
 ndctl/builtin-msft-dsm.c         | 173 +++++++++++++++++++++++++++++++++++++
 ndctl/ndctl.c                    |   1 +
 ndctl/util/json-msft.c           | 179 +++++++++++++++++++++++++++++++++++++++
 util/json.h                      |   1 +
 8 files changed, 440 insertions(+)
 create mode 100644 Documentation/ndctl-msft-dsm.txt
 create mode 100644 ndctl/builtin-msft-dsm.c
Documentation/Makefile.am +1 -0
index 6daeb56..0c04fde 100644
@@ -13,6 +13,7 @@ man1_MANS = \
 	ndctl-create-namespace.1 \
 	ndctl-destroy-namespace.1 \
 	ndctl-list.1 \
+	ndctl-msft-dsm.1 \
 	daxctl-list.1
 
 CLEANFILES = $(man1_MANS)
Documentation/ndctl-msft-dsm.txt new file +83 -0

83 lines not on this page · raw message

builtin.h +1 -0
index 9b66196..425929d 100644
@@ -22,6 +22,7 @@ int cmd_read_labels(int argc, const char **argv, void *ctx);
 int cmd_init_labels(int argc, const char **argv, void *ctx);
 int cmd_check_labels(int argc, const char **argv, void *ctx);
 int cmd_list(int argc, const char **argv, void *ctx);
+int cmd_msft_dsm(int argc, const char **argv, void *ctx);
 #ifdef ENABLE_TEST
 int cmd_test(int argc, const char **argv, void *ctx);
 #endif
ndctl/Makefile.am +1 -0
index f85f9cb..0519e52 100644
@@ -9,6 +9,7 @@ ndctl_SOURCES = ndctl.c \
 		builtin-dimm.c \
 		 ../util/log.c \
 		builtin-list.c \
+		builtin-msft-dsm.c \
 		builtin-test.c \
 		../util/json.c \
 		util/json-msft.c
ndctl/builtin-msft-dsm.c new file +173 -0

173 lines not on this page · raw message

ndctl/ndctl.c +1 -0
index 80a0491..aef2fc2 100644
@@ -67,6 +67,7 @@ static struct cmd_struct commands[] = {
 	{ "check-labels", cmd_check_labels },
 	{ "list", cmd_list },
 	{ "help", cmd_help },
+	{ "msft-dsm", cmd_msft_dsm },
 	#ifdef ENABLE_TEST
 	{ "test", cmd_test },
 	#endif
ndctl/util/json-msft.c +179 -0

194 lines not on this page · raw message

util/json.h +1 -0
index 3a41977..675132f 100644
@@ -30,4 +30,5 @@ static inline struct json_object *util_dimm_health_to_json(
 }
 #endif
 struct json_object *util_dimm_health_to_json_msft(struct ndctl_dimm *dimm);
+struct json_object *util_dimm_dsm_to_json_msft(struct ndctl_dimm *dimm);
 #endif /* __NDCTL_JSON_H__ */
Signature · 6 lines
1.8.3.1

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

Re: [PATCH 2/2] ndctl: add msft-dsm command

Quoted 7 lines · Lijun Pan

From: Lijun Pan <[email protected]>

"ndctl msft-dsm" shows more generic NVDIMM info (except health) via calling _DSM functions.

Cc Stuart Hayes <[email protected]>
Quoted 12 lines
---
 Documentation/Makefile.am        |   1 +
 Documentation/ndctl-msft-dsm.txt |  83 ++++++++++++++++++
 builtin.h                        |   1 +
 ndctl/Makefile.am                |   1 +
 ndctl/builtin-msft-dsm.c         | 173 +++++++++++++++++++++++++++++++++++++
 ndctl/ndctl.c                    |   1 +
 ndctl/util/json-msft.c           | 179 +++++++++++++++++++++++++++++++++++++++
 util/json.h                      |   1 +
 8 files changed, 440 insertions(+)
 create mode 100644 Documentation/ndctl-msft-dsm.txt
 create mode 100644 ndctl/builtin-msft-dsm.c

Hi Lijun.

This is great, thank you for extending ndctl support for the Microsoft family of DIMMs!

However, I'll give the same feedback I gave to the initial HPE support implementation. As much as possible I want to avoid having DIMM family specific enabling in the ndctl utility itself. It should all live behind an abstraction provided by libndctl. That way other applications that might use libndctl directly can get the benefit of the enabling. The approach we took in the HPE case is to introduce ndctl_smart_ops and merge the smart payloads into a common json format. While the current enabling only exposes the SMART health fields that are similar between Intel and HPE, it need not be that way going forward and I'm open to having json fields that are DIMM-family exclusive.

Have a look at extending the existing "ndctl list --dimms --health" output with Microsoft-specific fields, but otherwise reuse existing fields where they are common across other DIMM families.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm