* [PATCH 1/2] nvme: parse reservation commands's action and rtype to string
2024-10-14 10:14 [PATCH 0/2] Add the tracing of reservation commands Guixin Liu
@ 2024-10-14 10:14 ` Guixin Liu
2024-10-14 18:26 ` Chaitanya Kulkarni
` (2 more replies)
2024-10-14 10:14 ` [PATCH 2/2] nvmet: add tracing of reservation commands Guixin Liu
` (2 subsequent siblings)
3 siblings, 3 replies; 11+ messages in thread
From: Guixin Liu @ 2024-10-14 10:14 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi, kch; +Cc: linux-nvme
Parse reservation commands's action(including rrega, racqa and rrela)
and rtype to string to make the trace log more human-readable.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
drivers/nvme/host/trace.c | 58 +++++++++++++++++++++++++++++++++++----
1 file changed, 52 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 87c437fc070d..ad25ad1e4041 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -228,27 +228,61 @@ static const char *nvme_trace_zone_mgmt_recv(struct trace_seq *p, u8 *cdw10)
static const char *nvme_trace_resv_reg(struct trace_seq *p, u8 *cdw10)
{
+ static const char * const rrega_strs[] = {
+ [0x00] = "register",
+ [0x01] = "unregister",
+ [0x02] = "replace",
+ };
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;
+ const char *rrega_str;
+
+ if (rrega < ARRAY_SIZE(rrega_strs) && rrega_strs[rrega])
+ rrega_str = rrega_strs[rrega];
+ else
+ rrega_str = "reserved";
- trace_seq_printf(p, "rrega=%u, iekey=%u, ptpl=%u",
- rrega, iekey, ptpl);
+ trace_seq_printf(p, "rrega=%u:%s, iekey=%u, ptpl=%u",
+ rrega, rrega_str, iekey, ptpl);
trace_seq_putc(p, 0);
return ret;
}
+static const char * const rtype_strs[] = {
+ [0x00] = "reserved",
+ [0x01] = "write exclusive",
+ [0x02] = "exclusive access",
+ [0x03] = "write exclusive registrants only",
+ [0x04] = "exclusive access registrants only",
+ [0x05] = "write exclusive all registrants",
+ [0x06] = "exclusive access all registrants",
+};
+
static const char *nvme_trace_resv_acq(struct trace_seq *p, u8 *cdw10)
{
+ static const char * const racqa_strs[] = {
+ [0x00] = "acquire",
+ [0x01] = "preempt",
+ [0x02] = "preempt and abort",
+ };
const char *ret = trace_seq_buffer_ptr(p);
u8 racqa = cdw10[0] & 0x7;
u8 iekey = (cdw10[0] >> 3) & 0x1;
u8 rtype = cdw10[1];
+ const char *racqa_str = "reserved";
+ const char *rtype_str = "reserved";
- trace_seq_printf(p, "racqa=%u, iekey=%u, rtype=%u",
- racqa, iekey, rtype);
+ if (racqa < ARRAY_SIZE(racqa_strs) && racqa_strs[racqa])
+ racqa_str = racqa_strs[racqa];
+
+ if (rtype < ARRAY_SIZE(rtype_strs) && rtype_strs[rtype])
+ rtype_str = rtype_strs[rtype];
+
+ trace_seq_printf(p, "racqa=%u:%s, iekey=%u, rtype=%u:%s",
+ racqa, racqa_str, iekey, rtype, rtype_str);
trace_seq_putc(p, 0);
return ret;
@@ -256,13 +290,25 @@ static const char *nvme_trace_resv_acq(struct trace_seq *p, u8 *cdw10)
static const char *nvme_trace_resv_rel(struct trace_seq *p, u8 *cdw10)
{
+ static const char * const rrela_strs[] = {
+ [0x00] = "release",
+ [0x01] = "clear",
+ };
const char *ret = trace_seq_buffer_ptr(p);
u8 rrela = cdw10[0] & 0x7;
u8 iekey = (cdw10[0] >> 3) & 0x1;
u8 rtype = cdw10[1];
+ const char *rrela_str = "reserved";
+ const char *rtype_str = "reserved";
+
+ if (rrela < ARRAY_SIZE(rrela_strs) && rrela_strs[rrela])
+ rrela_str = rrela_strs[rrela];
+
+ if (rtype < ARRAY_SIZE(rtype_strs) && rtype_strs[rtype])
+ rtype_str = rtype_strs[rtype];
- trace_seq_printf(p, "rrela=%u, iekey=%u, rtype=%u",
- rrela, iekey, rtype);
+ trace_seq_printf(p, "rrela=%u:%s, iekey=%u, rtype=%u:%s",
+ rrela, rrela_str, iekey, rtype, rtype_str);
trace_seq_putc(p, 0);
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 1/2] nvme: parse reservation commands's action and rtype to string
2024-10-14 10:14 ` [PATCH 1/2] nvme: parse reservation commands's action and rtype to string Guixin Liu
@ 2024-10-14 18:26 ` Chaitanya Kulkarni
2024-10-15 4:54 ` Christoph Hellwig
2024-10-20 23:50 ` Sagi Grimberg
2 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2024-10-14 18:26 UTC (permalink / raw)
To: Guixin Liu
Cc: linux-nvme@lists.infradead.org, hch@lst.de, Chaitanya Kulkarni,
sagi@grimberg.me, kbusch@kernel.org, axboe@kernel.dk
On 10/14/24 03:14, Guixin Liu wrote:
> Parse reservation commands's action(including rrega, racqa and rrela)
> and rtype to string to make the trace log more human-readable.
>
> Signed-off-by: Guixin Liu<kanie@linux.alibaba.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] nvme: parse reservation commands's action and rtype to string
2024-10-14 10:14 ` [PATCH 1/2] nvme: parse reservation commands's action and rtype to string Guixin Liu
2024-10-14 18:26 ` Chaitanya Kulkarni
@ 2024-10-15 4:54 ` Christoph Hellwig
2024-10-20 23:50 ` Sagi Grimberg
2 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2024-10-15 4:54 UTC (permalink / raw)
To: Guixin Liu; +Cc: kbusch, axboe, hch, sagi, kch, linux-nvme
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] nvme: parse reservation commands's action and rtype to string
2024-10-14 10:14 ` [PATCH 1/2] nvme: parse reservation commands's action and rtype to string Guixin Liu
2024-10-14 18:26 ` Chaitanya Kulkarni
2024-10-15 4:54 ` Christoph Hellwig
@ 2024-10-20 23:50 ` Sagi Grimberg
2 siblings, 0 replies; 11+ messages in thread
From: Sagi Grimberg @ 2024-10-20 23:50 UTC (permalink / raw)
To: Guixin Liu, kbusch, axboe, hch, kch; +Cc: linux-nvme
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] nvmet: add tracing of reservation commands
2024-10-14 10:14 [PATCH 0/2] Add the tracing of reservation commands Guixin Liu
2024-10-14 10:14 ` [PATCH 1/2] nvme: parse reservation commands's action and rtype to string Guixin Liu
@ 2024-10-14 10:14 ` Guixin Liu
2024-10-14 18:27 ` Chaitanya Kulkarni
` (2 more replies)
2024-11-13 10:44 ` [PATCH 0/2] Add the " Guixin Liu
2024-11-13 16:58 ` Keith Busch
3 siblings, 3 replies; 11+ messages in thread
From: Guixin Liu @ 2024-10-14 10:14 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi, kch; +Cc: linux-nvme
Add tracing of reservation commands, including register, acquire,
release and report, and also parse the action and rtype to string
to make the trace log more human-readable.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
drivers/nvme/target/trace.c | 108 ++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c
index 9a3548179a8e..6dbc7036f2e4 100644
--- a/drivers/nvme/target/trace.c
+++ b/drivers/nvme/target/trace.c
@@ -180,6 +180,106 @@ static const char *nvmet_trace_zone_mgmt_recv(struct trace_seq *p, u8 *cdw10)
return ret;
}
+static const char *nvmet_trace_resv_reg(struct trace_seq *p, u8 *cdw10)
+{
+ static const char * const rrega_strs[] = {
+ [0x00] = "register",
+ [0x01] = "unregister",
+ [0x02] = "replace",
+ };
+ 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;
+ const char *rrega_str;
+
+ if (rrega < ARRAY_SIZE(rrega_strs) && rrega_strs[rrega])
+ rrega_str = rrega_strs[rrega];
+ else
+ rrega_str = "reserved";
+
+ trace_seq_printf(p, "rrega=%u:%s, iekey=%u, ptpl=%u",
+ rrega, rrega_str, iekey, ptpl);
+ trace_seq_putc(p, 0);
+
+ return ret;
+}
+
+static const char * const rtype_strs[] = {
+ [0x00] = "reserved",
+ [0x01] = "write exclusive",
+ [0x02] = "exclusive access",
+ [0x03] = "write exclusive registrants only",
+ [0x04] = "exclusive access registrants only",
+ [0x05] = "write exclusive all registrants",
+ [0x06] = "exclusive access all registrants",
+};
+
+static const char *nvmet_trace_resv_acq(struct trace_seq *p, u8 *cdw10)
+{
+ static const char * const racqa_strs[] = {
+ [0x00] = "acquire",
+ [0x01] = "preempt",
+ [0x02] = "preempt and abort",
+ };
+ const char *ret = trace_seq_buffer_ptr(p);
+ u8 racqa = cdw10[0] & 0x7;
+ u8 iekey = (cdw10[0] >> 3) & 0x1;
+ u8 rtype = cdw10[1];
+ const char *racqa_str = "reserved";
+ const char *rtype_str = "reserved";
+
+ if (racqa < ARRAY_SIZE(racqa_strs) && racqa_strs[racqa])
+ racqa_str = racqa_strs[racqa];
+
+ if (rtype < ARRAY_SIZE(rtype_strs) && rtype_strs[rtype])
+ rtype_str = rtype_strs[rtype];
+
+ trace_seq_printf(p, "racqa=%u:%s, iekey=%u, rtype=%u:%s",
+ racqa, racqa_str, iekey, rtype, rtype_str);
+ trace_seq_putc(p, 0);
+
+ return ret;
+}
+
+static const char *nvmet_trace_resv_rel(struct trace_seq *p, u8 *cdw10)
+{
+ static const char * const rrela_strs[] = {
+ [0x00] = "release",
+ [0x01] = "clear",
+ };
+ const char *ret = trace_seq_buffer_ptr(p);
+ u8 rrela = cdw10[0] & 0x7;
+ u8 iekey = (cdw10[0] >> 3) & 0x1;
+ u8 rtype = cdw10[1];
+ const char *rrela_str = "reserved";
+ const char *rtype_str = "reserved";
+
+ if (rrela < ARRAY_SIZE(rrela_strs) && rrela_strs[rrela])
+ rrela_str = rrela_strs[rrela];
+
+ if (rtype < ARRAY_SIZE(rtype_strs) && rtype_strs[rtype])
+ rtype_str = rtype_strs[rtype];
+
+ trace_seq_printf(p, "rrela=%u:%s, iekey=%u, rtype=%u:%s",
+ rrela, rrela_str, iekey, rtype, rtype_str);
+ trace_seq_putc(p, 0);
+
+ return ret;
+}
+
+static const char *nvmet_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;
+}
+
const char *nvmet_trace_parse_nvm_cmd(struct trace_seq *p,
u8 opcode, u8 *cdw10)
{
@@ -195,6 +295,14 @@ const char *nvmet_trace_parse_nvm_cmd(struct trace_seq *p,
return nvmet_trace_zone_mgmt_send(p, cdw10);
case nvme_cmd_zone_mgmt_recv:
return nvmet_trace_zone_mgmt_recv(p, cdw10);
+ case nvme_cmd_resv_register:
+ return nvmet_trace_resv_reg(p, cdw10);
+ case nvme_cmd_resv_acquire:
+ return nvmet_trace_resv_acq(p, cdw10);
+ case nvme_cmd_resv_release:
+ return nvmet_trace_resv_rel(p, cdw10);
+ case nvme_cmd_resv_report:
+ return nvmet_trace_resv_report(p, cdw10);
default:
return nvmet_trace_common(p, cdw10);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 2/2] nvmet: add tracing of reservation commands
2024-10-14 10:14 ` [PATCH 2/2] nvmet: add tracing of reservation commands Guixin Liu
@ 2024-10-14 18:27 ` Chaitanya Kulkarni
2024-10-15 4:54 ` Christoph Hellwig
2024-10-20 23:50 ` Sagi Grimberg
2 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2024-10-14 18:27 UTC (permalink / raw)
To: Guixin Liu
Cc: linux-nvme@lists.infradead.org, hch@lst.de, Chaitanya Kulkarni,
sagi@grimberg.me, kbusch@kernel.org, axboe@kernel.dk
On 10/14/24 03:14, Guixin Liu wrote:
> Add tracing of reservation commands, including register, acquire,
> release and report, and also parse the action and rtype to string
> to make the trace log more human-readable.
>
> Signed-off-by: Guixin Liu<kanie@linux.alibaba.com>
> ---
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] nvmet: add tracing of reservation commands
2024-10-14 10:14 ` [PATCH 2/2] nvmet: add tracing of reservation commands Guixin Liu
2024-10-14 18:27 ` Chaitanya Kulkarni
@ 2024-10-15 4:54 ` Christoph Hellwig
2024-10-20 23:50 ` Sagi Grimberg
2 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2024-10-15 4:54 UTC (permalink / raw)
To: Guixin Liu; +Cc: kbusch, axboe, hch, sagi, kch, linux-nvme
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] nvmet: add tracing of reservation commands
2024-10-14 10:14 ` [PATCH 2/2] nvmet: add tracing of reservation commands Guixin Liu
2024-10-14 18:27 ` Chaitanya Kulkarni
2024-10-15 4:54 ` Christoph Hellwig
@ 2024-10-20 23:50 ` Sagi Grimberg
2 siblings, 0 replies; 11+ messages in thread
From: Sagi Grimberg @ 2024-10-20 23:50 UTC (permalink / raw)
To: Guixin Liu, kbusch, axboe, hch, kch; +Cc: linux-nvme
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>**
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] Add the tracing of reservation commands
2024-10-14 10:14 [PATCH 0/2] Add the tracing of reservation commands Guixin Liu
2024-10-14 10:14 ` [PATCH 1/2] nvme: parse reservation commands's action and rtype to string Guixin Liu
2024-10-14 10:14 ` [PATCH 2/2] nvmet: add tracing of reservation commands Guixin Liu
@ 2024-11-13 10:44 ` Guixin Liu
2024-11-13 16:58 ` Keith Busch
3 siblings, 0 replies; 11+ messages in thread
From: Guixin Liu @ 2024-11-13 10:44 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi, kch; +Cc: linux-nvme
Hi Keith,
I found that this patchset is not aplied yet, could you please take
a look?
Best Regards,
Guixin Liu
在 2024/10/14 18:14, Guixin Liu 写道:
> Host:
> - Parse the action and rtype to string.
> Target:
> - Add the tracing of reservation commands, and also parse actions
> rtype to string.
>
> Guixin Liu (2):
> nvme: parse reservation commands's action and rtype to string
> nvmet: add tracing of reservation commands
>
> drivers/nvme/host/trace.c | 58 +++++++++++++++++--
> drivers/nvme/target/trace.c | 108 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 160 insertions(+), 6 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] Add the tracing of reservation commands
2024-10-14 10:14 [PATCH 0/2] Add the tracing of reservation commands Guixin Liu
` (2 preceding siblings ...)
2024-11-13 10:44 ` [PATCH 0/2] Add the " Guixin Liu
@ 2024-11-13 16:58 ` Keith Busch
3 siblings, 0 replies; 11+ messages in thread
From: Keith Busch @ 2024-11-13 16:58 UTC (permalink / raw)
To: Guixin Liu; +Cc: axboe, hch, sagi, kch, linux-nvme
On Mon, Oct 14, 2024 at 06:14:56PM +0800, Guixin Liu wrote:
> Host:
> - Parse the action and rtype to string.
> Target:
> - Add the tracing of reservation commands, and also parse actions
> rtype to string.
>
> Guixin Liu (2):
> nvme: parse reservation commands's action and rtype to string
> nvmet: add tracing of reservation commands
Thanks, applied to nvme-6.13.
^ permalink raw reply [flat|nested] 11+ messages in thread