mbox series

[ndctl,RFC-PATCH,0/4] Add support for reporting PAPR NVDIMM Statistics

Message ID 20200518112023.147139-1-vaibhav@linux.ibm.com
Headers show
Series Add support for reporting PAPR NVDIMM Statistics | expand

Message

Vaibhav Jain May 18, 2020, 11:20 a.m. UTC
This patch-set proposes addition of new functionality to ndctl and
libndctl enabling them to report vendor specific NVDIMM Statistics
(dimm-stats) like "Cache Read/Write Hit Count" which arent S.M.A.R.T
attributes but still indicate important NVDIMM performance metrics.

Until now these statistics were exposed via vendor specific tools
like ipmictl[1] in case of Intel Optane-DC memory. These patch-set
however tries to implement a generic abstraction within libndctl to
report such statistics from the ndctl tool.

The patch-set proposes to add a new command line arg '--stats' / '-S'
that reports vendor specific dimm-stats for a NVDIMM. Below is an
example invocation and output of the proposed changes:

 # ndctl list -D --stats
[
  {
    "dev":"nmem0",
    "stats":{
      "Controller Reset Count":2,
      "Controller Reset Elapsed Time":603331,
      "Power-on Seconds":603931,
      "Life Remaining":"100%",
      "Critical Resource Utilization":"0%",
      "Host Load Count":5781028,
      "Host Store Count":8966800,
      "Host Load Duration":975895365,
      "Host Store Duration":716230690,
      "Media Read Count":0,
      "Media Write Count":6313,
      "Media Read Duration":0,
      "Media Write Duration":9679615,
      "Cache Read Hit Count":5781028,
      "Cache Write Hit Count":8442479,
      "Fast Write Count":8969912
    }
  }
]

As a proof of concept the patch-set implements reporting dimm-stats for
PAPR compatible NVDIMMs. The output above is from a PPC64 PSeries
Guest LPAR with an NVDIMM, running on a PowerVM Hyper-visor.

The patch-set is dependent on existing patch-set "[ndctl PATCH v3 0/6]
Add support for reporting papr-scm nvdimm health" available at
Ref[2] and [3]. That patch-set implemented the base infrastructure
needed to support PAPR complaint NVDIMMs in ndctl and libndctl.

For PAPR compliant NVDIMMs we also depend on kernel side changes
published at [4] that add support for necessary pdsms to expose
dimm-stats to libndctl via CMD_CALL ioctl interface.

Structure of the patch-set
==========================

First patch in the series starts with implementing necessary
infrastructure in libndctl to introduce two new dimm_ops namely
'new_stats' and 'get_stat' that can be implemented by dimm-providers
to provide libndctl access to vendor specific dimm-stats. The patch
also implements necessary changes in ndctl ndctl/util/json-smart.c to
call these new dimm-ops and generate json-c objects to generate an
output as mentioned above.

Next three patches deal with implementing support for these new
dimm-ops for papr_scm in libndctl. Patch-2 implements dimm-op
'new_stats' that returns a 'struct ndctl_cmd' that can be submitted to
libnvdimm for fetching dimm-stats and copy them to papr_scm managed
buffer.

Patch-2 implements parsing and clean-up of the fetched dimm-stats from
kernel.

Finally Patch-3 implements dimm_ops 'get_stat' that provides ndctl
access to dimm-stat which then constructs a json object aggregating
them and then generating a text output from it.


References
==========
[1] https://docs.pmem.io/ipmctl-user-guide/instrumentation/show-device-performance

[2] https://github.com/vaibhav92/ndctl/tree/papr_scm_health_v7

[3] https://lore.kernel.org/linux-nvdimm/20200420075556.272174-1-vaibhav@linux.ibm.com/

[4] https://lore.kernel.org/linux-nvdimm/20200518110814.145644-1-vaibhav@linux.ibm.com

Vaibhav Jain (4):
  ndctl,libndctl: Implement new dimm-ops 'new_stats' and 'get_stat'
  papr_scm: Add support for fetching dimm-stats
  papr_scm: Implement parsing and clean-up for fetched dimm stats
  papr_scm: Implement dimm op 'get_stat'

 Documentation/ndctl/ndctl-list.txt |  24 +++
 ndctl/lib/libndctl.sym             |   5 +
 ndctl/lib/papr_scm.c               | 300 ++++++++++++++++++++++++++++-
 ndctl/lib/papr_scm_pdsm.h          |  48 +++++
 ndctl/lib/private.h                |   6 +
 ndctl/lib/smart.c                  |  26 +++
 ndctl/libndctl.h                   |  23 +++
 ndctl/list.c                       |   9 +
 ndctl/util/json-smart.c            |  73 +++++++
 util/json.h                        |   1 +
 10 files changed, 514 insertions(+), 1 deletion(-)