Linux-NVME Archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] nvmet: add some commands tracing
@ 2024-02-28  8:37 Guixin Liu
  2024-02-28  8:37 ` [PATCH v3 1/2] nvmet: add tracing of authentication commands Guixin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Guixin Liu @ 2024-02-28  8:37 UTC (permalink / raw
  To: hch, sagi, kch; +Cc: linux-nvme

Hi all,
	This series of patches adds tracing support for ZNS commands and
authentication commands to the NVMe target module.

Changes from v2 to v3:
- Translate zns's zsa and zrasf to readble string.

Changes from v1 to v2:
- Remove patch 1, "nvmet: parse dsm command's attr deallocate when tracing".

Guixin Liu (2):
  nvmet: add tracing of authentication commands
  nvmet: add tracing of zns commands

 drivers/nvme/target/trace.c | 98 +++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/2] nvmet: add tracing of authentication commands
  2024-02-28  8:37 [PATCH v3 0/2] nvmet: add some commands tracing Guixin Liu
@ 2024-02-28  8:37 ` Guixin Liu
  2024-03-07  9:36   ` Sagi Grimberg
  2024-03-08  5:44   ` Chaitanya Kulkarni
  2024-02-28  8:37 ` [PATCH v3 2/2] nvmet: add tracing of zns commands Guixin Liu
  2024-03-08 16:21 ` [PATCH v3 0/2] nvmet: add some commands tracing Keith Busch
  2 siblings, 2 replies; 8+ messages in thread
From: Guixin Liu @ 2024-02-28  8:37 UTC (permalink / raw
  To: hch, sagi, kch; +Cc: linux-nvme

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

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/nvme/target/trace.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c
index 6ee1f3db81d0..ca537fae3730 100644
--- a/drivers/nvme/target/trace.c
+++ b/drivers/nvme/target/trace.c
@@ -176,6 +176,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);
@@ -195,6 +223,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);
 	}
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/2] nvmet: add tracing of zns commands
  2024-02-28  8:37 [PATCH v3 0/2] nvmet: add some commands tracing Guixin Liu
  2024-02-28  8:37 ` [PATCH v3 1/2] nvmet: add tracing of authentication commands Guixin Liu
@ 2024-02-28  8:37 ` Guixin Liu
  2024-02-28  9:03   ` Chaitanya Kulkarni
  2024-03-07  9:36   ` Sagi Grimberg
  2024-03-08 16:21 ` [PATCH v3 0/2] nvmet: add some commands tracing Keith Busch
  2 siblings, 2 replies; 8+ messages in thread
From: Guixin Liu @ 2024-02-28  8:37 UTC (permalink / raw
  To: hch, sagi, kch; +Cc: linux-nvme

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

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/nvme/target/trace.c | 66 +++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c
index ca537fae3730..8d1806a82887 100644
--- a/drivers/nvme/target/trace.c
+++ b/drivers/nvme/target/trace.c
@@ -119,6 +119,67 @@ 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)
+{
+	static const char * const zsa_strs[] = {
+		[0x01] = "close zone",
+		[0x02] = "finish zone",
+		[0x03] = "open zone",
+		[0x04] = "reset zone",
+		[0x05] = "offline zone",
+		[0x10] = "set zone descriptor extension"
+	};
+	const char *ret = trace_seq_buffer_ptr(p);
+	u64 slba = get_unaligned_le64(cdw10);
+	const char *zsa_str;
+	u8 zsa = cdw10[12];
+	u8 all = cdw10[13];
+
+	if (zsa < ARRAY_SIZE(zsa_strs) && zsa_strs[zsa])
+		zsa_str = zsa_strs[zsa];
+	else
+		zsa_str = "reserved";
+
+	trace_seq_printf(p, "slba=%llu, zsa=%u:%s, all=%u",
+		slba, zsa, zsa_str, all);
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
+static const char *nvmet_trace_zone_mgmt_recv(struct trace_seq *p, u8 *cdw10)
+{
+	static const char * const zrasf_strs[] = {
+		[0x00] = "list all zones",
+		[0x01] = "list the zones in the ZSE: Empty state",
+		[0x02] = "list the zones in the ZSIO: Implicitly Opened state",
+		[0x03] = "list the zones in the ZSEO: Explicitly Opened state",
+		[0x04] = "list the zones in the ZSC: Closed state",
+		[0x05] = "list the zones in the ZSF: Full state",
+		[0x06] = "list the zones in the ZSRO: Read Only state",
+		[0x07] = "list the zones in the ZSO: Offline state",
+		[0x09] = "list the zones that have the zone attribute"
+	};
+	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];
+	const char *zrasf_str;
+	u8 pr = cdw10[14];
+
+	if (zrasf < ARRAY_SIZE(zrasf_strs) && zrasf_strs[zrasf])
+		zrasf_str = zrasf_strs[zrasf];
+	else
+		zrasf_str = "reserved";
+
+	trace_seq_printf(p, "slba=%llu, numd=%u, zra=%u, zrasf=%u:%s, pr=%u",
+		slba, numd, zra, zrasf, zrasf_str, 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 +187,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);
 	}
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 2/2] nvmet: add tracing of zns commands
  2024-02-28  8:37 ` [PATCH v3 2/2] nvmet: add tracing of zns commands Guixin Liu
