ndctl: add support for HPE type N SMART health data
cover ndctl: add support for HPE type N SMART health data
This pair of patches adds support for the HPE SMART DSM functions and enables ndctl to report DIMM health data for HPE type N NVDIMMs. The relevant firmware interfaces are described in [1].
The first patch simply makes the existing parse_smart_temperature() function global so that it can be used by the new HPE-specific code.
The second patch adds an HPE equivalent for the existing util_dimm_health_to_json(). util_hpe_dimm_health_to_json() calls the HPE DSM functions and populates a JSON object with health data. This patch delivers health reporting parity for HPE type N NVDIMMs, but we are planning a future patch to export JSON for some of the additional health data defined in [1].
If you'd like to test these changes, note the following:
. Some of the DSM functions for HPE type N NVDIMMs, including the ones used
by this patch, require the acpi_ipmi kernel module to be loaded, and you may need to manually modprobe it.
. Without [2], you'll need to include '--idle' in your ndctl invocation as
ndctl will consider type Ns to be disabled and will otherwise omit them.
[1] https://github.com/HewlettPackard/hpe-nvm/raw/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v84s.pdf
[2] https://lists.01.org/pipermail/linux-nvdimm/2016-August/006619.html
Brian Boylston (2):
util: make parse_smart_temperature() global ndctl, util: add support for HPE DSM SMART interfaces
ndctl/Makefile.am | 1 + ndctl/builtin-list.c | 2 + ndctl/util/json-hpe.c | 283 ++++++++++++++++++++++++++++++++++++++++ ndctl/util/json-smart.c | 2 +- ndctl/util/json.h | 11 ++ ndctl/util/ndctl-hpe1.h | 335 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 633 insertions(+), 1 deletion(-) create mode 100644 ndctl/util/json-hpe.c create mode 100644 ndctl/util/ndctl-hpe1.h
Signature · 6 lines
2.8.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH 1/2 util: make parse_smart_temperature() global
Allow parse_smart_temperature() to be called by other modules with similar temperature decoding needs.
--- ndctl/util/json-smart.c | 2 +- ndctl/util/json.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
ndctl/util/json-smart.c +1 -1
@@ -11,7 +11,7 @@#include <ndctl.h> #endif -static double parse_smart_temperature (unsigned int temp) +double parse_smart_temperature (unsigned int temp) {bool negative = !!(temp & (1 <<15 ));double t;
ndctl/util/json.h +5 -0
@@ -13,8 +13,13 @@ struct json_object *util_mapping_to_json(struct ndctl_mapping *mapping);struct json_object *util_namespace_to_json (struct ndctl_namespace *ndns,bool include_idle);#ifdef HAVE_NDCTL_SMART +double parse_smart_temperature (unsigned int temp);struct json_object *util_dimm_health_to_json (struct ndctl_dimm *dimm);#else +static inline double parse_smart_temperature (unsigned int temp) +{ +return 0.0 ; +}static inline struct json_object *util_dimm_health_to_json (struct ndctl_dimm *dimm) {
Signature · 6 lines
2.8.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH 2/2 ndctl, util: add support for HPE DSM SMART interfaces
In reply to Brian BoylstonThis patch introduces util_hpe_dimm_health_to_json(), which calls the HPE DSM functions defined in [1] and populates a JSON object with health data. This delivers health reporting parity for HPE type N NVDIMMs, but we are planning a future patch to export JSON for some of the additional health data defined in [1].
[1] https://github.com/HewlettPackard/hpe-nvm/raw/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v84s.pdf
--- ndctl/Makefile.am | 1 + ndctl/builtin-list.c | 2 + ndctl/util/json-hpe.c | 283 ++++++++++++++++++++++++++++++++++++++++ ndctl/util/json.h | 6 + ndctl/util/ndctl-hpe1.h | 335 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) create mode 100644 ndctl/util/json-hpe.c create mode 100644 ndctl/util/ndctl-hpe1.h
ndctl/Makefile.am +1 -0
@@ -48,6 +48,7 @@ ndctl_SOURCES = ndctl.c \ if ENABLE_SMART ndctl_SOURCES += util/json-smart.c +ndctl_SOURCES += util/json-hpe.c endif if ENABLE_DESTRUCTIVE
ndctl/builtin-list.c +2 -0
@@ -316,6 +316,8 @@ int cmd_list(int argc, const char **argv)struct json_object *jhealth; jhealth =util_dimm_health_to_json (dimm); +if (!jhealth) + jhealth =util_hpe_dimm_health_to_json (dimm);if (jhealth)json_object_object_add (jdimm,"health" , jhealth);
ndctl/util/json-hpe.c new file +283 -0
283 lines not on this page · raw message
ndctl/util/json.h +6 -0
@@ -15,6 +15,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,#ifdef HAVE_NDCTL_SMART double parse_smart_temperature (unsigned int temp);struct json_object *util_dimm_health_to_json (struct ndctl_dimm *dimm); +struct json_object *util_hpe_dimm_health_to_json (struct ndctl_dimm *dimm);#else static inline double parse_smart_temperature (unsigned int temp) {
@@ -25,5 +26,10 @@ static inline struct json_object *util_dimm_health_to_json( {return NULL ; } +static inline struct json_object *util_hpe_dimm_health_to_json ( +struct ndctl_dimm *dimm) +{ +return NULL ; +}#endif #endif /* __NDCTL_JSON_H__ */
ndctl/util/ndctl-hpe1.h new file +335 -0
335 lines not on this page · raw message
Signature · 6 lines
2.8.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [ndctl PATCH 2/2] ndctl, util: add support for HPE DSM SMART interfaces
Quoted 38 lines · Brian Boylston
This patch introduces
util_hpe_dimm_health_to_json(), which calls the HPE DSM functions defined in [1] and populates a JSON object with health data. This delivers health reporting parity for HPE type N NVDIMMs, but we are planning a future patch to export JSON for some of the additional health data defined in [1].[1] https://github.com/HewlettPackard/hpe-nvm/raw/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v84s.pdf
Cc Dan Williams <[email protected]>Reviewed-by Jerry Hoemann <[email protected]>Signed-off-by Brian Boylston <[email protected]>--- ndctl/Makefile.am | 1 + ndctl/builtin-list.c | 2 + ndctl/util/json-hpe.c | 283 ++++++++++++++++++++++++++++++++++++++++ ndctl/util/json.h | 6 + ndctl/util/ndctl-hpe1.h | 335 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) create mode 100644 ndctl/util/json-hpe.c create mode 100644 ndctl/util/ndctl-hpe1.hndctl/Makefile.am +1
-0@@ -48,6 +48,7 @@ ndctl_SOURCES = ndctl.c \ if ENABLE_SMART ndctl_SOURCES += util/json-smart.c +ndctl_SOURCES += util/json-hpe.c endif if ENABLE_DESTRUCTIVEndctl/builtin-list.c +0
-0
ndctl/builtin-list.c int cmd_list(int argc, const char **argv) · line 320
Quoted 5 lines
ndctl/builtin-list.c +2
-0@@ -316,6 +316,8 @@ int cmd_list(int argc, const char **argv)struct json_object *jhealth; jhealth =util_dimm_health_to_json (dimm); +if (!jhealth) + jhealth =util_hpe_dimm_health_to_json (dimm);
Try and error probing for the correct vendor? There surely must be a better way to do.
But anyway nice job Brian (way better than my attempts to "live patch" the ioctls in the kernel)
Byte,
Johannes
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
RE: [ndctl PATCH 2/2] ndctl, util: add support for HPE DSM SMART interfaces
Johannes Thumshirn wrote on 2016-09-02:
Quoted 40 lines · Brian Boylston
Quoted 39 lines
This patch introduces
util_hpe_dimm_health_to_json(), which calls the HPE DSM functions defined in [1] and populates a JSON object with health data. This delivers health reporting parity for HPE type N NVDIMMs, but we are planning a future patch to export JSON for some of the additional health data defined in [1].[1]
https://github.com/HewlettPackard/hpe-nvm/raw/master/Documentation/NFIT_
DSM_DDR4_NVDIMM- N_v84s.pdfCc Dan Williams <[email protected]>Reviewed-by Jerry Hoemann <[email protected]>Signed-off-by Brian Boylston <[email protected]>--- ndctl/Makefile.am | 1 + ndctl/builtin-list.c | 2 + ndctl/util/json-hpe.c | 283 ++++++++++++++++++++++++++++++++++++++++ ndctl/util/json.h | 6 + ndctl/util/ndctl-hpe1.h | 335 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) create mode 100644 ndctl/util/json-hpe.c create mode 100644 ndctl/util/ndctl-hpe1.hndctl/Makefile.am +0
-0@@ -48,6 +48,7 @@ ndctl_SOURCES = ndctl.c \ if ENABLE_SMART ndctl_SOURCES += util/json-smart.c +ndctl_SOURCES += util/json-hpe.c endif if ENABLE_DESTRUCTIVEndctl/builtin-list.c +0
-0@@ -316,6 +316,8 @@ int cmd_list(int argc, const char **argv)struct json_object *jhealth;
Quoted 6 lines
ndctl/builtin-list.c int cmd_list(int argc, const char **argv) · line 320
Quoted 3 lines
ndctl/builtin-list.c +2
-0jhealth =util_dimm_health_to_json (dimm); +if (!jhealth) + jhealth =util_hpe_dimm_health_to_json (dimm);Try and error probing for the correct vendor? There surely must be a better way to do.
Yes, sorry, I had intended to raise this in the cover, but forgot. util_dimm_health_to_json() results in a check to see if ND_CMD_SMART is supported by the device. It isn't supported by our type N DIMMs, so I don't think ndctl gets as far as actually attempting the ioctl. I didn't see an existing ndctl_dimm_is_cmd_supported() equivalent for the DSM families (NVDIMM_FAMILY_*), so I started with the smallest change to the existing framework.
Any suggestions here?
What about adding an ndctl_dimm_is_family_supported()? Is there a way to determine support other than by probing (e.g. trying function 0 for each family)?
Quoted 3 lines
But anyway nice job Brian (way better than my attempts to "live patch" the ioctls in the kernel)
Thanks. The similarities in the interface make it tempting, but massaging the differences probably becomes awkward.
Brian
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [ndctl PATCH 2/2] ndctl, util: add support for HPE DSM SMART interfaces
In reply to Brian BoylstonQuoted 11 lines · Brian Boylston
This patch introduces
util_hpe_dimm_health_to_json(), which calls the HPE DSM functions defined in [1] and populates a JSON object with health data. This delivers health reporting parity for HPE type N NVDIMMs, but we are planning a future patch to export JSON for some of the additional health data defined in [1].[1] https://github.com/HewlettPackard/hpe-nvm/raw/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v84s.pdf
Cc Dan Williams <[email protected]>Reviewed-by Jerry Hoemann <[email protected]>Signed-off-by Brian Boylston <[email protected]>
Quoted 9 lines
--- ndctl/Makefile.am | 1 + ndctl/builtin-list.c | 2 + ndctl/util/json-hpe.c | 283 ++++++++++++++++++++++++++++++++++++++++ ndctl/util/json.h | 6 + ndctl/util/ndctl-hpe1.h | 335 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) create mode 100644 ndctl/util/json-hpe.c create mode 100644 ndctl/util/ndctl-hpe1.h
Great! Let's get this merged...
Quoted 17 lines
ndctl/Makefile.am +1
-0@@ -48,6 +48,7 @@ ndctl_SOURCES = ndctl.c \ if ENABLE_SMART ndctl_SOURCES += util/json-smart.c +ndctl_SOURCES += util/json-hpe.c endif if ENABLE_DESTRUCTIVEndctl/builtin-list.c +0
-0
ndctl/builtin-list.c int cmd_list(int argc, const char **argv) · line 321
Quoted 6 lines
ndctl/builtin-list.c +2
-0@@ -316,6 +316,8 @@ int cmd_list(int argc, const char **argv)struct json_object *jhealth; jhealth =util_dimm_health_to_json (dimm); +if (!jhealth) + jhealth =util_hpe_dimm_health_to_json (dimm);if (jhealth)
I'd rather see ndctl_dimm_cmd_new_smart() learn how to generate the smart health cmd that is proper for the given family of the dimm, and handle any command format translation internal to the library rather than adding a separate util_dimm_health_to_json().
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
RE: [ndctl PATCH 2/2] ndctl, util: add support for HPE DSM SMART interfaces
Dan Williams wrote on 2016-09-03:
Quoted 43 lines · Brian Boylston
Quoted 13 lines
This patch introduces
util_hpe_dimm_health_to_json(), which calls the HPE DSM functions defined in [1] and populates a JSON object with health data. This delivers health reporting parity for HPE type N NVDIMMs, but we are planning a future patch to export JSON for some of the additional health data defined in [1].[1]
https://github.com/HewlettPackard/hpe-nvm/raw/master/Documentation/NFIT_
DSM_DDR4_NVDIMM- N_v84s.pdfCc Dan Williams <[email protected]>Reviewed-by Jerry Hoemann <[email protected]>Signed-off-by Brian Boylston <[email protected]>Quoted 9 lines
--- ndctl/Makefile.am | 1 + ndctl/builtin-list.c | 2 + ndctl/util/json-hpe.c | 283 ++++++++++++++++++++++++++++++++++++++++ ndctl/util/json.h | 6 + ndctl/util/ndctl-hpe1.h | 335 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) create mode 100644 ndctl/util/json-hpe.c create mode 100644 ndctl/util/ndctl-hpe1.hGreat! Let's get this merged...
Quoted 17 lines
ndctl/Makefile.am +0
-0@@ -48,6 +48,7 @@ ndctl_SOURCES = ndctl.c \ if ENABLE_SMART ndctl_SOURCES += util/json-smart.c +ndctl_SOURCES += util/json-hpe.c endif if ENABLE_DESTRUCTIVEndctl/builtin-list.c +0
-0@@ -316,6 +316,8 @@ int cmd_list(int argc, const char **argv)struct json_object *jhealth;
Quoted 9 lines
ndctl/builtin-list.c int cmd_list(int argc, const char **argv) · line 321
Quoted 4 lines
ndctl/builtin-list.c +2
-0jhealth =util_dimm_health_to_json (dimm); +if (!jhealth) + jhealth =util_hpe_dimm_health_to_json (dimm);if (jhealth)I'd rather see
ndctl_dimm_cmd_new_smart()learn how to generate the smart health cmd that is proper for the given family of the dimm, and handle any command format translation internal to the library rather than adding a separateutil_dimm_health_to_json().
Thanks for the guidance, Dan. I'll work on this and come back.
Brian
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm