Skip to contentSkip to conversation

*** nvme: add some commands tracing ***

PATCH In review Guixin Liu 5 participants 13 messages Jan 31, 2024 – Mar 14, 2024 NVMe

lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

v2 cover *** nvme: add some commands tracing ***

Hi guys:
I found that there are no reservation commands tracing and some
commands's parsing aren't fit the newest NVMe spec, and aren't readble.

Changes from v1 to v2:
- Remove idr and idw parsing of dsm command.

- Remove lbafl and lbafu variables and add a comment for the lbaf calculation in nvme_trace_admin_format_nvm().

Guixin Liu (3):
nvme: add tracing of reservation commands
nvme: parse dsm command's attr deallocate when tracing
nvme: parse format command's lbafu when tracing

 drivers/nvme/host/trace.c | 73 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 69 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/3 nvme: add tracing of reservation commands

Add detailed parsing of reservation commands to make the trace log more consistent and human-readable.

---
 drivers/nvme/host/trace.c | 62 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
drivers/nvme/host/trace.c +62 -0
index 1c36fcedea20..95572c85b22a 100644
@@ -191,6 +191,60 @@ static const char *nvme_trace_zone_mgmt_recv(struct trace_seq *p, u8 *cdw10)
 	return ret;
 }
 
+static const char *nvme_trace_resv_reg(struct trace_seq *p, u8 *cdw10)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u8 rrega = cdw10[0] & 0x7;
+	u8 iekey = (cdw10[0] >> 3) & 0x1;
+	u8 ptpl = (cdw10[3] >> 6) & 0x3;
+
+	trace_seq_printf(p, "rrega=%u, iekey=%u, ptpl=%u",
+			 rrega, iekey, ptpl);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
+static const char *nvme_trace_resv_acq(struct trace_seq *p, u8 *cdw10)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u8 racqa = cdw10[0] & 0x7;
+	u8 iekey = (cdw10[0] >> 3) & 0x1;
+	u8 rtype = cdw10[1];
+
+	trace_seq_printf(p, "racqa=%u, iekey=%u, rtype=%u",
+			 racqa, iekey, rtype);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
+static const char *nvme_trace_resv_rel(struct trace_seq *p, u8 *cdw10)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u8 rrela = cdw10[0] & 0x7;
+	u8 iekey = (cdw10[0] >> 3) & 0x1;
+	u8 rtype = cdw10[1];
+
+	trace_seq_printf(p, "rrela=%u, iekey=%u, rtype=%u",
+			 rrela, iekey, rtype);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
+static const char *nvme_trace_resv_report(struct trace_seq *p, u8 *cdw10)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u32 numd = get_unaligned_le32(cdw10);
+	u8 eds = cdw10[4] & 0x1;
+
+	trace_seq_printf(p, "numd=%u, eds=%u", numd, eds);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
 static const char *nvme_trace_common(struct trace_seq *p, u8 *cdw10)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
@@ -243,6 +297,14 @@ const char *nvme_trace_parse_nvm_cmd(struct trace_seq *p,
 		return nvme_trace_zone_mgmt_send(p, cdw10);
 	case nvme_cmd_zone_mgmt_recv:
 		return nvme_trace_zone_mgmt_recv(p, cdw10);
+	case nvme_cmd_resv_register:
+		return nvme_trace_resv_reg(p, cdw10);
+	case nvme_cmd_resv_acquire:
+		return nvme_trace_resv_acq(p, cdw10);
+	case nvme_cmd_resv_release:
+		return nvme_trace_resv_rel(p, cdw10);
+	case nvme_cmd_resv_report:
+		return nvme_trace_resv_report(p, cdw10);
 	default:
 		return nvme_trace_common(p, cdw10);
 	}
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH v2 2/3 nvme: parse dsm command's attr deallocate when tracing

In reply to Guixin Liu

Add parse of dsm command's attr deallocate to make the trace log more consistent and human-readable.

---
 drivers/nvme/host/trace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/trace.c +3 -3
index 95572c85b22a..4b8924abb4e1 100644
@@ -153,10 +153,10 @@ static const char *nvme_trace_read_write(struct trace_seq *p, u8 *cdw10)
 static const char *nvme_trace_dsm(struct trace_seq *p, u8 *cdw10)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
+	u8 nr = cdw10[0];
+	u8 ad = (cdw10[4] >> 2) & 0x1;
 
