linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Tejun Heo <htejun@gmail.com>
Cc: Daniel Drake <dsd@gentoo.org>,
	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
Subject: Re: "Fix ATAPI transfer lengths" causes CD writing regression
Date: Sun, 04 Nov 2007 12:02:35 +0800	[thread overview]
Message-ID: <472D445B.1080005@tw.ibm.com> (raw)
In-Reply-To: <472D0D4A.70404@gmail.com>

Tejun Heo wrote:
> Daniel Drake wrote:
> 
>>Tejun Heo wrote:
>>
>>>><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?
>>
>>That fixes it, thanks! There is no more ugly error in dmesg, the test
>>prog doesn't print any sense data, and brasero works OK too. However,
>>these messages appear in the kernel log every time I run the test app
>>(or when brasero does its thing):
>>
>><4>ata2.00: 10 bytes trailing data
>><4>ata2.00: 10 bytes trailing data
>><4>ata2.00: 10 bytes trailing data
>><4>ata2.00: 10 bytes trailing data
>><4>ata2.00: 10 bytes trailing data
>><4>ata2.00: 10 bytes trailing data
>><4>ata2.00: 6 bytes trailing data
> 
> 
> Yeah, that's expected.  What's going on here is that your drive sends
> full mode sense data (76bytes) regardless of allocation size in CDB but
> it does honor transfer chunk set in the PACKET TF, which is set to the
> same value as allocation size by Alan's patch.  So, now the drive sends
> the 76 bytes in 8 chunks.  The first chunk is transferred into the sg
> buffer and the following chunks are thrown away.
> 
> Previously, transfer chunk was set to 8k, so the drive claims to
> transfer 76 bytes from the buegging, libata transfers leading 10 bytes
> got transferred into the user buffer and throws away what's remaining.
> The change caused problem because libata HSM always switches to
> HSM_ST_LAST (command sequence completion) after filling the command
> buffer completely.  So, throwing away is activated iff the extra data to
> throw away is transfered together with the last chunk of useful data.
> 
> With the chunk size reduced to allocation size, the initial chunk fills
> the data buffer completely and all the extra bytes are transfered in
> separate chunks.  However, libata HSM expects command sequence to
> complete after the initial chunk but the drive asserts DRQ for the next
> chunk on the following interrupt, so HSM violation is triggered.
> 
> The patch modifies HSM such that it keeps throwing away extra data as
> long as the drive asserts DRQ which is how IDE driver does it.
> 

>From past experience, some dead ATAPI devices stuck in DRQ=1. We should
take care of such situation, otherwise the HSM might get into an infinite
loop of waiting for the dead ATAPI device to say DRQ=0 and discarding
endless "trailing data".

Maybe we could set a limit here. If the ATAPI device keeps DRQ=1 and
exceeds the limit, we consider it as HSM violation and have EH handle it.

--
albert




  reply	other threads:[~2007-11-04  4:03 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
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 [this message]
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=472D445B.1080005@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertl@mail.com \
    --cc=dsd@gentoo.org \
    --cc=htejun@gmail.com \
    --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 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).