All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>, Tejun Heo <htejun@gmail.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH 11/12] sata_mv delayed eh handling
Date: Fri, 02 May 2008 02:15:37 -0400	[thread overview]
Message-ID: <481AB189.3070705@rtr.ca> (raw)
In-Reply-To: <481AB15D.5020201@rtr.ca>

Introduce a new "delayed error handling" mechanism in sata_mv,
to enable us to eventually deal with multiple simultaneous NCQ
failures on a single host link when a PM is present.

This involves a port flag (MV_PP_FLAG_DELAYED_EH) to prevent new
commands being queued, and a pmp bitmap to indicate which pmp links
had NCQ errors.

The new mv_pmp_error_handler() uses those values to invoke
ata_eh_analyze_ncq_error() on each failed link, prior to freezing
the port and passing control to sata_pmp_error_handler().

This is based upon a strategy suggested by Tejun.

For now, we just implement the delayed mechanism.
The next patch in this series will add the multiple-NCQ EH code
to take advantage of it.

Signed-off-by: Mark Lord <mlord@pobox.com>

--- old/drivers/ata/sata_mv.c	2008-05-01 18:43:49.000000000 -0400
+++ linux/drivers/ata/sata_mv.c	2008-05-01 18:55:23.000000000 -0400
@@ -367,6 +367,7 @@
 	MV_PP_FLAG_EDMA_EN	= (1 << 0),	/* is EDMA engine enabled? */
 	MV_PP_FLAG_NCQ_EN	= (1 << 1),	/* is EDMA set up for NCQ? */
 	MV_PP_FLAG_FBS_EN	= (1 << 2),	/* is EDMA set up for FBS? */
+	MV_PP_FLAG_DELAYED_EH	= (1 << 3),	/* delayed dev err handling */
 };
 
 #define IS_GEN_I(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_I)
@@ -447,6 +448,7 @@
 	unsigned int		resp_idx;
 
 	u32			pp_flags;
+	unsigned int		delayed_eh_pmp_map;
 };
 
 struct mv_port_signal {
@@ -542,6 +544,7 @@
 				unsigned long deadline);
 static int  mv_softreset(struct ata_link *link, unsigned int *class,
 				unsigned long deadline);
+static void mv_pmp_error_handler(struct ata_port *ap);
 
 /* .sg_tablesize is (MV_MAX_SG_CT / 2) in the structures below
  * because we have to allow room for worst case splitting of
@@ -589,7 +592,7 @@
 	.pmp_hardreset		= mv_pmp_hardreset,
 	.pmp_softreset		= mv_softreset,
 	.softreset		= mv_softreset,
-	.error_handler		= sata_pmp_error_handler,
+	.error_handler		= mv_pmp_error_handler,
 };
 
 static struct ata_port_operations mv_iie_ops = {
@@ -1098,6 +1101,12 @@
 	struct mv_port_priv *pp = ap->private_data;
 
 	/*
+	 * Don't allow new commands if we're in a delayed EH state
+	 * for NCQ and/or FIS-based switching.
+	 */
+	if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH)
+		return ATA_DEFER_PORT;
+	/*
 	 * If the port is completely idle, then allow the new qc.
 	 */
 	if (ap->nr_active_links == 0)
@@ -1591,6 +1600,33 @@
 	return qc;
 }
 
+static void mv_pmp_error_handler(struct ata_port *ap)
+{
+	unsigned int pmp, pmp_map;
+	struct mv_port_priv *pp = ap->private_data;
+
+	if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) {
+		/*
+		 * Perform NCQ error analysis on failed PMPs
+		 * before we freeze the port entirely.
+		 *
+		 * The failed PMPs are marked earlier by mv_pmp_eh_prep().
+		 */
+		pmp_map = pp->delayed_eh_pmp_map;
+		pp->pp_flags &= ~MV_PP_FLAG_DELAYED_EH;
+		for (pmp = 0; pmp_map != 0; pmp++) {
+			unsigned int this_pmp = (1 << pmp);
+			if (pmp_map & this_pmp) {
+				struct ata_link *link = &ap->pmp_link[pmp];
+				pmp_map &= ~this_pmp;
+				ata_eh_analyze_ncq_error(link);
+			}
+		}
+		ata_port_freeze(ap);
+	}
+	sata_pmp_error_handler(ap);
+}
+
 static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled)
 {
 	struct ata_eh_info *ehi = &ap->link.eh_info;

  reply	other threads:[~2008-05-02  6:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02  6:07 [PATCH 00/12] sata_mv: The last big set for 2.6.26 Mark Lord
2008-05-02  6:07 ` [PATCH 01/12] sata_mv more cosmetic changes Mark Lord
2008-05-02  6:08   ` [PATCH 02/12] sata_mv pci features Mark Lord
2008-05-02  6:09     ` [PATCH 03/12] sata_mv wait for empty+idle Mark Lord
2008-05-02  6:10       ` [PATCH 04/12] sata_mv new mv_qc_defer method Mark Lord
2008-05-02  6:10         ` [PATCH 05/12] sata_mv errata workaround for sata25 part 1 Mark Lord
2008-05-02  6:11           ` [PATCH 06/12] sata_mv rearrange mv_config_fbs Mark Lord
2008-05-02  6:12             ` [PATCH 07/12] sata_mv NCQ and SError fixes for mv_err_intr Mark Lord
2008-05-02  6:13               ` [PATCH 08/12] sata_mv fix mv_host_intr bug for hc_irq_cause Mark Lord
2008-05-02  6:14                 ` [PATCH 09/12] sata_mv new mv_port_intr function Mark Lord
2008-05-02  6:14                   ` [PATCH 10/12] sata_mv libata: export ata_eh_analyze_ncq_error Mark Lord
2008-05-02  6:15                     ` Mark Lord [this message]
2008-05-02  6:16                       ` [PATCH 12/12] sata_mv NCQ-EH for FIS-based switching Mark Lord
2008-05-02 12:44                         ` Mark Lord
2008-05-02 16:52                           ` Grant Grundler
2008-05-02 16:54                             ` Grant Grundler
2008-05-02 17:46                               ` Mark Lord
2008-05-02 17:52                                 ` Alan Cox
2008-05-02 17:56                         ` [PATCH 13/13] sata_mv use hweight16() for bit counting Mark Lord
2008-05-02 18:02                           ` Mark Lord
2008-05-02 18:02                           ` [PATCH 13/13] sata_mv use hweight16() for bit counting (V2) Mark Lord
2008-05-02 18:31                             ` Grant Grundler
2008-05-02 16:42       ` [PATCH 03/12] sata_mv wait for empty+idle Grant Grundler
2008-05-02 17:45         ` Mark Lord
2008-05-02 18:39           ` Grant Grundler
2008-05-02 20:09             ` Mark Lord
2008-05-02 16:06     ` [PATCH 02/12] sata_mv pci features Grant Grundler
2008-05-02 17:41       ` Mark Lord
2008-05-02 18:28         ` Grant Grundler
2008-05-06 14:10   ` [PATCH 01/12] sata_mv more cosmetic changes Jeff Garzik
2008-05-06 17:57     ` Mark Lord
2008-05-06 14:17   ` Jeff Garzik

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=481AB189.3070705@rtr.ca \
    --to=liml@rtr.ca \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.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.