[PATCH 2/3] nvme: parse dsm command detailly when tracing

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Jan 29 03:09:38 PST 2024


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 at 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




More information about the Linux-nvme mailing list