@ 2024-02-28  9:03   ` Chaitanya Kulkarni
  2024-03-07  9:36   ` Sagi Grimberg
  1 sibling, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-28  9:03 UTC (permalink / raw
  To: Guixin Liu, hch@lst.de, sagi@grimberg.me, Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org

On 2/28/24 00:37, Guixin Liu wrote:
> Add nvme_cmd_zone_append, nvme_cmd_zone_mgmt_send and
> nvme_cmd_zone_mgmt_recv parse to nvme target tracing.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/2] nvmet: add tracing of authentication commands
  2024-02-28  8:37 ` [PATCH v3 1/2] nvmet: add tracing of authentication commands Guixin Liu
@ 2024-03-07  9:36   ` Sagi Grimberg
  2024-03-08  5:44   ` Chaitanya Kulkarni
  1 sibling, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2024-03-07  9:36 UTC (permalink / raw
  To: Guixin Liu, hch, kch; +Cc: linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 2/2] nvmet: add tracing of zns commands
  2024-02-28  8:37 ` [PATCH v3 2/2] nvmet: add tracing of zns commands Guixin Liu
  2024-02-28  9:03   ` Chaitanya Kulkarni
@ 2024-03-07  9:36   ` Sagi Grimberg
  1 sibling, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2024-03-07  9:36 UTC (permalink / raw
  To: Guixin Liu, hch, kch; +Cc: linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/2] nvmet: add tracing of authentication commands
  2024-02-28  8:37 ` [PATCH v3 1/2] nvmet: add tracing of authentication commands Guixin Liu
  2024-03-07  9:36   ` Sagi Grimberg
@ 2024-03-08  5:44   ` Chaitanya Kulkarni
  1 sibling, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2024-03-08  5:44 UTC (permalink / raw
  To: Guixin Liu, hch@lst.de, sagi@grimberg.me, Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org

On 2/28/2024 12:37 AM, Guixin Liu wrote:
> Add nvme_fabrics_type_auth_send and nvme_fabrics_type_auth_receive
> to the nvme target's tracing facility.
> 
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---

some of my emails are not delivering to the list, hopefully this will
go through ...

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/2] nvmet: add some commands tracing
  2024-02-28  8:37 [PATCH v3 0/2] nvmet: add some commands tracing Guixin Liu
  2024-02-28  8:37 ` [PATCH v3 1/2] nvmet: add tracing of authentication commands Guixin Liu
  2024-02-28  8:37 ` [PATCH v3 2/2] nvmet: add tracing of zns commands Guixin Liu
@ 2024-03-08 16:21 ` Keith Busch
  2 siblings, 0 replies; 8+ messages in thread
From: Keith Busch @ 2024-03-08 16:21 UTC (permalink / raw
  To: Guixin Liu; +Cc: hch, sagi, kch, linux-nvme

Thanks, applied to nvme-6.9.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-03-08 16:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28  8:37 [PATCH v3 0/2] nvmet: add some commands tracing Guixin Liu
2024-02-28  8:37 ` [PATCH v3 1/2] nvmet: add tracing of authentication commands Guixin Liu
2024-03-07  9:36   ` Sagi Grimberg
2024-03-08  5:44   ` Chaitanya Kulkarni
2024-02-28  8:37 ` [PATCH v3 2/2] nvmet: add tracing of zns commands Guixin Liu
2024-02-28  9:03   ` Chaitanya Kulkarni
2024-03-07  9:36   ` Sagi Grimberg
2024-03-08 16:21 ` [PATCH v3 0/2] nvmet: add some commands tracing Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).