Skip to contentSkip to conversation

nvmet: add some commands tracing

PATCH Superseded Guixin Liu 2 participants 6 messages Feb 27, 2024 – Feb 28, 2024

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

cover nvmet: add some commands tracing

Hi all,
This series of patches adds tracing support for ZNS commands and
authentication commands to the NVMe target module, as well as updates the tracing of DSM commands to be more readable.

Guixin Liu (3):
nvmet: parse dsm command's attr deallocate when tracing
nvmet: add tracing of zns commands
nvmet: add tracing of authentication commands

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

PATCH 1/3 nvmet: parse dsm command's attr deallocate when tracing

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

---
 drivers/nvme/target/trace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/trace.c +3 -3
index 6ee1f3db81d0..657bd31841b2 100644
@@ -83,10 +83,10 @@ static const char *nvmet_trace_read_write(struct trace_seq *p, u8 *cdw10)
 static const char *nvmet_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
#2 lore raw

PATCH 2/3 nvmet: add tracing of zns commands

In reply to Guixin Liu

Add nvme_cmd_zone_append, nvme_cmd_zone_mgmt_send and nvme_cmd_zone_mgmt_recv parse to nvme target tracing.

---
 drivers/nvme/target/trace.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/nvme/target/trace.c +34 -0
index 657bd31841b2..6604e5fe57d8 100644
@@ -119,6 +119,35 @@ const char *nvmet_trace_parse_admin_cmd(struct trace_seq *p,
 	}
 }
 
+static const char *nvmet_trace_zone_mgmt_send(struct trace_seq *p, u8 *cdw10)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u64 slba = get_unaligned_le64(cdw10);
+	u8 zsa = cdw10[12];
+	u8 all = cdw10[13];
+
+	trace_seq_printf(p, "slba=%llu, zsa=%u, all=%u", slba, zsa, all);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
+static const char *nvmet_trace_zone_mgmt_recv(struct trace_seq *p, u8 *cdw10)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u64 slba = get_unaligned_le64(cdw10);
+	u32 numd = get_unaligned_le32(cdw10 + 8);
+	u8 zra = cdw10[12];
+	u8 zrasf = cdw10[13];
+	u8 pr = cdw10[14];
+
+	trace_seq_printf(p, "slba=%llu, numd=%u, zra=%u, zrasf=%u, pr=%u",
+			 slba, numd, zra, zrasf, pr);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
 const char *nvmet_trace_parse_nvm_cmd(struct trace_seq *p,
 		u8 opcode, u8 *cdw10)
 {
@@ -126,9 +155,14 @@ const char *nvmet_trace_parse_nvm_cmd(struct trace_seq *p,
 	case nvme_cmd_read:
 	case nvme_cmd_write:
 	case nvme_cmd_write_zeroes:
+	case nvme_cmd_zone_append:
 		return nvmet_trace_read_write(p, cdw10);
 	case nvme_cmd_dsm:
 		return nvmet_trace_dsm(p, cdw10);
+	case nvme_cmd_zone_mgmt_send:
+		return nvmet_trace_zone_mgmt_send(p, cdw10);
+	case nvme_cmd_zone_mgmt_recv:
+		return nvmet_trace_zone_mgmt_recv(p, cdw10);
 	default:
 		return nvmet_trace_common(p, cdw10);
 	}
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/3 nvmet: add tracing of authentication commands

In reply to Guixin Liu

Add nvme_fabrics_type_auth_send and nvme_fabrics_type_auth_receive to the nvme target's tracing facility.

---
 drivers/nvme/target/trace.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
drivers/nvme/target/trace.c +32 -0
index 6604e5fe57d8..49e5f35b2723 100644
@@ -210,6 +210,34 @@ static const char *nvmet_trace_fabrics_property_get(struct trace_seq *p,
 	return ret;
 }
 
+static const char *nvmet_trace_fabrics_auth_send(struct trace_seq *p, u8 *spc)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u8 spsp0 = spc[1];
+	u8 spsp1 = spc[2];
+	u8 secp = spc[3];
+	u32 tl = get_unaligned_le32(spc + 4);
+
+	trace_seq_printf(p, "spsp0=%02x, spsp1=%02x, secp=%02x, tl=%u",
+			 spsp0, spsp1, secp, tl);
+	trace_seq_putc(p, 0);
+	return ret;
+}
+
+static const char *nvmet_trace_fabrics_auth_receive(struct trace_seq *p, u8 *spc)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+	u8 spsp0 = spc[1];
+	u8 spsp1 = spc[2];
+	u8 secp = spc[3];
+	u32 al = get_unaligned_le32(spc + 4);
+
+	trace_seq_printf(p, "spsp0=%02x, spsp1=%02x, secp=%02x, al=%u",
+			 spsp0, spsp1, secp, al);
+	trace_seq_putc(p, 0);
+	return ret;
+}
+
 static const char *nvmet_trace_fabrics_common(struct trace_seq *p, u8 *spc)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
@@ -229,6 +257,10 @@ const char *nvmet_trace_parse_fabrics_cmd(struct trace_seq *p,
 		return nvmet_trace_fabrics_connect(p, spc);
 	case nvme_fabrics_type_property_get:
 		return nvmet_trace_fabrics_property_get(p, spc);
+	case nvme_fabrics_type_auth_send:
+		return nvmet_trace_fabrics_auth_send(p, spc);
+	case nvme_fabrics_type_auth_receive:
+		return nvmet_trace_fabrics_auth_receive(p, spc);
 	default:
 		return nvmet_trace_fabrics_common(p, spc);
 	}
Signature · 1 line
2.43.0
maintainer
#4 lore raw
In reply to Guixin Liu
Quoted 4 lines · Guixin Liu

Hi all,
This series of patches adds tracing support for ZNS commands and
authentication commands to the NVMe target module, as well as updates the tracing of DSM commands to be more readable.

Patches 2 and 3 seem fine. I don't care for patch 1 since that makes it impossible to see if anyone is sending unusual attributes.

author
#5 lore raw
Quoted 7 lines · Keith Busch
Quoted 4 lines · Guixin Liu

Hi all,
This series of patches adds tracing support for ZNS commands and
authentication commands to the NVMe target module, as well as updates the tracing of DSM commands to be more readable.

Patches 2 and 3 seem fine. I don't care for patch 1 since that makes it impossible to see if anyone is sending unusual attributes.

The patch 1 will be removed in v2.

Best Regards,

Guixin Liu