linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Mark Lord <liml@rtr.ca>
Cc: Artem Bokhan <aptem@ngs.ru>, linux-ide@vger.kernel.org
Subject: Re: bad sectors, suspicious behaviour
Date: Wed, 13 Aug 2008 17:40:52 +0900	[thread overview]
Message-ID: <48A29E14.3090908@gmail.com> (raw)
In-Reply-To: <489C54D1.5080901@rtr.ca>

Hello, Mark, Artem.

Mark Lord wrote:
> Mmm.. since it happens only once in a while, and not on every EH action,
> one might assume that it's a race of some kind.
> 
> One possibility, might be due to .qc_defer.
> 
> The stock ata_qc_defer relies heavily on ata_tag_valid(),
> which matches what the above WARN_ON uses.
> 
> But sata_mv doesn't use ata_tag_valid, because it wants to know
> about the entire port and not just a single individual link on the port.
> So instead, it uses ap->nr_active_links for the test.
> 
> My guess is that these two items are not kept in sync during EH.

The culprit is mv_qc_defer().  If the controller is in host queueing
mode, it allows multiple non-NCQ commands to be queued, which
currently isn't allowed by the current libata core.  Allowing it
shouldn't be too difficult but it would incur some core layer changes.
For the time being, can you please test whether the following patch
fixes the problem?

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index ad169ff..80c655f 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1134,30 +1134,16 @@ static int mv_qc_defer(struct ata_queued_cmd *qc)
 	if (ap->nr_active_links == 0)
 		return 0;
 
-	if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
-		/*
-		 * The port is operating in host queuing mode (EDMA).
-		 * It can accomodate a new qc if the qc protocol
-		 * is compatible with the current host queue mode.
-		 */
-		if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) {
-			/*
-			 * The host queue (EDMA) is in NCQ mode.
-			 * If the new qc is also an NCQ command,
-			 * then allow the new qc.
-			 */
-			if (qc->tf.protocol == ATA_PROT_NCQ)
-				return 0;
-		} else {
-			/*
-			 * The host queue (EDMA) is in non-NCQ, DMA mode.
-			 * If the new qc is also a non-NCQ, DMA command,
-			 * then allow the new qc.
-			 */
-			if (qc->tf.protocol == ATA_PROT_DMA)
-				return 0;
-		}
-	}
+	/*
+	 * The port is operating in host queuing mode (EDMA) with NCQ
+	 * enabled, allow multiple NCQ commands.  EDMA also allows
+	 * queueing multiple DMA commands but libata core currently
+	 * doesn't allow it.
+	 */
+	if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) &&
+	    (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol))
+		return 0;
+
 	return ATA_DEFER_PORT;
 }

  parent reply	other threads:[~2008-08-13  8:41 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08 10:02 bad sectors, suspicious behaviour Artem Bokhan
2008-08-08 13:34 ` Mark Lord
2008-08-08 13:50   ` Mark Lord
2008-08-08 14:14     ` Mark Lord
2008-08-11 11:12       ` Bokhan Artem
2008-08-13  8:40       ` Tejun Heo [this message]
2008-08-13 10:47         ` Artem Bokhan
2008-08-13 10:50           ` Tejun Heo
2008-08-13 11:19             ` Artem Bokhan
2008-08-13 11:24               ` [PATCH #upstream-fixes] sata_mv: don't issue two DMA commands concurrently Tejun Heo
2008-08-13 11:37                 ` Artem Bokhan
2008-08-13 11:52                   ` Tejun Heo
2008-08-13 12:05                     ` Artem Bokhan
2008-08-13 12:21                       ` Tejun Heo
2008-08-13 12:32                         ` Artem Bokhan
2008-08-13 16:17                       ` Mark Lord
2008-08-13 17:37                         ` Bokhan Artem
2008-08-13 19:58                         ` Bokhan Artem
2008-08-13 23:36                           ` Mark Lord
2008-08-14  7:42                             ` Artem Bokhan
2008-08-14 12:40                               ` Mark Lord
2008-08-14 12:58                                 ` Artem Bokhan
2008-08-14 13:17                                 ` Artem Bokhan
2008-08-14 19:49                                   ` Mark Lord
2008-08-15  5:35                                     ` Artem Bokhan
2008-08-15 12:27                                       ` Mark Lord
2008-08-13 16:57                       ` Greg Freemyer
2008-08-13 17:29                         ` Bokhan Artem
2008-08-13 17:50                           ` Greg Freemyer
2008-08-13 18:04                             ` Bokhan Artem
2008-08-13 18:13                               ` Greg Freemyer
2008-08-13 11:47                 ` Artem Bokhan
2008-08-13 11:52                   ` Tejun Heo
2008-08-22 16:28                     ` Grant Grundler
2008-08-13 16:10                 ` Mark Lord
2008-08-22  6:11                 ` Jeff Garzik
2008-08-22 17:01                   ` Martin Michlmayr
2008-08-26 13:54                     ` Mark Lord
2008-08-29  7:12                       ` Martin Michlmayr
2008-08-26  1:24                 ` Gwendal Grignou
2008-08-26  7:04                   ` Tejun Heo
2008-08-26 13:58                     ` Mark Lord
  -- strict thread matches above, loose matches on Subject: below --
2008-08-08  2:57 bad sectors, suspicious behaviour Artem Bokhan

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=48A29E14.3090908@gmail.com \
    --to=htejun@gmail.com \
    --cc=aptem@ngs.ru \
    --cc=liml@rtr.ca \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).