public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] nvmet: add some commands tracing
@ 2024-02-28  2:31 Guixin Liu
  2024-02-28  2:31 ` [PATCH v2 1/2] nvmet: add tracing of zns commands Guixin Liu
  2024-02-28  2:31 ` [PATCH v2 2/2] nvmet: add tracing of authentication commands Guixin Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Guixin Liu @ 2024-02-28  2:31 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 v1 to v2:
- Remove patch 1, "nvmet: parse dsm command's attr deallocate when tracing".

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

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

-- 
2.43.0



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

* [PATCH v2 1/2] nvmet: add tracing of zns commands
  2024-02-28  2:31 [PATCH v2 0/2] nvmet: add some commands tracing Guixin Liu
@ 2024-02-28  2:31 ` Guixin Liu
  2024-02-28  5:25   ` Chaitanya Kulkarni
  2024-02-28  2:31 ` [PATCH v2 2/2] nvmet: add tracing of authentication commands Guixin Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Guixin Liu @ 2024-02-28  2:31 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 | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c
index 657bd31841b2..6604e5fe57d8 100644
--- a/drivers/nvme/target/trace.c
+++ b/drivers/nvme/target/trace.c
@@ -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);
 	}
-- 
2.43.0



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

* [PATCH v2 2/2] nvmet: add tracing of authentication commands
  2024-02-28  2:31 [PATCH v2 0/2] nvmet: add some commands tracing Guixin Liu
  2024-02-28  2:31 ` [PATCH v2 1/2] nvmet: add tracing of zns commands Guixin Liu
@ 2024-02-28  2:31 ` Guixin Liu
  1 sibling, 0 replies; 5+ messages in thread
From: Guixin Liu @ 2024-02-28  2:31 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 6604e5fe57d8..49e5f35b2723 100644
--- a/drivers/nvme/target/trace.c
+++ b/drivers/nvme/target/trace.c
@@ -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);
 	}
-- 
2.43.0



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

* Re: [PATCH v2 1/2] nvmet: add tracing of zns commands
  2024-02-28  2:31 ` [PATCH v2 1/2] nvmet: add tracing of zns commands Guixin Liu
@ 2024-02-28  5:25   ` Chaitanya Kulkarni
  2024-02-28  8:33     ` Guixin Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-28  5:25 UTC (permalink / raw)
  To: Guixin Liu, hch@lst.de, sagi@grimberg.me, Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org

On 2/27/24 18:31, 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>
> ---
>   drivers/nvme/target/trace.c | 34 ++++++++++++++++++++++++++++++++++
>   1 file changed, 34 insertions(+)
>
> diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c
> index 657bd31841b2..6604e5fe57d8 100644
> --- a/drivers/nvme/target/trace.c
> +++ b/drivers/nvme/target/trace.c
> @@ -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);

please use consistent notation :- &cdw10[8]

> +	u8 zra = cdw10[12];
> +	u8 zrasf = cdw10[13];

why not decode zrasf values 0h-9h to make it more readable ?
printing number only will make a trip to the spec since I don't think
everyone will remember those values all the time , more importantly
this will also help in testing to grep for right string when using zrasf.

same goes for zsa I guess above ...
> +	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);
>   	}

-ck



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

* Re: [PATCH v2 1/2] nvmet: add tracing of zns commands
  2024-02-28  5:25   ` Chaitanya Kulkarni
@ 2024-02-28  8:33     ` Guixin Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Guixin Liu @ 2024-02-28  8:33 UTC (permalink / raw)
  To: Chaitanya Kulkarni, hch@lst.de, sagi@grimberg.me
  Cc: linux-nvme@lists.infradead.org


在 2024/2/28 13:25, Chaitanya Kulkarni 写道:
> On 2/27/24 18:31, 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>
>> ---
>>    drivers/nvme/target/trace.c | 34 ++++++++++++++++++++++++++++++++++
>>    1 file changed, 34 insertions(+)
>>
>> diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c
>> index 657bd31841b2..6604e5fe57d8 100644
>> --- a/drivers/nvme/target/trace.c
>> +++ b/drivers/nvme/target/trace.c
>> @@ -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);
> please use consistent notation :- &cdw10[8]
It will be changed in v3.
>> +	u8 zra = cdw10[12];
>> +	u8 zrasf = cdw10[13];
> why not decode zrasf values 0h-9h to make it more readable ?
> printing number only will make a trip to the spec since I don't think
> everyone will remember those values all the time , more importantly
> this will also help in testing to grep for right string when using zrasf.
>
> same goes for zsa I guess above ...

Agree, I will translate zrasf and zsa to a readble string, and print them.

Best Regards,

Guixin Liu

>


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

end of thread, other threads:[~2024-02-28  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28  2:31 [PATCH v2 0/2] nvmet: add some commands tracing Guixin Liu
2024-02-28  2:31 ` [PATCH v2 1/2] nvmet: add tracing of zns commands Guixin Liu
2024-02-28  5:25   ` Chaitanya Kulkarni
2024-02-28  8:33     ` Guixin Liu
2024-02-28  2:31 ` [PATCH v2 2/2] nvmet: add tracing of authentication commands Guixin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox