public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-29  8:22 [PATCH 0/3] *** nvme: add some commands tracing *** Guixin Liu
@ 2024-01-29  8:22 ` Guixin Liu
  2024-01-29 11:09   ` Chaitanya Kulkarni
  0 siblings, 1 reply; 12+ messages in thread
From: Guixin Liu @ 2024-01-29  8:22 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

Add detailed parse of dsm command to make the trace log more
consistent and human-readable.

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

diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 95572c85b22a..b383d51c1a0c 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -153,10 +153,12 @@ 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 idr = cdw10[4] & 0x1;
+	u8 idw = (cdw10[4] >> 1) & 0x1;
+	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, idr=%u, idw=%u, ad=%u", nr, idr, idw, ad);
 	trace_seq_putc(p, 0);
 
 	return ret;
-- 
2.43.0



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

* Re: [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-29  8:22 ` [PATCH 2/3] nvme: parse dsm command detailly when tracing Guixin Liu
@ 2024-01-29 11:09   ` Chaitanya Kulkarni
  2024-01-30  3:51     ` Guixin Liu
  2024-01-31 17:36     ` Keith Busch
  0 siblings, 2 replies; 12+ messages in thread
From: Chaitanya Kulkarni @ 2024-01-29 11:09 UTC (permalink / raw)
  To: Guixin Liu
  Cc: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	axboe@kernel.dk, kbusch@kernel.org

On 1/29/24 00:22, Guixin Liu wrote:
> Add detailed parse of dsm command to make the trace log more
> consistent and human-readable.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>   drivers/nvme/host/trace.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
> index 95572c85b22a..b383d51c1a0c 100644
> --- a/drivers/nvme/host/trace.c
> +++ b/drivers/nvme/host/trace.c
> @@ -153,10 +153,12 @@ 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 idr = cdw10[4] & 0x1;
> +	u8 idw = (cdw10[4] >> 1) & 0x1;
> +	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, idr=%u, idw=%u, ad=%u", nr, idr, idw, ad);
>   	trace_seq_putc(p, 0);
>   
>   	return ret;

I'm really not sure if we need to decode idw/idr as I've not seen those 
fields so far
used by anybody maybe I'm not aware here, but can you please provide a 
usecase where
you need these fields to be decoded ?

-ck



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

* Re: [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-29 11:09   ` Chaitanya Kulkarni
@ 2024-01-30  3:51     ` Guixin Liu
  2024-01-30  8:05       ` Chaitanya Kulkarni
  2024-01-31 17:36     ` Keith Busch
  1 sibling, 1 reply; 12+ messages in thread
From: Guixin Liu @ 2024-01-30  3:51 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	axboe@kernel.dk, kbusch@kernel.org


在 2024/1/29 19:09, Chaitanya Kulkarni 写道:
> On 1/29/24 00:22, Guixin Liu wrote:
>> Add detailed parse of dsm command to make the trace log more
>> consistent and human-readable.
>>
>> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
>> ---
>>    drivers/nvme/host/trace.c | 8 +++++---
>>    1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
>> index 95572c85b22a..b383d51c1a0c 100644
>> --- a/drivers/nvme/host/trace.c
>> +++ b/drivers/nvme/host/trace.c
>> @@ -153,10 +153,12 @@ 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 idr = cdw10[4] & 0x1;
>> +	u8 idw = (cdw10[4] >> 1) & 0x1;
>> +	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, idr=%u, idw=%u, ad=%u", nr, idr, idw, ad);
>>    	trace_seq_putc(p, 0);
>>    
>>    	return ret;
> I'm really not sure if we need to decode idw/idr as I've not seen those
> fields so far
> used by anybody maybe I'm not aware here, but can you please provide a
> usecase where
> you need these fields to be decoded ?
>
> -ck

Mostly we only use "ad" filed, but sometimes our tester will set idw/idr to

see whether any errors have been reported by our target. Well this is a

low-persuasive usecase, but I still insist it's better to follow the spec.

Best regadrs,

Guixin Liu

>
>


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

* Re: [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-30  3:51     ` Guixin Liu
@ 2024-01-30  8:05       ` Chaitanya Kulkarni
  2024-01-30  8:35         ` Guixin Liu
  0 siblings, 1 reply; 12+ messages in thread
From: Chaitanya Kulkarni @ 2024-01-30  8:05 UTC (permalink / raw)
  To: Guixin Liu
  Cc: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	axboe@kernel.dk, kbusch@kernel.org


>> I'm really not sure if we need to decode idw/idr as I've not seen those
>> fields so far
>> used by anybody maybe I'm not aware here, but can you please provide a
>> usecase where
>> you need these fields to be decoded ?
>>
>> -ck
> 
> Mostly we only use "ad" filed, but sometimes our tester will set idw/idr to
> 
> see whether any errors have been reported by our target. Well this is a
> 
> low-persuasive usecase, but I still insist it's better to follow the spec.
> 
> Best regadrs,
> 
> Guixin Liu
> 
>>

But why ? do you have a valid implementation that shows clear benefits
for idw/idr ? if not I'm not sure why we need to decode these fields,
unless others think it's a good idea let's not do that.

Following spec only makes sense where there is a valid implementation
for the fields we are printing and not sure if it applies to idw/idr ...

I'm fine with AD and NR they are useful ...

-ck



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

* Re: [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-30  8:05       ` Chaitanya Kulkarni
@ 2024-01-30  8:35         ` Guixin Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Guixin Liu @ 2024-01-30  8:35 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	axboe@kernel.dk, kbusch@kernel.org


在 2024/1/30 16:05, Chaitanya Kulkarni 写道:
>>> I'm really not sure if we need to decode idw/idr as I've not seen those
>>> fields so far
>>> used by anybody maybe I'm not aware here, but can you please provide a
>>> usecase where
>>> you need these fields to be decoded ?
>>>
>>> -ck
>> Mostly we only use "ad" filed, but sometimes our tester will set idw/idr to
>>
>> see whether any errors have been reported by our target. Well this is a
>>
>> low-persuasive usecase, but I still insist it's better to follow the spec.
>>
>> Best regadrs,
>>
>> Guixin Liu
>>
> But why ? do you have a valid implementation that shows clear benefits
> for idw/idr ? if not I'm not sure why we need to decode these fields,
> unless others think it's a good idea let's not do that.
>
> Following spec only makes sense where there is a valid implementation
> for the fields we are printing and not sure if it applies to idw/idr ...
>
> I'm fine with AD and NR they are useful ...
>
> -ck
Okay, it will be changed in v2.
>


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

* [PATCH v2 0/3] *** nvme: add some commands tracing ***
@ 2024-01-30 11:34 Guixin Liu
  2024-01-30 11:34 ` [PATCH v2 1/3] nvme: add tracing of reservation commands Guixin Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Guixin Liu @ 2024-01-30 11:34 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

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(-)

-- 
2.43.0



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

* [PATCH v2 1/3] nvme: add tracing of reservation commands
  2024-01-30 11:34 [PATCH v2 0/3] *** nvme: add some commands tracing *** Guixin Liu
@ 2024-01-30 11:34 ` Guixin Liu
  2024-01-30 11:34 ` [PATCH 2/3] nvme: parse dsm command detailly when tracing Guixin Liu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Guixin Liu @ 2024-01-30 11:34 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

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

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

diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 1c36fcedea20..95572c85b22a 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -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);
 	}
-- 
2.43.0



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

* [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-30 11:34 [PATCH v2 0/3] *** nvme: add some commands tracing *** Guixin Liu
  2024-01-30 11:34 ` [PATCH v2 1/3] nvme: add tracing of reservation commands Guixin Liu
@ 2024-01-30 11:34 ` Guixin Liu
  2024-01-30 11:35   ` Guixin Liu
  2024-01-30 11:34 ` [PATCH v2 2/3] nvme: parse dsm command's attr deallocate " Guixin Liu
  2024-01-30 11:34 ` [PATCH v2 3/3] nvme: parse format command's lbafu " Guixin Liu
  3 siblings, 1 reply; 12+ messages in thread
From: Guixin Liu @ 2024-01-30 11:34 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

Add detailed parse of dsm command to make the trace log more
consistent and human-readable.

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

diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 95572c85b22a..b383d51c1a0c 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -153,10 +153,12 @@ 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 idr = cdw10[4] & 0x1;
+	u8 idw = (cdw10[4] >> 1) & 0x1;
+	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, idr=%u, idw=%u, ad=%u", nr, idr, idw, ad);
 	trace_seq_putc(p, 0);
 
 	return ret;
-- 
2.43.0



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

* [PATCH v2 2/3] nvme: parse dsm command's attr deallocate when tracing
  2024-01-30 11:34 [PATCH v2 0/3] *** nvme: add some commands tracing *** Guixin Liu
  2024-01-30 11:34 ` [PATCH v2 1/3] nvme: add tracing of reservation commands Guixin Liu
  2024-01-30 11:34 ` [PATCH 2/3] nvme: parse dsm command detailly when tracing Guixin Liu
@ 2024-01-30 11:34 ` Guixin Liu
  2024-01-30 11:34 ` [PATCH v2 3/3] nvme: parse format command's lbafu " Guixin Liu
  3 siblings, 0 replies; 12+ messages in thread
From: Guixin Liu @ 2024-01-30 11:34 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

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

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

diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 95572c85b22a..4b8924abb4e1 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -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;
-- 
2.43.0



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

* [PATCH v2 3/3] nvme: parse format command's lbafu when tracing
  2024-01-30 11:34 [PATCH v2 0/3] *** nvme: add some commands tracing *** Guixin Liu
                   ` (2 preceding siblings ...)
  2024-01-30 11:34 ` [PATCH v2 2/3] nvme: parse dsm command's attr deallocate " Guixin Liu
@ 2024-01-30 11:34 ` Guixin Liu
  3 siblings, 0 replies; 12+ messages in thread
From: Guixin Liu @ 2024-01-30 11:34 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

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

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

diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 4b8924abb4e1..7b752ee47f36 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -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;
-- 
2.43.0



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

* Re: [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-30 11:34 ` [PATCH 2/3] nvme: parse dsm command detailly when tracing Guixin Liu
@ 2024-01-30 11:35   ` Guixin Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Guixin Liu @ 2024-01-30 11:35 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

Wrong send, please ignore this patch.

在 2024/1/30 19:34, Guixin Liu 写道:
> Add detailed parse of dsm command to make the trace log more
> consistent and human-readable.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>   drivers/nvme/host/trace.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
> index 95572c85b22a..b383d51c1a0c 100644
> --- a/drivers/nvme/host/trace.c
> +++ b/drivers/nvme/host/trace.c
> @@ -153,10 +153,12 @@ 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 idr = cdw10[4] & 0x1;
> +	u8 idw = (cdw10[4] >> 1) & 0x1;
> +	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, idr=%u, idw=%u, ad=%u", nr, idr, idw, ad);
>   	trace_seq_putc(p, 0);
>   
>   	return ret;


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

* Re: [PATCH 2/3] nvme: parse dsm command detailly when tracing
  2024-01-29 11:09   ` Chaitanya Kulkarni
  2024-01-30  3:51     ` Guixin Liu
@ 2024-01-31 17:36     ` Keith Busch
  1 sibling, 0 replies; 12+ messages in thread
From: Keith Busch @ 2024-01-31 17:36 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: Guixin Liu, linux-nvme@lists.infradead.org, hch@lst.de,
	sagi@grimberg.me, axboe@kernel.dk

On Mon, Jan 29, 2024 at 11:09:38AM +0000, Chaitanya Kulkarni wrote:
> On 1/29/24 00:22, Guixin Liu wrote:
> > Add detailed parse of dsm command to make the trace log more
> > consistent and human-readable.
> >
> > Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> > ---
> >   drivers/nvme/host/trace.c | 8 +++++---
> >   1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
> > index 95572c85b22a..b383d51c1a0c 100644
> > --- a/drivers/nvme/host/trace.c
> > +++ b/drivers/nvme/host/trace.c
> > @@ -153,10 +153,12 @@ 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 idr = cdw10[4] & 0x1;
> > +	u8 idw = (cdw10[4] >> 1) & 0x1;
> > +	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, idr=%u, idw=%u, ad=%u", nr, idr, idw, ad);
> >   	trace_seq_putc(p, 0);
> >   
> >   	return ret;
> 
> I'm really not sure if we need to decode idw/idr as I've not seen those 
> fields so far
> used by anybody maybe I'm not aware here, but can you please provide a 
> usecase where
> you need these fields to be decoded ?

It's only reachable through passthrough. I'm not aware of a production
use case, but I know there are test cases that do muck with idr/idw
attributes.

I'm generally not a fan of decoding complex fields because it's not
forward compatible: a newer drive in an older linux can't trace command
bits that are currently reserved.


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

end of thread, other threads:[~2024-01-31 17:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30 11:34 [PATCH v2 0/3] *** nvme: add some commands tracing *** Guixin Liu
2024-01-30 11:34 ` [PATCH v2 1/3] nvme: add tracing of reservation commands Guixin Liu
2024-01-30 11:34 ` [PATCH 2/3] nvme: parse dsm command detailly when tracing Guixin Liu
2024-01-30 11:35   ` Guixin Liu
2024-01-30 11:34 ` [PATCH v2 2/3] nvme: parse dsm command's attr deallocate " Guixin Liu
2024-01-30 11:34 ` [PATCH v2 3/3] nvme: parse format command's lbafu " Guixin Liu
  -- strict thread matches above, loose matches on Subject: below --
2024-01-29  8:22 [PATCH 0/3] *** nvme: add some commands tracing *** Guixin Liu
2024-01-29  8:22 ` [PATCH 2/3] nvme: parse dsm command detailly when tracing Guixin Liu
2024-01-29 11:09   ` Chaitanya Kulkarni
2024-01-30  3:51     ` Guixin Liu
2024-01-30  8:05       ` Chaitanya Kulkarni
2024-01-30  8:35         ` Guixin Liu
2024-01-31 17:36     ` Keith Busch

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