-	trace_seq_printf(p, "nr=%u, attributes=%u",
-			 get_unaligned_le32(cdw10),
-			 get_unaligned_le32(cdw10 + 4));
+	trace_seq_printf(p, "nr=%u, ad=%u", nr, ad);
 	trace_seq_putc(p, 0);
 
 	return ret;
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH v2 3/3 nvme: parse format command's lbafu when tracing

In reply to Guixin Liu

Add the parse of format command's lbafu to calculate lbaf.

---
 drivers/nvme/host/trace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/trace.c +4 -1
index 4b8924abb4e1..7b752ee47f36 100644
@@ -119,7 +119,10 @@ static const char *nvme_trace_get_lba_status(struct trace_seq *p,
 static const char *nvme_trace_admin_format_nvm(struct trace_seq *p, u8 *cdw10)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
-	u8 lbaf = cdw10[0] & 0xF;
+	/*
+	 * lbafu(bit 13:12) is already in the upper 4 bits, lbafl: bit 03:00.
+	 */
+	u8 lbaf = (cdw10[1] & 0x30) | (cdw10[0] & 0xF);
 	u8 mset = (cdw10[0] >> 4) & 0x1;
 	u8 pi = (cdw10[0] >> 5) & 0x7;
 	u8 pil = cdw10[1] & 0x1;
Signature · 1 line
2.43.0
Reviewed-by on the v2 series
#9 lore raw
In reply to Guixin Liu

Guixin,

Quoted 10 lines · Guixin Liu

Hi guys:
I found that there are no reservation commands tracing and some
commands's parsing aren't fit the newest NVMe spec, and aren't readble.

Changes from v1 to v2:
- Remove idr and idw parsing of dsm command.

- Remove lbafl and lbafu variables and add a comment for the lbaf calculation in nvme_trace_admin_format_nvm().

Quoted 8 lines

Guixin Liu (3):
nvme: add tracing of reservation commands
nvme: parse dsm command's attr deallocate when tracing
nvme: parse format command's lbafu when tracing

  drivers/nvme/host/trace.c | 73 ++++++++++++++++++++++++++++++++++++---
  1 file changed, 69 insertions(+), 4 deletions(-)

One suggestion can you please not add *** in the subject line ? that is not a common practice on the mailing list.

This series addresses the comments posted in the last version. Looks good, for the entire series :-

-ck

author
#10 lore raw
Quoted 24 lines · Chaitanya Kulkarni

Guixin,

Quoted 10 lines · Guixin Liu

Hi guys:
I found that there are no reservation commands tracing and some
commands's parsing aren't fit the newest NVMe spec, and aren't readble.

Changes from v1 to v2:
- Remove idr and idw parsing of dsm command.

- Remove lbafl and lbafu variables and add a comment for the lbaf calculation in nvme_trace_admin_format_nvm().

Quoted 8 lines

Guixin Liu (3):
nvme: add tracing of reservation commands
nvme: parse dsm command's attr deallocate when tracing
nvme: parse format command's lbafu when tracing

   drivers/nvme/host/trace.c | 73 ++++++++++++++++++++++++++++++++++++---
   1 file changed, 69 insertions(+), 4 deletions(-)

One suggestion can you please not add *** in the subject line ? that is not a common practice on the mailing list.

Quoted 6 lines

This series addresses the comments posted in the last version. Looks good, for the entire series :-

-ck

Oh, Sorry, I dont notice that, just change the "SUBJECT HERE" of

cover-letter, I will pay attention of that.

Best regards,

Guixin Liu

Quoted 1 line
author
#11 lore raw
In reply to Guixin Liu

Hi Keith,

This series of patches has not been combined yet, could you please

take a look?

Best regards,

Guixin Liu

Quoted 18 lines · Guixin Liu

Hi guys:
I found that there are no reservation commands tracing and some
commands's parsing aren't fit the newest NVMe spec, and aren't readble.

Changes from v1 to v2:
- Remove idr and idw parsing of dsm command.

- Remove lbafl and lbafu variables and add a comment for the lbaf calculation in nvme_trace_admin_format_nvm().

Guixin Liu (3):
nvme: add tracing of reservation commands
nvme: parse dsm command's attr deallocate when tracing
nvme: parse format command's lbafu when tracing

  drivers/nvme/host/trace.c | 73 ++++++++++++++++++++++++++++++++++++---
  1 file changed, 69 insertions(+), 4 deletions(-)
maintainer
#12 lore raw
Quoted 5 lines · Guixin Liu

Hi Keith,

This series of patches has not been combined yet, could you please

take a look?

Added to nvme-6.9, thanks.