* [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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ messages in thread