Re: [PATCH 25/46] libata-sff: add tracepoints for HSM state machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/4/20 5:55 PM, Hannes Reinecke wrote:
> Add tracepoints for the HSM state machine and remove DPRINTK() calls.

Please move the removal to a separate (post-)patch
(like it has been done for reset tracepoints).

Also there is a lot of complaints from checkpatch.pl script
regarding CodingStyle:

WARNING: please, no spaces at the start of a line
#180: FILE: include/trace/events/libata.h:153:
+    __print_symbolic(val,^I^I^I^I\$

WARNING: function definition argument 'struct trace_seq *' should also have an identifier name
#194: FILE: include/trace/events/libata.h:172:
+const char *libata_trace_parse_tf_flags(struct trace_seq *, unsigned int);

WARNING: function definition argument 'unsigned int' should also have an identifier name
#194: FILE: include/trace/events/libata.h:172:
+const char *libata_trace_parse_tf_flags(struct trace_seq *, unsigned int);

ERROR: space prohibited after that open parenthesis '('
#211: FILE: include/trace/events/libata.h:536:
+               __field( unsigned int,  ata_port )

ERROR: space prohibited before that close parenthesis ')'
#211: FILE: include/trace/events/libata.h:536:
+               __field( unsigned int,  ata_port )

ERROR: space prohibited after that open parenthesis '('
#212: FILE: include/trace/events/libata.h:537:
+               __field( unsigned int,  ata_dev )

ERROR: space prohibited before that close parenthesis ')'
#212: FILE: include/trace/events/libata.h:537:
+               __field( unsigned int,  ata_dev )

ERROR: space prohibited after that open parenthesis '('
#213: FILE: include/trace/events/libata.h:538:
+               __field( unsigned int,  tag     )

ERROR: space prohibited before that close parenthesis ')'
#213: FILE: include/trace/events/libata.h:538:
+               __field( unsigned int,  tag     )

ERROR: space prohibited after that open parenthesis '('
#214: FILE: include/trace/events/libata.h:539:
+               __field( unsigned int,  qc_flags )

ERROR: space prohibited before that close parenthesis ')'
#214: FILE: include/trace/events/libata.h:539:
+               __field( unsigned int,  qc_flags )

ERROR: space prohibited after that open parenthesis '('
#215: FILE: include/trace/events/libata.h:540:
+               __field( unsigned int,  protocol )

ERROR: space prohibited before that close parenthesis ')'
#215: FILE: include/trace/events/libata.h:540:
+               __field( unsigned int,  protocol )

ERROR: space prohibited after that open parenthesis '('
#216: FILE: include/trace/events/libata.h:541:
+               __field( unsigned int,  hsm_state )

ERROR: space prohibited before that close parenthesis ')'
#216: FILE: include/trace/events/libata.h:541:
+               __field( unsigned int,  hsm_state )

ERROR: space prohibited after that open parenthesis '('
#217: FILE: include/trace/events/libata.h:542:
+               __field( unsigned char, dev_state )

ERROR: space prohibited before that close parenthesis ')'
#217: FILE: include/trace/events/libata.h:542:
+               __field( unsigned char, dev_state )

ERROR: space required after that ',' (ctx:VxV)
#232: FILE: include/trace/events/libata.h:557:
+                 __entry->protocol,__parse_qc_flags(__entry->qc_flags),
                                   ^

WARNING: line over 80 characters
#247: FILE: include/trace/events/libata.h:572:
+       TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),

ERROR: space prohibited after that open parenthesis '('
#252: FILE: include/trace/events/libata.h:577:
+               __field( unsigned int,  ata_port )

ERROR: space prohibited before that close parenthesis ')'
#252: FILE: include/trace/events/libata.h:577:
+               __field( unsigned int,  ata_port )

ERROR: space prohibited after that open parenthesis '('
#253: FILE: include/trace/events/libata.h:578:
+               __field( unsigned int,  ata_dev )

ERROR: space prohibited before that close parenthesis ')'
#253: FILE: include/trace/events/libata.h:578:
+               __field( unsigned int,  ata_dev )

ERROR: space prohibited after that open parenthesis '('
#254: FILE: include/trace/events/libata.h:579:
+               __field( unsigned int,  tag     )

ERROR: space prohibited before that close parenthesis ')'
#254: FILE: include/trace/events/libata.h:579:
+               __field( unsigned int,  tag     )

ERROR: space prohibited after that open parenthesis '('
#255: FILE: include/trace/events/libata.h:580:
+               __field( unsigned int,  flags   )

ERROR: space prohibited before that close parenthesis ')'
#255: FILE: include/trace/events/libata.h:580:
+               __field( unsigned int,  flags   )

ERROR: space prohibited after that open parenthesis '('
#256: FILE: include/trace/events/libata.h:581:
+               __field( unsigned int,  offset  )

