Skip to contentSkip to conversation

nvme-pci: add NVMe controller statistics

PATCH Superseded Tokunori Ikegami 2 participants 3 messages May 29, 2025 – Jun 3, 2025 NVMe

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme-pci: add NVMe controller statistics

This is to count the controller warning events.

---
Changes since v1:
- Split the sysfs stats attribute to create 4 new files.
- Create stats subdirectory for the attibutes split.
- Change the device attributes to read-write version.

 drivers/nvme/host/nvme.h |   9 +++
 drivers/nvme/host/pci.c  | 127 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+)
drivers/nvme/host/nvme.h +9 -0
index ad0c1f834f09..5a6d0aebc9f8 100644
@@ -277,6 +277,13 @@ enum nvme_ctrl_flags {
 	NVME_CTRL_FROZEN		= 6,
 };
 
+struct nvme_stats {
+	unsigned long timeouts;
+	unsigned long aborts;
+	unsigned long resets;
+	unsigned long disables;
+};
+
 struct nvme_ctrl {
 	bool comp_seen;
 	bool identified;
@@ -411,6 +418,8 @@ struct nvme_ctrl {
 	enum nvme_ctrl_type cntrltype;
 	enum nvme_dctype dctype;
 	u16 awupf; /* 0's based value. */
+
+	struct nvme_stats stats;
 };
 
 static inline enum nvme_ctrl_state nvme_ctrl_state(struct nvme_ctrl *ctrl)
drivers/nvme/host/pci.c +127 -0

172 lines not on this page · raw message

Signature · 1 line
2.48.1
#1 lore raw
Quoted 3 lines · Tokunori Ikegami

This is to count the controller warning events.

can you please update the commit log with why you want to count the events at the first place, what kind problem it is solving and any impact on performance because of it ?

-ck

#2 lore raw
Quoted 3 lines · Chaitanya Kulkarni

can you please update the commit log with why you want to count the events at the first place, what kind problem it is solving and any impact on performance because of it ?

Just done by the version 3 patch. Thank you.