All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Daniel Drake <dsd@gentoo.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jeff Garzik <jeff@garzik.org>, Jens Axboe <jens.axboe@oracle.com>,
	linux list <linux-kernel@vger.kernel.org>,
	linux-ide@vger.kernel.org, Albert Lee <albertcc@tw.ibm.com>
Subject: Re: "Fix ATAPI transfer lengths" causes CD writing regression
Date: Sat, 03 Nov 2007 10:17:12 +0900	[thread overview]
Message-ID: <472BCC18.7070503@gmail.com> (raw)
In-Reply-To: <472B946F.4030004@gentoo.org>

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

Daniel Drake wrote:
> Tejun Heo wrote:
>> Yeap, the SG command is fine.  The drive is being weird tho.  The
>> allocation length field says 10 bytes, so it should just have
>> transferred 10 bytes without causing HSM violation.
>>
>> Can you please apply the attached patch and report what the kernel says
>> after triggering the error condition?
> 
> Thanks for looking at this, the kernel now says:
> 
> <4>ata2.00: HSM violation: eh_analyze_tf: BUSY|DRQ
> <3>ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
> <3>ata2.00: cmd a0/00:00:00:0a:00/00:00:00:00:00/a0 tag 0 cdb 0x5a data
> 10 in
> <4>         res 58/00:02:00:0a:00/00:00:00:00:00/a0 Emask 0x2 (HSM
> violation)
> <3>ata2.00: status: { DRDY DRQ }
> <6>ata2: soft resetting link
> <6>ata2.00: configured for UDMA/33
> <6>ata2: EH complete

Does this patch fix the problem?

-- 
tejun

[-- Attachment #2: drain.patch --]
[-- Type: text/x-patch, Size: 1420 bytes --]

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8ee56e5..5488637 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4994,19 +4994,15 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
 static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
 {
 	int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
-	struct scatterlist *sg = qc->__sg;
-	struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem);
 	struct ata_port *ap = qc->ap;
+	struct scatterlist *sg;
 	struct page *page;
 	unsigned char *buf;
 	unsigned int offset, count;
-	int no_more_sg = 0;
 
-	if (qc->curbytes + bytes >= qc->nbytes)
-		ap->hsm_task_state = HSM_ST_LAST;
-
-next_sg:
-	if (unlikely(no_more_sg)) {
+ next_sg:
+	sg = qc->cursg;
+	if (unlikely(!sg)) {
 		/*
 		 * The end of qc->sg is reached and the device expects
 		 * more data to transfer. In order not to overrun qc->sg
@@ -5024,13 +5020,9 @@ next_sg:
 
 		for (i = 0; i < words; i++)
 			ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write);
-
-		ap->hsm_task_state = HSM_ST_LAST;
 		return;
 	}
 
-	sg = qc->cursg;
-
 	page = sg_page(sg);
 	offset = sg->offset + qc->cursg_ofs;
 
@@ -5068,9 +5060,6 @@ next_sg:
 	qc->cursg_ofs += count;
 
 	if (qc->cursg_ofs == sg->length) {
-		if (qc->cursg == lsg)
-			no_more_sg = 1;
-
 		qc->cursg = sg_next(qc->cursg);
 		qc->cursg_ofs = 0;
 	}

  reply	other threads:[~2007-11-03  1:17 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 15:14 "Fix ATAPI transfer lengths" causes CD writing regression Daniel Drake
2007-10-30 15:34 ` Alan Cox
2007-10-30 17:45   ` Daniel Drake
2007-10-30 18:26     ` Frans Pop
2007-10-30 19:01     ` Alan Cox
2007-10-30 19:21       ` Daniel Drake
2007-10-31 11:49         ` Alan Cox
2007-10-31 11:57           ` Jens Axboe
2007-10-31 12:20             ` Jeff Garzik
2007-10-31 12:26               ` Jens Axboe
2007-10-31 16:05                 ` Jeff Garzik
2007-10-31 16:29                   ` Alan Cox
2007-10-31 16:34                   ` Daniel Drake
2007-10-31 17:55                   ` Jens Axboe
2007-11-01  0:40               ` Tejun Heo
2007-11-01  7:24                 ` Tejun Heo
2007-11-01 10:50                 ` Alan Cox
2007-10-31 12:49             ` Alan Cox
2007-11-01  9:48             ` Jeff Garzik
2007-11-01 10:53               ` Alan Cox
2007-11-01 11:09                 ` Jeff Garzik
2007-11-01 14:15                   ` Alan Cox
2007-11-01 15:33                     ` Daniel Drake
2007-11-01 15:57                       ` Alan Cox
2007-11-01 16:06                         ` Tejun Heo
2007-11-01 16:04                       ` Tejun Heo
2007-11-02 21:19                         ` Daniel Drake
2007-11-03  1:17                           ` Tejun Heo [this message]
2007-11-03 12:34                             ` Jeff Garzik
2007-11-03 20:02                             ` Daniel Drake
2007-11-04  0:07                               ` Tejun Heo
2007-11-04  4:02                                 ` Albert Lee
2007-11-04 23:42                                   ` Alan Cox
2007-11-05  0:05                                     ` Tejun Heo
2007-11-05 13:03                                       ` Alan Cox
2007-11-06 10:18                                         ` Tejun Heo
2007-11-06 12:48                                           ` Alan Cox
2007-11-05  0:15                                 ` Daniel Drake
2007-11-02 17:58                       ` Jeff Garzik
2007-10-30 16:02 ` Jeff Garzik
2007-10-30 16:10   ` Alan Cox

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=472BCC18.7070503@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=dsd@gentoo.org \
    --cc=jeff@garzik.org \
    --cc=jens.axboe@oracle.com \
    --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 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.