Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Christoph Hellwig <hch@lst.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.de>,
	John Garry <john.g.garry@oracle.com>,
	Mike Christie <michael.christie@oracle.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Changyuan Lyu <changyuanl@google.com>,
	Jolly Shah <jollys@google.com>,
	Vishakha Channapattan <vishakhavc@google.com>
Subject: Re: [PATCH v2 3/5] scsi: core: Trace SCSI sense data
Date: Thu, 4 May 2023 09:03:16 +0000	[thread overview]
Message-ID: <ZFN00zRP9ETzF504@x1-carbon> (raw)
In-Reply-To: <20230503230654.2441121-4-bvanassche@acm.org>

On Wed, May 03, 2023 at 04:06:52PM -0700, Bart Van Assche wrote:
> If a command fails, SCSI sense data is essential to determine why it
> failed. Hence make the sense key, ASC and ASCQ codes available in the
> ftrace output.
> 
> Cc: Niklas Cassel <niklas.cassel@wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: John Garry <john.g.garry@oracle.com>
> Cc: Mike Christie <michael.christie@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  include/trace/events/scsi.h | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
> index a2c7befd451a..6c4be1ebe268 100644
> --- a/include/trace/events/scsi.h
> +++ b/include/trace/events/scsi.h
> @@ -269,9 +269,14 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
>  		__field( unsigned int,	prot_sglen )
>  		__field( unsigned char,	prot_op )
>  		__dynamic_array(unsigned char,	cmnd, cmd->cmd_len)
> +		__field( u8, sense_key )
> +		__field( u8, asc )
> +		__field( u8, ascq )
>  	),
>  
>  	TP_fast_assign(
> +		struct scsi_sense_hdr sshdr;
> +
>  		__entry->host_no	= cmd->device->host->host_no;
>  		__entry->channel	= cmd->device->channel;
>  		__entry->id		= cmd->device->id;
> @@ -285,11 +290,22 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
>  		__entry->prot_sglen	= scsi_prot_sg_count(cmd);
>  		__entry->prot_op	= scsi_get_prot_op(cmd);
>  		memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
> +		if (cmd->sense_buffer && SCSI_SENSE_VALID(cmd) &&
> +		    scsi_command_normalize_sense(cmd, &sshdr)) {
> +			__entry->sense_key = sshdr.sense_key;
> +			__entry->asc = sshdr.asc;
> +			__entry->ascq = sshdr.ascq;
> +		} else {
> +			__entry->sense_key = 0;
> +			__entry->asc = 0;
> +			__entry->ascq = 0;
> +		}
>  	),
>  
>  	TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u " \
>  		  "prot_op=%s driver_tag=%d scheduler_tag=%d cmnd=(%s %s raw=%s) " \
> -		  "result=(driver=%s host=%s message=%s status=%s)",
> +		  "result=(driver=%s host=%s message=%s status=%s "
> +		  "sense_key=%u asc=%#x ascq=%#x))",

With the extra parentheses removed (as mentioned by Hannes):

Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>

  parent reply	other threads:[~2023-05-04  9:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 23:06 [PATCH v2 0/5] SCSI core patches Bart Van Assche
2023-05-03 23:06 ` [PATCH v2 1/5] scsi: core: Use min() instead of open-coding it Bart Van Assche
2023-05-05  6:00   ` Christoph Hellwig
2023-05-08 10:51   ` Benjamin Block
2023-05-03 23:06 ` [PATCH v2 2/5] scsi: core: Update a source code comment Bart Van Assche
2023-05-05  6:00   ` Christoph Hellwig
2023-05-08 11:25   ` Benjamin Block
2023-05-08 14:09     ` Bart Van Assche
2023-05-03 23:06 ` [PATCH v2 3/5] scsi: core: Trace SCSI sense data Bart Van Assche
2023-05-04  8:07   ` Hannes Reinecke
2023-05-05 22:00     ` Bart Van Assche
2023-05-04  9:03   ` Niklas Cassel [this message]
2023-05-05  6:01   ` Christoph Hellwig
2023-05-06 22:48     ` Martin K. Petersen
2023-05-17 19:56       ` Bart Van Assche
2023-05-08 14:05   ` Benjamin Block
2023-05-08 14:10     ` Bart Van Assche
2023-05-08 14:21       ` Benjamin Block
2023-05-03 23:06 ` [PATCH v2 4/5] scsi: core: Only kick the requeue list if necessary Bart Van Assche
2023-05-04  4:15   ` Ming Lei
2023-05-05  7:49   ` Christoph Hellwig
2023-05-03 23:06 ` [PATCH v2 5/5] scsi: core: Delay running the queue if the host is blocked Bart Van Assche
2023-05-05  7:49   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZFN00zRP9ETzF504@x1-carbon \
    --to=niklas.cassel@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=changyuanl@google.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=john.g.garry@oracle.com \
    --cc=jollys@google.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mhiramat@kernel.org \
    --cc=michael.christie@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vishakhavc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox