All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Damien LeMoal <damien.lemoal@wdc.com>
Cc: linux-ide@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 11/68] libata: add tracepoints for ATA error handling
Date: Fri, 10 Dec 2021 08:28:08 +0100	[thread overview]
Message-ID: <20211210072905.15666-12-hare@suse.de> (raw)
In-Reply-To: <20211210072905.15666-1-hare@suse.de>

Add tracepoints for ATA error handling.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-eh.c       | 26 ++++-----------
 drivers/ata/libata-pmp.c      |  8 -----
 drivers/ata/libata-sata.c     |  3 --
 include/trace/events/libata.h | 60 +++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 30 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 043a1c846f2c..69f51616d8bd 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -533,8 +533,6 @@ void ata_scsi_error(struct Scsi_Host *host)
 	unsigned long flags;
 	LIST_HEAD(eh_work_q);
 
-	DPRINTK("ENTER\n");
-
 	spin_lock_irqsave(host->host_lock, flags);
 	list_splice_init(&host->eh_cmd_q, &eh_work_q);
 	spin_unlock_irqrestore(host->host_lock, flags);
@@ -548,7 +546,6 @@ void ata_scsi_error(struct Scsi_Host *host)
 	/* finish or retry handled scmd's and clean up */
 	WARN_ON(!list_empty(&eh_work_q));
 
-	DPRINTK("EXIT\n");
 }
 
 /**
@@ -940,7 +937,7 @@ void ata_std_sched_eh(struct ata_port *ap)
 	ata_eh_set_pending(ap, 1);
 	scsi_schedule_eh(ap->scsi_host);
 
-	DPRINTK("port EH scheduled\n");
+	trace_ata_std_sched_eh(ap);
 }
 EXPORT_SYMBOL_GPL(ata_std_sched_eh);
 
@@ -1070,7 +1067,7 @@ static void __ata_port_freeze(struct ata_port *ap)
 
 	ap->pflags |= ATA_PFLAG_FROZEN;
 
-	DPRINTK("ata%u port frozen\n", ap->print_id);
+	trace_ata_port_freeze(ap);
 }
 
 /**
@@ -1147,7 +1144,7 @@ void ata_eh_thaw_port(struct ata_port *ap)
 
 	spin_unlock_irqrestore(ap->lock, flags);
 
-	DPRINTK("ata%u port thawed\n", ap->print_id);
+	trace_ata_port_thaw(ap);
 }
 
 static void ata_eh_scsidone(struct scsi_cmnd *scmd)
@@ -1287,6 +1284,8 @@ void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev,
 	struct ata_eh_context *ehc = &link->eh_context;
 	unsigned long flags;
 
+	trace_ata_eh_about_to_do(link, dev ? dev->devno : 0, action);
+
 	spin_lock_irqsave(ap->lock, flags);
 
 	ata_eh_clear_action(link, dev, ehi, action);
@@ -1317,6 +1316,8 @@ void ata_eh_done(struct ata_link *link, struct ata_device *dev,
 {
 	struct ata_eh_context *ehc = &link->eh_context;
 
+	trace_ata_eh_done(link, dev ? dev->devno : 0, action);
+
 	ata_eh_clear_action(link, dev, &ehc->i, action);
 }
 
@@ -1421,8 +1422,6 @@ static void ata_eh_request_sense(struct ata_queued_cmd *qc,
 		return;
 	}
 
-	DPRINTK("ATA request sense\n");
-
 	ata_tf_init(dev, &tf);
 	tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
 	tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
@@ -1463,8 +1462,6 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev,
 	struct ata_port *ap = dev->link->ap;
 	struct ata_taskfile tf;
 
-	DPRINTK("ATAPI request sense\n");
-
 	memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
 
 	/* initialize sense_buf with the error register,
@@ -1928,8 +1925,6 @@ static void ata_eh_link_autopsy(struct ata_link *link)
 	u32 serror;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	if (ehc->i.flags & ATA_EHI_NO_AUTOPSY)
 		return;
 
@@ -2036,7 +2031,6 @@ static void ata_eh_link_autopsy(struct ata_link *link)
 		ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
 		trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
 	}
-	DPRINTK("EXIT\n");
 }
 
 /**
@@ -2936,8 +2930,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
 	unsigned long flags;
 	int rc = 0;
 
-	DPRINTK("ENTER\n");
-
 	/* For PATA drive side cable detection to work, IDENTIFY must
 	 * be done backwards such that PDIAG- is released by the slave
 	 * device before the master device is identified.
@@ -3051,7 +3043,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
 
  err:
 	*r_failed_dev = dev;
-	DPRINTK("EXIT rc=%d\n", rc);
 	return rc;
 }
 
@@ -3566,8 +3557,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
 	int rc, nr_fails;
 	unsigned long flags, deadline;
 
-	DPRINTK("ENTER\n");
-
 	/* prep for recovery */
 	ata_for_each_link(link, ap, EDGE) {
 		struct ata_eh_context *ehc = &link->eh_context;
@@ -3775,7 +3764,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
 	if (rc && r_failed_link)
 		*r_failed_link = link;
 
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index ba7be3f38617..e2e9cbd405fa 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -652,8 +652,6 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
 	u32 *gscr = (void *)ap->sector_buf;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	ata_eh_about_to_do(link, NULL, ATA_EH_REVALIDATE);
 
 	if (!ata_dev_enabled(dev)) {
@@ -686,12 +684,10 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
 
 	ata_eh_done(link, NULL, ATA_EH_REVALIDATE);
 
-	DPRINTK("EXIT, rc=0\n");
 	return 0;
 
  fail:
 	ata_dev_err(dev, "PMP revalidation failed (errno=%d)\n", rc);
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 
@@ -759,8 +755,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
 	int detach = 0, rc = 0;
 	int reval_failed = 0;
 
-	DPRINTK("ENTER\n");
-
 	if (dev->flags & ATA_DFLAG_DETACH) {
 		detach = 1;
 		rc = -ENODEV;
@@ -828,7 +822,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
 	/* okay, PMP resurrected */
 	ehc->i.flags = 0;
 
-	DPRINTK("EXIT, rc=0\n");
 	return 0;
 
  fail:
@@ -838,7 +831,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
 	else
 		ata_dev_disable(dev);
 
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 4e88597aa9df..7b72c68bc9f7 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -533,8 +533,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
 	u32 scontrol;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	if (online)
 		*online = false;
 
@@ -610,7 +608,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
 			*online = false;
 		ata_link_err(link, "COMRESET failed (errno=%d)\n", rc);
 	}
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(sata_link_hardreset);
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index fcb8fde39614..d4e631aa976f 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -490,6 +490,37 @@ TRACE_EVENT(ata_eh_link_autopsy_qc,
 		  __parse_eh_err_mask(__entry->eh_err_mask))
 );
 
+DECLARE_EVENT_CLASS(ata_eh_action_template,
+
+	TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
+
+	TP_ARGS(link, devno, eh_action),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned int,	ata_dev	)
+		__field( unsigned int,	eh_action )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= link->ap->print_id;
+		__entry->ata_dev	= link->pmp + devno;
+		__entry->eh_action	= eh_action;
+	),
+
+	TP_printk("ata_port=%u ata_dev=%u eh_action=%s",
+		  __entry->ata_port, __entry->ata_dev,
+		  __parse_eh_action(__entry->eh_action))
+);
+
+DEFINE_EVENT(ata_eh_action_template, ata_eh_about_to_do,
+	     TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
+	     TP_ARGS(link, devno, eh_action));
+
+DEFINE_EVENT(ata_eh_action_template, ata_eh_done,
+	     TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
+	     TP_ARGS(link, devno, eh_action));
+
 DECLARE_EVENT_CLASS(ata_link_reset_begin_template,
 
 	TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
@@ -570,6 +601,35 @@ DEFINE_EVENT(ata_link_reset_end_template, ata_slave_postreset,
 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
 	     TP_ARGS(link, class, rc));
 
+DECLARE_EVENT_CLASS(ata_port_eh_begin_template,
+
+	TP_PROTO(struct ata_port *ap),
+
+	TP_ARGS(ap),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= ap->print_id;
+	),
+
+	TP_printk("ata_port=%u", __entry->ata_port)
+);
+
+DEFINE_EVENT(ata_port_eh_begin_template, ata_std_sched_eh,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
+DEFINE_EVENT(ata_port_eh_begin_template, ata_port_freeze,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
+DEFINE_EVENT(ata_port_eh_begin_template, ata_port_thaw,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
 DECLARE_EVENT_CLASS(ata_sff_hsm_template,
 
 	TP_PROTO(struct ata_queued_cmd *qc, unsigned char status),
-- 
2.29.2


  parent reply	other threads:[~2021-12-10  7:29 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10  7:27 [PATCHv2 00/68] libata: rework logging, take II Hannes Reinecke
2021-12-10  7:27 ` [PATCH 01/68] libata: remove pointless debugging messages Hannes Reinecke
2021-12-10  7:27 ` [PATCH 02/68] libata: whitespace cleanup Hannes Reinecke
2021-12-10  7:28 ` [PATCH 03/68] libata: Add ata_port_classify() helper Hannes Reinecke
2021-12-10  7:28 ` [PATCH 04/68] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 05/68] libata: sanitize ATA_HORKAGE_DUMP_ID Hannes Reinecke
2021-12-10  7:28 ` [PATCH 06/68] libata: add reset tracepoints Hannes Reinecke
2021-12-10  7:28 ` [PATCH 07/68] libata: add qc_prep tracepoint Hannes Reinecke
2021-12-10  7:28 ` [PATCH 08/68] libata: tracepoints for bus-master DMA Hannes Reinecke
2021-12-10  7:28 ` [PATCH 09/68] libata-sff: tracepoints for HSM state machine Hannes Reinecke
2021-12-10  7:28 ` [PATCH 10/68] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
2021-12-10  7:28 ` Hannes Reinecke [this message]
2021-12-10  7:28 ` [PATCH 12/68] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
2021-12-10  7:28 ` [PATCH 13/68] libata: revamp ata_get_cmd_descript() Hannes Reinecke
2021-12-12  9:33   ` Sergey Shtylyov
2021-12-10  7:28 ` [PATCH 14/68] libata: move DPRINTK to ata debugging Hannes Reinecke
2021-12-12  9:36   ` Sergey Shtylyov
2021-12-10  7:28 ` [PATCH 15/68] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 16/68] sata_mv: replace DPRINTK with dynamic debugging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 17/68] pata_octeon_cf: remove DPRINTK() macro in interrupt context Hannes Reinecke
2021-12-10  7:28 ` [PATCH 18/68] pdc_adma: Remove DPRINTK call Hannes Reinecke
2021-12-10  7:28 ` [PATCH 19/68] sata_fsl: move DPRINTK to ata debugging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 20/68] sata_rcar: replace DPRINTK() with ata_port_dbg() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 21/68] sata_qstor: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 22/68] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 23/68] libata: remove pointless VPRINTK() calls Hannes Reinecke
2021-12-10  7:28 ` [PATCH 24/68] ahci: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
2021-12-10  7:28 ` [PATCH 25/68] pdc_adma: Drop pointless VPRINTK() calls and remove disabled NCQ debugging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 26/68] pata_octeon_cf: Drop pointless VPRINTK() calls and convert the remaining one Hannes Reinecke
2021-12-12  9:23   ` Sergey Shtylyov
2021-12-10  7:28 ` [PATCH 27/68] pata_via: Drop pointless VPRINTK() calls Hannes Reinecke
2021-12-10  7:28 ` [PATCH 28/68] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
2021-12-10 16:19   ` Mikael Pettersson
2021-12-12  9:52   ` Sergey Shtylyov
2021-12-10  7:28 ` [PATCH 29/68] sata_qstor: Drop pointless VPRINTK() calls Hannes Reinecke
2021-12-10  7:28 ` [PATCH 30/68] sata_rcar: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 31/68] sata_inic162x: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 32/68] sata_mv: Drop pointless VPRINTK() call and convert the remaining one Hannes Reinecke
2021-12-10  7:28 ` [PATCH 33/68] sata_nv: drop pointless VPRINTK() calls and convert remaining ones Hannes Reinecke
2021-12-10  7:28 ` [PATCH 34/68] sata_fsl: convert VPRINTK() calls to ata_port_dbg() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 35/68] sata_sil: Drop pointless VPRINTK() calls Hannes Reinecke
2021-12-10  7:28 ` [PATCH 36/68] sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
2021-12-10  7:28 ` [PATCH 37/68] sata_sx4: add module parameter 'dimm_test' Hannes Reinecke
2021-12-10  7:28 ` [PATCH 38/68] libata: drop ata_msg_error() and ata_msg_intr() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 39/68] libata: drop ata_msg_ctl() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 40/68] libata: drop ata_msg_malloc() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 41/68] libata: drop ata_msg_warn() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 42/68] libata: drop ata_msg_probe() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 43/68] libata: drop ata_msg_info() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 44/68] libata: drop ata_msg_drv() Hannes Reinecke
2021-12-10  7:28 ` [PATCH 45/68] libata: remove 'new' ata message handling Hannes Reinecke
2021-12-10  7:28 ` [PATCH 46/68] libata: remove debug compilation switches Hannes Reinecke
2021-12-12  9:21   ` Sergey Shtylyov
2021-12-10  7:28 ` [PATCH 47/68] pata_atp867x: convert printk() calls Hannes Reinecke
2021-12-10  7:28 ` [PATCH 48/68] pata_cmd640: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 49/68] pata_cmd64x: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 50/68] pata_cs5520: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 51/68] pata_cs5536: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 52/68] pata_cypress: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 53/68] pata_it821x: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 54/68] pata_marvell: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 55/68] pata_rz1000: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 56/68] pata_serverworks: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 57/68] pata_sil680: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 58/68] sata_sx4: " Hannes Reinecke
2021-12-10  7:28 ` [PATCH 59/68] sata_mv: convert remaining printk() to structured logging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 60/68] pata_hpt37x: convert pr_XXX() calls Hannes Reinecke
2021-12-10  7:28 ` [PATCH 61/68] pata_octeon_cf: Replace pr_XXX() calls with structured logging Hannes Reinecke
2021-12-10  7:28 ` [PATCH 62/68] pata_hpt3x2n: convert pr_XXX() calls Hannes Reinecke
2021-12-10  7:29 ` [PATCH 63/68] sata_gemini: convert pr_err() calls Hannes Reinecke
2021-12-10  7:29 ` [PATCH 64/68] pata_hpt366: convert pr_warn() calls Hannes Reinecke
2021-12-10  7:29 ` [PATCH 65/68] libata-scsi: rework ata_dump_status to avoid using pr_cont() Hannes Reinecke
2021-12-10  7:29 ` [PATCH 66/68] sata_dwc_460ex: drop DEBUG_NCQ Hannes Reinecke
2021-12-10  7:29 ` [PATCH 67/68] sata_dwc_460ex: remove 'checkstatus' argument Hannes Reinecke
2021-12-12  9:18   ` Sergey Shtylyov
2021-12-10  7:29 ` [PATCH 68/68] sata_dwc_460ex: Remove debug compile options Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2021-12-21  7:20 [PATCHv3 00/68] libata: rework logging, take II Hannes Reinecke
2021-12-21  7:20 ` [PATCH 11/68] libata: add tracepoints for ATA error handling Hannes Reinecke

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=20211210072905.15666-12-hare@suse.de \
    --to=hare@suse.de \
    --cc=damien.lemoal@wdc.com \
    --cc=linux-ide@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.