When writing a disc on certain lite-on dvd-writers (also rebadged as
optiarc/LG/...) connected to a vt6420, the ATAPI CDB ends up in the
datastream and on the disc, causing silent corruption. Delaying
between sending the CDB and starting DMA seems to prevent this.
I do not know if there are burners that do not suffer from this, but
the patch should be safe for those as well.
There are many reports of this issue, but AFAICT no solution was
found before. For example:
http://lkml.indiana.edu/hypermail/linux/kernel/0802.3/0561.html
Signed-off-by: Bart Hartgers <[email protected]>
---
Index: linux-2.6.33-rc4/drivers/ata/sata_via.c
===================================================================
--- linux-2.6.33-rc4.orig/drivers/ata/sata_via.c 2010-01-16 22:29:30.000000000 +0100
+++ linux-2.6.33-rc4/drivers/ata/sata_via.c 2010-01-16 22:29:38.000000000 +0100
@@ -40,6 +40,8 @@
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/device.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include <linux/libata.h>
@@ -80,6 +82,7 @@ static int vt8251_scr_write(struct ata_l
static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
static void svia_noop_freeze(struct ata_port *ap);
static int vt6420_prereset(struct ata_link *link, unsigned long deadline);
+static void vt6420_bmdma_start(struct ata_queued_cmd *qc);
static int vt6421_pata_cable_detect(struct ata_port *ap);
static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev);
static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev);
@@ -121,6 +124,7 @@ static struct ata_port_operations vt6420
.inherits = &svia_base_ops,
.freeze = svia_noop_freeze,
.prereset = vt6420_prereset,
+ .bmdma_start = vt6420_bmdma_start,
};
static struct ata_port_operations vt6421_pata_ops = {
@@ -377,6 +381,19 @@ static int vt6420_prereset(struct ata_li
return 0;
}
+static void vt6420_bmdma_start(struct ata_queued_cmd *qc)
+{
+ struct ata_port *ap = qc->ap;
+ if ((qc->tf.command == ATA_CMD_PACKET) &&
+ unlikely(qc->scsicmd->sc_data_direction == DMA_TO_DEVICE)) {
+ /* Prevents corruption on some ATAPI burners */
+ printk_once(KERN_WARNING DRV_NAME
+ ": fixing DMA to device for ATAPI\n");
+ ata_sff_pause(ap);
+ }
+ ata_bmdma_start(qc);
+}
+
static int vt6421_pata_cable_detect(struct ata_port *ap)
{
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
--
Hello,
On 01/17/2010 08:56 AM, Bart Hartgers wrote:
> When writing a disc on certain lite-on dvd-writers (also rebadged as
> optiarc/LG/...) connected to a vt6420, the ATAPI CDB ends up in the
> datastream and on the disc, causing silent corruption. Delaying
> between sending the CDB and starting DMA seems to prevent this.
>
> I do not know if there are burners that do not suffer from this, but
> the patch should be safe for those as well.
>
> There are many reports of this issue, but AFAICT no solution was
> found before. For example:
> http://lkml.indiana.edu/hypermail/linux/kernel/0802.3/0561.html
>
> Signed-off-by: Bart Hartgers <[email protected]>
Ah... you found solution for this? That's great. This is one of the
three problems that have been lingering for years - the other two
being pata_ali ATAPI DMA problem and sata_sil data corruption problem.
I'll be ecstatic if this fix works. Just one thing, I don't think
we'll need a warning message there. It's useful during development
but it doesn't really provide any useful information afterwards.
Digging up the mailing list and cc'ing people who have reported this
problem. If you still have the affected systems, can you guys please
test the patch in the following message and see whether it fixes the
problem?
http://article.gmane.org/gmane.linux.kernel/939112/raw
Thanks a lot. :-)
--
tejun
On 01/19/2010 09:30 PM, Tejun Heo wrote:
> Hello,
>
> On 01/17/2010 08:56 AM, Bart Hartgers wrote:
>> When writing a disc on certain lite-on dvd-writers (also rebadged as
>> optiarc/LG/...) connected to a vt6420, the ATAPI CDB ends up in the
>> datastream and on the disc, causing silent corruption. Delaying
>> between sending the CDB and starting DMA seems to prevent this.
>>
>> I do not know if there are burners that do not suffer from this, but
>> the patch should be safe for those as well.
>>
>> There are many reports of this issue, but AFAICT no solution was
>> found before. For example:
>> http://lkml.indiana.edu/hypermail/linux/kernel/0802.3/0561.html
>>
>> Signed-off-by: Bart Hartgers<[email protected]>
>
> Ah... you found solution for this? That's great. This is one of the
> three problems that have been lingering for years - the other two
> being pata_ali ATAPI DMA problem and sata_sil data corruption problem.
> I'll be ecstatic if this fix works. Just one thing, I don't think
> we'll need a warning message there. It's useful during development
> but it doesn't really provide any useful information afterwards.
Another tiny nitpick about the patch, the unlikely() around the
DMA_TO_DEVICE check probably shouldn't be there - unlikely() is for
things that will always be either highly unlikely or a slow path,
neither of which really apply.
>
> Digging up the mailing list and cc'ing people who have reported this
> problem. If you still have the affected systems, can you guys please
> test the patch in the following message and see whether it fixes the
> problem?
>
> http://article.gmane.org/gmane.linux.kernel/939112/raw
>
> Thanks a lot. :-)
>
Hi,
2010/1/20 Robert Hancock <[email protected]>:
> On 01/19/2010 09:30 PM, Tejun Heo wrote:
>>
>> Hello,
>>
>> On 01/17/2010 08:56 AM, Bart Hartgers wrote:
>>>
>>> When writing a disc on certain lite-on dvd-writers (also rebadged as
>>> optiarc/LG/...) connected to a vt6420, the ATAPI CDB ends up in the
>>> datastream and on the disc, causing silent corruption. Delaying
>>> between sending the CDB and starting DMA seems to prevent this.
>>>
>>> I do not know if there are burners that do not suffer from this, but
>>> the patch should be safe for those as well.
>>>
>>> There are many reports of this issue, but AFAICT no solution was
>>> found before. For example:
>>> http://lkml.indiana.edu/hypermail/linux/kernel/0802.3/0561.html
>>>
>>> Signed-off-by: Bart Hartgers<[email protected]>
>>
>> Ah... you found solution for this? That's great. This is one of the
>> three problems that have been lingering for years - the other two
>> being pata_ali ATAPI DMA problem and sata_sil data corruption problem.
>> I'll be ecstatic if this fix works. Just one thing, I don't think
>> we'll need a warning message there. It's useful during development
>> but it doesn't really provide any useful information afterwards.
>
> Another tiny nitpick about the patch, the unlikely() around the
> DMA_TO_DEVICE check probably shouldn't be there - unlikely() is for things
> that will always be either highly unlikely or a slow path, neither of which
> really apply.
>
Well, the ata_sff_pause actually does a ndelay(400), and with today's
processors that would be a 'slow path', right?
Groeten,
Bart
>>
>> Digging up the mailing list and cc'ing people who have reported this
>> problem. If you still have the affected systems, can you guys please
>> test the patch in the following message and see whether it fixes the
>> problem?
>>
>> http://article.gmane.org/gmane.linux.kernel/939112/raw
>>
>> Thanks a lot. :-)
>>
>
>
--
Bart Hartgers - New e-mail: [email protected]
Hi,
2010/1/20 Tejun Heo <[email protected]>:
> Hello,
>
> On 01/17/2010 08:56 AM, Bart Hartgers wrote:
>> When writing a disc on certain lite-on dvd-writers (also rebadged as
>> optiarc/LG/...) connected to a vt6420, the ATAPI CDB ends up in the
>> datastream and on the disc, causing silent corruption. Delaying
>> between sending the CDB and starting DMA seems to prevent this.
>>
>> I do not know if there are burners that do not suffer from this, but
>> the patch should be safe for those as well.
>>
>> There are many reports of this issue, but AFAICT no solution was
>> found before. For example:
>> http://lkml.indiana.edu/hypermail/linux/kernel/0802.3/0561.html
>>
>> Signed-off-by: Bart Hartgers <[email protected]>
>
> Ah... you found solution for this? That's great. This is one of the
> three problems that have been lingering for years - the other two
> being pata_ali ATAPI DMA problem and sata_sil data corruption problem.
> I'll be ecstatic if this fix works. Just one thing, I don't think
> we'll need a warning message there. It's useful during development
> but it doesn't really provide any useful information afterwards.
>
Yes, you're right. I'll drop the printk_once and send another patch
for inclusion. However, for testing I found it very useful to make
sure that I got the right module loaded. So I figured it could be
helpful for the interpretation of success/failure reports.
Assuming that this patch works for other people as well, what is
prefered: resending both patches or just to make a new #2/2 (the
vt6420 one)?
Groeten,
Bart
> Digging up the mailing list and cc'ing people who have reported this
> problem. If you still have the affected systems, can you guys please
> test the patch in the following message and see whether it fixes the
> problem?
>
> http://article.gmane.org/gmane.linux.kernel/939112/raw
>
> Thanks a lot. :-)
>
> --
> tejun
>
--
Bart Hartgers - New e-mail: [email protected]
Hello,
On 01/20/2010 03:33 PM, Bart Hartgers wrote:
> Well, the ata_sff_pause actually does a ndelay(400), and with today's
> processors that would be a 'slow path', right?
unlikely() is used to mark very unlikely paths not the slow ones and I
don't really think DMA_TO_DEVICE would qualify as an unlikely path.
Thanks.
--
tejun
Hello,
On 01/20/2010 03:44 PM, Bart Hartgers wrote:
> Yes, you're right. I'll drop the printk_once and send another patch
> for inclusion. However, for testing I found it very useful to make
> sure that I got the right module loaded. So I figured it could be
> helpful for the interpretation of success/failure reports.
Oh yeah, for testing, having it there is a good idea.
> Assuming that this patch works for other people as well, what is
> prefered: resending both patches or just to make a new #2/2 (the
> vt6420 one)?
I think just re-doing the second patch should be enough.
Thanks.
--
tejun
Hi,
2010/1/20 Tejun Heo <[email protected]>:
> Hello,
>
> On 01/20/2010 03:33 PM, Bart Hartgers wrote:
>> Well, the ata_sff_pause actually does a ndelay(400), and with today's
>> processors that would be a 'slow path', right?
>
> unlikely() is used to mark very unlikely paths not the slow ones and I
> don't really think DMA_TO_DEVICE would qualify as an unlikely path.
>
Ok, I am convinced; I'll drop the unlikely.
Groeten,
Bart
> Thanks.
>
> --
> tejun
>
--
Bart Hartgers - New e-mail: [email protected]
On 01/20/2010 01:55 AM, Tejun Heo wrote:
> Hello,
>
> On 01/20/2010 03:44 PM, Bart Hartgers wrote:
>> Yes, you're right. I'll drop the printk_once and send another patch
>> for inclusion. However, for testing I found it very useful to make
>> sure that I got the right module loaded. So I figured it could be
>> helpful for the interpretation of success/failure reports.
>
> Oh yeah, for testing, having it there is a good idea.
>
>> Assuming that this patch works for other people as well, what is
>> prefered: resending both patches or just to make a new #2/2 (the
>> vt6420 one)?
>
> I think just re-doing the second patch should be enough.
Agreed... ping, Bart?
Jeff Garzik wrote:
> On 01/20/2010 01:55 AM, Tejun Heo wrote:
>> Hello,
>>
>> On 01/20/2010 03:44 PM, Bart Hartgers wrote:
>>> Yes, you're right. I'll drop the printk_once and send another patch
>>> for inclusion. However, for testing I found it very useful to make
>>> sure that I got the right module loaded. So I figured it could be
>>> helpful for the interpretation of success/failure reports.
>>
>> Oh yeah, for testing, having it there is a good idea.
>>
>>> Assuming that this patch works for other people as well, what is
>>> prefered: resending both patches or just to make a new #2/2 (the
>>> vt6420 one)?
>>
>> I think just re-doing the second patch should be enough.
>
> Agreed... ping, Bart?
>
Hi Jeff,
I was waiting for some feedback on whether this patch actually solves
the problem for others as well. Unfortunately, I didn't get any response
so far, that's why I didn't resend the patch yet. But I guess it doesn't
make sense to wait any longer, so I'll redo the patch and send it in a
separate mail in a few minutes.
(I also tried searching for people suffering from this bug in the past 3
months, and couldn't find any. I _did_ see some recent posts on various
bug-lists by Tejun asking to test my patch, but again no response.)
Groeten,
Bart