linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Jens Axboe <axboe@suse.de>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Playing with SATA NCQ
Date: Fri, 27 May 2005 03:29:32 -0400	[thread overview]
Message-ID: <4296CC5C.5000807@pobox.com> (raw)
In-Reply-To: <20050527072046.GN1435@suse.de>

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

Jens Axboe wrote:
> I double checked this. If you agree to move the setting of QCFLAG_ACTIVE
> _after_ successful ap->ops->qc_issue(qc) and clear it _after_
> __ata_qc_complete(qc) then I can just use that bit and kill
> ATA_QCFLAG_ACCOUNT.
> 
> What do you think?

Fine with me.

Keep in mind that the attached patch was applied recently...

	Jeff





[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1933 bytes --]

author Albert Lee <albertcc@tw.ibm.com> Fri, 29 Apr 2005 17:34:59 +0800
committer Jeff Garzik <jgarzik@pobox.com> Mon, 16 May 2005 02:46:59 -0400

[PATCH] libata: Prevent the interrupt handler from completing a command twice

Problem:
   During the libata CD-ROM stress test, sometimes the "BUG: timeout
without command" error is seen.

Root cause:
  Unexpected interrupt occurs after the ata_qc_complete() is called,
but before the SCSI error handler.  The interrupt handler is invoked
before the SCSI error handler, and it clears the command by calling
ata_qc_complete() again.  Later when the SCSI error handler is run,
the ata_queued_cmd is already gone, causing the "BUG: timeout without
command" error.

Changes:
  - Use the ATA_QCFLAG_ACTIVE flag to prevent the interrupt handler
from completing the command twice, before the scsi_error_handler.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>


diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2539,7 +2539,7 @@ static void atapi_request_sense(struct a
 	ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer));
 	qc->dma_dir = DMA_FROM_DEVICE;
 
-	memset(&qc->cdb, 0, sizeof(ap->cdb_len));
+	memset(&qc->cdb, 0, ap->cdb_len);
 	qc->cdb[0] = REQUEST_SENSE;
 	qc->cdb[4] = SCSI_SENSE_BUFFERSIZE;
 
@@ -2811,6 +2811,7 @@ void ata_qc_complete(struct ata_queued_c
 
 	/* call completion callback */
 	rc = qc->complete_fn(qc, drv_stat);
+	qc->flags &= ~ATA_QCFLAG_ACTIVE;
 
 	/* if callback indicates not to complete command (non-zero),
 	 * return immediately
@@ -3229,7 +3230,8 @@ irqreturn_t ata_interrupt (int irq, void
 			struct ata_queued_cmd *qc;
 
 			qc = ata_qc_from_tag(ap, ap->active_tag);
-			if (qc && (!(qc->tf.ctl & ATA_NIEN)))
+			if (qc && (!(qc->tf.ctl & ATA_NIEN)) &&
+			    (qc->flags & ATA_QCFLAG_ACTIVE))
 				handled |= ata_host_intr(ap, qc);
 		}
 	}

  reply	other threads:[~2005-05-27  7:29 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-26 14:00 Playing with SATA NCQ Jens Axboe
2005-05-26 16:25 ` Jeff Garzik
2005-05-26 17:07   ` Jens Axboe
2005-05-26 17:11     ` Jens Axboe
2005-05-26 17:15       ` Jeff Garzik
2005-05-26 17:33         ` Jens Axboe
2005-05-26 19:49     ` Jeff Garzik
2005-05-26 20:30       ` Jens Axboe
2005-05-27  7:20   ` Jens Axboe
2005-05-27  7:29     ` Jeff Garzik [this message]
2005-05-27  7:33       ` Jens Axboe
2005-05-27  7:51         ` Jeff Garzik
2005-05-27  8:00           ` Jens Axboe
2005-05-27  8:23             ` Jeff Garzik
2005-05-26 21:50 ` Mark Lord
2005-05-27  6:28   ` Jens Axboe
2005-05-27  6:58     ` Jeff Garzik
2005-05-27  7:15       ` Jens Axboe
2005-05-27  4:41 ` Jeff Garzik
2005-05-27  6:39   ` Jens Axboe
2005-05-27 21:40 ` Michael Thonke
2005-05-27 22:16   ` Jeff Garzik
2005-05-27 22:30     ` Michael Thonke
2005-05-28 12:12       ` Jens Axboe
2005-05-29 13:01         ` Michael Thonke
2005-05-29 14:09           ` Mark Lord
2005-05-29 14:24             ` Tyler
2005-05-29 15:22               ` Eric D. Mudama
2005-05-29 19:04             ` Jens Axboe
2005-05-29 19:05               ` Jeff Garzik
2005-05-29 19:21                 ` Jens Axboe
2005-05-29 19:03           ` Jens Axboe
2005-05-29 20:12             ` Michael Thonke
2005-05-29 20:17               ` Jeff Garzik
2005-05-30  6:05                 ` Jens Axboe
2005-05-30  6:07               ` Jens Axboe
2005-05-29 18:10         ` Michael Thonke
2005-05-29 19:06           ` Jens Axboe
2005-05-29 16:03 ` Erik Slagter
2005-05-29 16:34   ` Jeff Garzik
2005-05-29 16:50     ` Erik Slagter
2005-05-29 16:59       ` Jeff Garzik
2005-05-29 17:23         ` Erik Slagter
2005-05-29 17:29           ` Jeff Garzik
2005-05-29 17:45             ` Erik Slagter
2005-05-29 18:01               ` Jeff Garzik
2005-05-29 18:10                 ` Erik Slagter
2005-05-29 18:14                   ` Jeff Garzik
2005-05-29 18:27                 ` Michael Thonke
2005-05-29 18:31                   ` Jeff Garzik
2005-05-29 16:57   ` Michael Thonke
2005-05-29 17:26     ` Erik Slagter
2005-05-30  0:06       ` Mark Lord
2005-05-30  7:29         ` Erik Slagter
2005-05-30 18:09           ` Mark Lord
2005-05-30 18:22             ` Erik Slagter
2005-05-30 18:25               ` Mark Lord
2005-05-30 18:34                 ` Michael Thonke
2005-05-30 18:51                   ` Jeff Garzik
2005-05-30 18:48                 ` Jeff Garzik
2005-05-30 18:50               ` Jeff Garzik
2005-05-30 20:03                 ` Erik Slagter
2005-05-30 20:19                   ` Jeff Garzik
2005-05-31  7:44                     ` Erik Slagter
2005-05-30 23:14                 ` Mark Lord
2005-05-31  7:48                   ` Erik Slagter
2005-05-31  8:05                     ` Patrick McFarland
2005-05-29 21:49 ` Michael Thonke

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=4296CC5C.5000807@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=axboe@suse.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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).