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

Keith Busch kbusch at kernel.org
Wed Jan 31 09:36:21 PST 2024


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

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.



More information about the Linux-nvme mailing list