Skip to content

libnvme: add support for retrieving additional NVMe stat

Nilay Shroff linux-nvme 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 2 repliesIn review
  2. v29 patches 2 repliesSuperseded
  3. v19 patches 12 repliesSuperseded

Changes in v3 from the cover letter

- Rebase the code against the latest nvme-cli (Daniel Wagner)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9libnvme: annotate libnvme_path::ana_state with !accessors:nonelibnvme/src/accessors.ld libnvme/src/libnvme.ld libnvme/src/nvme/accessors.c +4 more+25 -310 replies
2/9libnvme: annotate libnvme_path::numa_nodes with !accessors:nonelibnvme/src/accessors.ld libnvme/src/libnvme.ld libnvme/src/nvme/accessors.c +4 more+25 -330 replies
3/9libnvme: annotate libnvme_subsystem::iopolicy with !accessors:nonelibnvme/src/accessors.ld libnvme/src/libnvme.ld libnvme/src/nvme/accessors.c +4 more+25 -340 replies
4/9libnvme: add support for retrieving per-path gendisk I/O statisticslibnvme/src/libnvme.ld libnvme/src/nvme/private.h libnvme/src/nvme/tree.c +1 more+405 -00 replies
5/9libnvme: add support for retrieving namespace gendisk I/O statisticslibnvme/src/libnvme.ld libnvme/src/nvme/private.h libnvme/src/nvme/tree.c +1 more+251 -00 replies
6/9libnvme: add support for per-path diagnostic counterslibnvme/src/libnvme.ld libnvme/src/nvme/private.h libnvme/src/nvme/tree.c +1 more+67 -10 replies
7/9libnvme: add support for namespace diagnostic counterslibnvme/src/libnvme.ld libnvme/src/nvme/private.h libnvme/src/nvme/tree.c +1 more+44 -00 replies
8/9libnvme: add support for nshead diagnostic counterslibnvme/src/libnvme.ld libnvme/src/nvme/private.h libnvme/src/nvme/tree.c +1 more+43 -00 replies
9/9libnvme: add support for ctrl diagnostic counterslibnvme/src/libnvme.ld libnvme/src/nvme/private.h libnvme/src/nvme/tree.c +1 more+64 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCHv3 0/9] libnvme: add support for retrieving additional NVMe stat

Hi,

Certain NVMe attributes and statistics can change dynamically at runtime. However, the current libnvme implementation caches attribute values while scanning and building the topology. Subsequent libnvme API calls return these cached values.

While this approach works well for one-shot nvme-cli commands, it is not suitable for use cases that require upto date information. In particular, real-time monitoring tools such as nvme-top require access to the latest (non-cached) values of such attributes.

To address this, this patchset introduces support for retrieving non-cached values for selected attributes whose values may change dynamically. The first three patches disable auto-generated accessors for ana_state, numa_nodes, and iopolicy using "!accessors:none", and provide custom implementations that always return the latest values.

In addition, libnvme lacks support for retrieving gendisk statistics, which provide useful insight into disk activity (e.g., number of I/Os processed, time spent servicing I/O, and in-flight I/O counts). This patchset adds support for retrieving gendisk I/O statistics for both per-path and namespace gendisks.

Finally, this series adds support for retrieving diagnostic counters at different levels, including per-path, namespace, nshead, and controller. These counters should improve visibility into NVMe native multipath behavior.

All of the above statistics and counters can be leveraged by tools such as nvme-top to provide real-time monitoring and analysis.

As usual, feedback and suggestions are welcome!

Changes from v2:
- Rebase the code against the latest nvme-cli (Daniel Wagner)

    (base-commit: 6f3cfb15a515ddc62aef94c1d8b4f3be5ad33ad0)

Link to v2: https://lore.kernel.org/all/[email protected]/

Changes from v1:
- Avoid exposing internal state of libnvme to its users
while exporting the nvme stat; add a switch while updating
nvme stat which determines whether getters shall return the
nvme diffstat or absolute stat (Daniel Wagner)
- If libnvme API fails then return appropriate error code
instead of -1 (Daniel Wagner)
Link to v1: https://lore.kernel.org/all/[email protected]/

Nilay Shroff (9):
libnvme: annotate libnvme_path::ana_state with !accessors:none
libnvme: annotate libnvme_path::numa_nodes with !accessors:none
libnvme: annotate libnvme_subsystem::iopolicy with !accessors:none
libnvme: add support for retrieving per-path gendisk I/O statistics
libnvme: add support for retrieving namespace gendisk I/O statistics
libnvme: add support for per-path diagnostic counters
libnvme: add support for namespace diagnostic counters
libnvme: add support for nshead diagnostic counters
libnvme: add support for ctrl diagnostic counters

 libnvme/src/accessors.ld     |   6 -
 libnvme/src/libnvme.ld       |  35 +++
 libnvme/src/nvme/accessors.c |  40 ---
 libnvme/src/nvme/accessors.h |  49 ---
 libnvme/src/nvme/private.h   |  54 +++-
 libnvme/src/nvme/tree.c      | 568 +++++++++++++++++++++++++++++++++++
 libnvme/src/nvme/tree.h      | 296 ++++++++++++++++++
 7 files changed, 949 insertions(+), 99 deletions(-)
Signature · 1 line
2.53.0