ERROR: space prohibited before that close parenthesis ')'
#256: FILE: include/trace/events/libata.h:581:
+               __field( unsigned int,  offset  )

ERROR: space prohibited after that open parenthesis '('
#257: FILE: include/trace/events/libata.h:582:
+               __field( unsigned int,  bytes   )

ERROR: space prohibited before that close parenthesis ')'
#257: FILE: include/trace/events/libata.h:582:
+               __field( unsigned int,  bytes   )

WARNING: line over 80 characters
#276: FILE: include/trace/events/libata.h:601:
+            TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),

WARNING: line over 80 characters
#280: FILE: include/trace/events/libata.h:605:
+            TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),

WARNING: line over 80 characters
#284: FILE: include/trace/events/libata.h:609:
+            TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
> ---
>  drivers/ata/libata-sff.c      | 12 +++---
>  drivers/ata/libata-trace.c    | 29 +++++++++++++
>  include/trace/events/libata.h | 95 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 129 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index a5e6be6955ae..6b961eadc201 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -660,7 +660,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
>  	page = nth_page(page, (offset >> PAGE_SHIFT));
>  	offset %= PAGE_SIZE;
>  
> -	DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
> +	trace_ata_sff_pio_transfer_data(qc, offset, qc->sect_size);
>  
>  	/* do the actual data transfer */
>  	buf = kmap_atomic(page);
> @@ -723,7 +723,7 @@ static void ata_pio_sectors(struct ata_queued_cmd *qc)
>  static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
>  {
>  	/* send SCSI cdb */
> -	DPRINTK("send cdb\n");
> +	trace_atapi_send_cdb(qc, 0, qc->dev->cdb_len);
>  	WARN_ON_ONCE(qc->dev->cdb_len < 12);
>  
>  	ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1);
> @@ -794,7 +794,7 @@ static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
>  	/* don't cross page boundaries */
>  	count = min(count, (unsigned int)PAGE_SIZE - offset);
>  
> -	DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
> +	trace_atapi_pio_transfer_data(qc, offset, count);
>  
>  	/* do the actual data transfer */
>  	buf = kmap_atomic(page);
> @@ -976,8 +976,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
>  	WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc));
>  
>  fsm_start:
> -	DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n",
> -		ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);
> +	trace_ata_sff_hsm_state(qc, status);
>  
>  	switch (ap->hsm_task_state) {
>  	case HSM_ST_FIRST:
> @@ -1178,8 +1177,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
>  		}
>  
>  		/* no more data to transfer */
> -		DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n",
> -			ap->print_id, qc->dev->devno, status);
> +		trace_ata_sff_hsm_command_complete(qc, status);
>  
>  		WARN_ON_ONCE(qc->err_mask & (AC_ERR_DEV | AC_ERR_HSM));
>  
> diff --git a/drivers/ata/libata-trace.c b/drivers/ata/libata-trace.c
> index 08e001303a82..5a9fba18411b 100644
> --- a/drivers/ata/libata-trace.c
> +++ b/drivers/ata/libata-trace.c
> @@ -137,6 +137,35 @@ libata_trace_parse_qc_flags(struct trace_seq *p, unsigned int qc_flags)
>  	return ret;
>  }
>  
> +const char *
> +libata_trace_parse_tf_flags(struct trace_seq *p, unsigned int tf_flags)
> +{
> +	const char *ret = trace_seq_buffer_ptr(p);
> +
> +	trace_seq_printf(p, "%x", tf_flags);
> +	if (tf_flags) {
> +		trace_seq_printf(p, "{ ");
> +		if (tf_flags & ATA_TFLAG_LBA48)
> +			trace_seq_printf(p, "LBA48 ");
> +		if (tf_flags & ATA_TFLAG_ISADDR)
> +			trace_seq_printf(p, "ISADDR ");
> +		if (tf_flags & ATA_TFLAG_DEVICE)
> +			trace_seq_printf(p, "DEV ");
> +		if (tf_flags & ATA_TFLAG_WRITE)
> +			trace_seq_printf(p, "WRITE ");
> +		if (tf_flags & ATA_TFLAG_LBA)
> +			trace_seq_printf(p, "LBA ");
> +		if (tf_flags & ATA_TFLAG_FUA)
> +			trace_seq_printf(p, "FUA ");
> +		if (tf_flags & ATA_TFLAG_POLLING)
> +			trace_seq_printf(p, "POLL ");
> +		trace_seq_putc(p, '}');
> +	}
> +	trace_seq_putc(p, 0);
> +
> +	return ret;
> +}
> +
>  const char *
>  libata_trace_parse_subcmd(struct trace_seq *p, unsigned char cmd,
>  			  unsigned char feature, unsigned char hob_nsect)
> diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
> index 476acf823928..acfc5d739b17 100644
> --- a/include/trace/events/libata.h
> +++ b/include/trace/events/libata.h
> @@ -148,6 +148,15 @@
>  		ata_class_name(ATA_DEV_ZAC_UNSUP),	\
>  		ata_class_name(ATA_DEV_NONE))
>  
> +#define ata_sff_hsm_state_name(state)	{ state, #state }
> +#define show_sff_hsm_state_name(val)				\
> +    __print_symbolic(val,				\
> +		ata_sff_hsm_state_name(HSM_ST_IDLE),	\
> +		ata_sff_hsm_state_name(HSM_ST_FIRST),	\
> +		ata_sff_hsm_state_name(HSM_ST),		\
> +		ata_sff_hsm_state_name(HSM_ST_LAST),	\
> +		ata_sff_hsm_state_name(HSM_ST_ERR))
> +
>  const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
>  #define __parse_status(s) libata_trace_parse_status(p, s)
>  
> @@ -160,6 +169,9 @@ const char *libata_trace_parse_eh_err_mask(struct trace_seq *, unsigned int);
>  const char *libata_trace_parse_qc_flags(struct trace_seq *, unsigned int);
>  #define __parse_qc_flags(f) libata_trace_parse_qc_flags(p, f)
>  
> +const char *libata_trace_parse_tf_flags(struct trace_seq *, unsigned int);
> +#define __parse_tf_flags(f) libata_trace_parse_tf_flags(p, f)
> +
>  const char *libata_trace_parse_subcmd(struct trace_seq *, unsigned char,
>  				      unsigned char, unsigned char);
>  #define __parse_subcmd(c,f,h) libata_trace_parse_subcmd(p, c, f, h)
> @@ -514,6 +526,89 @@ DEFINE_EVENT(ata_link_reset_end_template, ata_link_softreset_end,
>  	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
>  	     TP_ARGS(link, class, rc));
>  
> +DECLARE_EVENT_CLASS(ata_sff_hsm_template,
> +
> +	TP_PROTO(struct ata_queued_cmd *qc, unsigned char status),
> +
> +	TP_ARGS(qc, status),
> +
> +	TP_STRUCT__entry(
> +		__field( unsigned int,	ata_port )
> +		__field( unsigned int,	ata_dev	)
> +		__field( unsigned int,	tag	)
> +		__field( unsigned int,	qc_flags )
> +		__field( unsigned int,	protocol )
> +		__field( unsigned int,	hsm_state )
> +		__field( unsigned char,	dev_state )
> +	),
> +
> +	TP_fast_assign(
> +		__entry->ata_port	= qc->ap->print_id;
> +		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
> +		__entry->tag		= qc->tag;
> +		__entry->qc_flags	= qc->flags;
> +		__entry->protocol	= qc->tf.protocol;
> +		__entry->hsm_state	= qc->ap->hsm_task_state;
> +		__entry->dev_state	= status;
> +	),
> +
> +	TP_printk("ata_port=%u ata_dev=%u tag=%d protocol=%d flags=%s task_state=%s dev_stat=0x%X",
> +		  __entry->ata_port, __entry->ata_dev, __entry->tag,
> +		  __entry->protocol,__parse_qc_flags(__entry->qc_flags),
> +		  show_sff_hsm_state_name(__entry->hsm_state),
> +		  __entry->dev_state)
> +);
> +
> +DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_state,
> +	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
> +	TP_ARGS(qc, state));
> +
> +DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_command_complete,
> +	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
> +	TP_ARGS(qc, state));
> +
> +DECLARE_EVENT_CLASS(ata_transfer_data_template,
> +
> +	TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
> +
> +	TP_ARGS(qc, offset, count),
> +
> +	TP_STRUCT__entry(
> +		__field( unsigned int,	ata_port )
> +		__field( unsigned int,	ata_dev	)
> +		__field( unsigned int,	tag	)
> +		__field( unsigned int,	flags	)
> +		__field( unsigned int,	offset	)
> +		__field( unsigned int,	bytes	)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->ata_port	= qc->ap->print_id;
> +		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
> +		__entry->tag		= qc->tag;
> +		__entry->flags		= qc->tf.flags;
> +		__entry->offset		= offset;
> +		__entry->bytes		= count;
> +	),
> +
> +	TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s offset=%u bytes=%u",
> +		  __entry->ata_port, __entry->ata_dev, __entry->tag,
> +		  __parse_tf_flags(__entry->flags),
> +		  __entry->offset, __entry->bytes)
> +);
> +
> +DEFINE_EVENT(ata_transfer_data_template, ata_sff_pio_transfer_data,
> +	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
> +	     TP_ARGS(qc, offset, count));
> +
> +DEFINE_EVENT(ata_transfer_data_template, atapi_pio_transfer_data,
> +	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
> +	     TP_ARGS(qc, offset, count));
> +
> +DEFINE_EVENT(ata_transfer_data_template, atapi_send_cdb,
> +	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
> +	     TP_ARGS(qc, offset, count));
> +
>  #endif /*  _TRACE_LIBATA_H */
>  
>  /* This part must be outside protection */



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux