Re: [issue1158] Problems with a SATA DVD burner

Previous thread: [issue1157] tube by Derek Hval on Friday, October 31, 2008 - 11:45 am. (1 message)

Next thread: [issue1159] fdisk: If no partition table, partition 4 is a whole-disk DragonFly partition? (plus bonus bug) by Joe "Floid" Kanowitz on Monday, November 3, 2008 - 12:17 am. (3 messages)
From: Steve O'Hara-Smith
Date: Saturday, November 1, 2008 - 2:43 pm

Hi,

	My trusty (well not so trusty) DVD burner started acting up
(intermittently refusing to eject or load) so I had to pick up a
replacement, the only one available locally at a sane price was a SATA unit
so with a promise that I could return it I bought it and put it in my
workstation box and booted DragonFly.

	As soon as the atapicam driver got to it an interrupt storm started
and the livelock went on, and off and on and off and ... well you get the
idea - 80% CPU utilisation in interrupt. A little research suggested DMA
problems as a possible cause - setting hw.ata.atapi_dma=0 in loader.conf
didn't help.

	More research suggested a problem with having both atapicd and
atapicam loaded, so I built a kernel without atapicd. That got rid of the
livelock and the burner worked. Then I remembered that DMA was off so I
reenabled that and rebooted, the livelock promptly came back.

	I haven't tried atapicd with DMA, but as far as I know there's no
software that will write a DVD through atapicd so that's not really an
option.

	Relevant bits of verbose boot dmesg are very odd as they seem to
show that two devices are on ata4 one of them a UDMA133 hard disc, the
other the SATA DVD burner.

	For now it's usable but not ideal, does anyone have any suggestions
as to how I might go about getting DMA working for this drive ?

Copyright (c) 2003-2008 The DragonFly Project.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
DragonFly 2.1.0-PREVIEW #51: Sat Nov  1 18:26:23 GMT 2008
    root@df1.marelmo.com:/usr/obj/usr/src/sys/DF1_NATA
Calibrating clock(s) ... TSC clock: 2002632654 Hz, i8254 clock: 1193227 Hz
CLK_USE_I8254_CALIBRATION not specified - using default frequency
CLK_USE_TSC_CALIBRATION not specified - using old calibration method
CPU: AMD Athlon(tm) 64 Processor 3200+ (2002.58-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x10ff0  ...
From: Vincent Stemen
Date: Saturday, November 15, 2008 - 2:43 pm

I was a bit surprised that I saw no replies to this.  Here is my 2 cents
worth.

After having just bought a new SATA DVD burner and SATA card I ran in
this same problem and posted about it back on Jul 13, 2008 just before
the 2.0 release.  I finally ended up buying another new non-SATA burner
in order to be able use the machine.  Matt said he was pretty sure this
is an issue with the NATA driver.  Hasso Tepper said he has seen that
many times and thinks it is a bug in the hardware.  I don't think it is
since we have encountered it with various different hardware.  

Also, we tested with the freebsd-7.0 live file system CD on one of our
machines and it worked fine.  No livelock or other error messages.

To repeat some of my earlier posting on the subject, we have tested on
two different Intel machines, and an AMD64 machine, with an add on PCI
SiI 3512 SATA150 controller card.  We also tested with the on board VIA
6420 SATA150 controller on the AMD64 machine.  The problem exists in all
cases.  We have also tested with 3 different SATA CD drives.

In addition, we had the same problem with a friends laptop (I don't
remember the type) which had an SATA DVD, causing us to not be able to
run DFBSD on his laptop.

We have found no cases where SATA optical drives have been able to run
on Dragonfly with hardware available to us.  

With SATA drives becoming dominant this is becoming a serious show
stopper bug.  It is concerning that it is lingering for so long.  I hope
this becomes a priority.

From: Hasso Tepper
Date: Sunday, November 16, 2008 - 10:34 am

Please test this patch.


-- 
Hasso Tepper
From: Steve O'Hara-Smith
Date: Sunday, November 16, 2008 - 2:28 pm

Hi,

	It nearly works - I booted with atapicam and no atapicd, burned a
disc and read it back with DMA on with no troubles at all. Then I tried
burning a second disc and the interrupt storm started up just like before
with the livelock going on and off.

On Sun, 16 Nov 2008 17:37:01 -0000


-- 
C:>WIN                                      |   Directable Mirror Arrays
The computer obeys and wins.                | A better way to focus the sun
You lose and Bill collects.                 |    licences available see
                                            |    http://www.sohara.org/
From: Hasso Tepper
Date: Sunday, November 16, 2008 - 3:30 pm

It might be different issue :(. What software you used to burn disc?


-- 
Hasso Tepper
From: Steve O'Hara-Smith
Date: Sunday, November 16, 2008 - 6:45 pm

On Mon, 17 Nov 2008 00:30:26 +0200

	I used wodim, I can try cdrecord.

-- 
C:>WIN                                      |   Directable Mirror Arrays
The computer obeys and wins.                | A better way to focus the sun
You lose and Bill collects.                 |    licences available see
                                            |    http://www.sohara.org/
From: Hasso Tepper
Date: Monday, November 17, 2008 - 12:52 am

Please test HEAD.

-- 
Hasso Tepper
From: Hasso Tepper
Date: Monday, November 17, 2008 - 5:12 am

Follow up ...

* My SATA CD/DVD writers fine now for reading data at least. Ie. I can 
  install DragonFly with all these.

* The main part of fix I committed today was to disable DMA in atapicam 
  for all commands except READ_* and WRITE_*. It isn't correct fix of 
  course, but rather workaround. My (rather wild) guess is that alignment
  is the real problem. Little googling gives some hints that for SATA 
  ATAPI DMA alignment padding DMA transfers to the 4 bytes boundary is 
  required, but the current ATA code only quarantees 2 bytes boundary.
  I haven't investigated it too closely though and don't have time for 
  that now.

  [See http://osdir.com/ml/ide/2005-07/msg00261.html for example.]

* Cdrecord/wodim hanging seems to be a different issue. Attempting to 
  write second DVD (yes, the first one works) gives me this:

  Nov 17 13:33:09 hasso sudo:    hasso : TTY=ttyp6 ; PWD=/home/hasso ; 
    USER=root ; COMMAND=/usr/pkg/bin/cdrecord -v test.img
  Nov 17 13:33:10 hasso kernel: acd0: FAILURE - READ_BUFFER ILLEGAL 
    REQUEST asc=0x24 ascq=0x00
  Nov 17 13:33:10 hasso kernel: acd0: FAILURE - READ_BUFFER ILLEGAL 
    REQUEST asc=0x24 ascq=0x00
  Nov 17 13:33:10 hasso kernel: ata4: FAILURE - non aligned DMA transfer 
    attempted
  Nov 17 13:33:10 hasso kernel: acd0: setting up DMA failed


-- 
Hasso Tepper
From: Steve O'Hara-Smith
Date: Monday, November 17, 2008 - 5:31 am

Hi,

	Same result on HEAD as with the patch - interrupt storm starts with
the second burn and continues as long as something tries to talk to the
drive. This is a big improvement over the original state of affairs where
the interrupt storm started during booting and didn't go away at all. It
may well be enough for some chipsets - wider testing is I think in order.

	Also I get interrupt storms if I boot with atapicd enabled and no
atapicam whether or not I have DMA enabled.

	I now have a hardware workaround (just arrived in the post) in the
shape of a bi-directional PATA/SATA adaptor but I'll happily test any
patches or updates.

	Thank you very much for looking at this.

On Mon, 17 Nov 2008 07:55:03 -0000


-- 
C:>WIN                                      |   Directable Mirror Arrays
The computer obeys and wins.                | A better way to focus the sun
You lose and Bill collects.                 |    licences available see
                                            |    http://www.sohara.org/
From: Vincent Stemen
Date: Wednesday, November 19, 2008 - 12:44 am

Hi Hasso.  Thanks for working on the problem.

Here is our results from testing HEAD.

It definitely works a lot better than before.  We were able to write
to CDRW's and DVD's using cdrecord.  Burning a second disc also worked.
We did not get the interrupt storm like Steve did.

The tests were run on an Intel processor with a SiI 3512 SATA150 add on card.
Cdrecord-Clone 2.01.01a04

Even though it works, there were some error messages.

These are from dmesg.

   acd1: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
   acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00

  atapci0: <SiI 3512 SATA150 controller> port 0xd400-0xd40f,0xd480-0xd483,0xd800-0
  xd807,0xd880-0xd883,0xdc00-0xdc07 mem 0xff8ffc00-0xff8ffdff irq 10 at device 0.0
   on pci1
   ata2: <ATA channel 0> on atapci0
   intr 10 at 40001/40000 hz, livelocked limit engaged!
   intr 10 at 0/20000 hz, livelock removed
   acd0: DVDR <TSSTcorp DVD+/-RW TS-H653A/D400> at ata2-master SATA150
   ata3: <ATA channel 1> on atapci0
  
Which all seem to have been generated at boot time.  Notice there was one 
pair of livelock limit messages, but that was it.

There were also some errors generated on the console when writing.

CDRW write errors
=================
 acd0: FAILURE - READ_DVD_STRUCTURE ILLEGAL REQUEST asc=0x30 ascq=0x02
 acd0: FAILURE - READ_BUFFER ILLEGAL REQUEST asc=0x24 ascq=0x00
 acd0: FAILURE - REZERO ILLEGAL REQUEST asc=0x20 ascq=0x00
 acd0: FAILURE - READ_TOC ILLEGAL REQUEST asc=0x24 ascq=0x00
 acd0: FAILURE - MODE_SELECT_BIG ILLEGAL REQUEST asc=0x26 ascq=0x00

DVD write errors
================
 acd0: FAILURE - READ_BUFFER ILLEGAL REQUEST asc=0x24 asc q=0x00
 acd0: FAILURE - REZERO ILLEGAL REQUEST asc=0x20 ascq=0x00
 acd0: FAILURE - READ_TOC ILLEGAL REQUEST asc=0x24 ascq=0x00
 acd0: FAILURE - READ_TRACK_INFO ILLEGAL REQUEST asc=0x24 ascq=0x00
 acd0: FAILURE - READ_TRACK_INFO ILLEGAL REQUEST asc=0x24 ascq=0x00
 acd0: FAILURE - MODE_SELECT_BIG ILLEGAL REQUEST asc=0x26 ...
From: Hasso Tepper
Date: Wednesday, November 19, 2008 - 12:57 am

These are debug messages and can be ignored. I left this in to get more 
info about storms/locks Steve and me is seeing. Especially cdrecord and 
friends are testing many commands on drives and some of them just fail 
because drive doesn't support them. I'll switch this back of once we have 


Many thanks to you for testing! ;)


-- 
Hasso Tepper
From: Hasso Tepper
Date: Monday, December 1, 2008 - 6:16 am

To clarify the state of the bug ...

The issue with SATA CD/DVD devices causing interrupt storms etc are solved 
in both master and 2.0 branch. There are still issue with recording 
though:

acd0: FAILURE - READ_BUFFER ILLEGAL REQUEST asc=0x24 ascq=0x00
acd0: FAILURE - READ_BUFFER ILLEGAL 
ata4: FAILURE - non aligned DMA transfer 
acd0: setting up DMA failed

I think that it's not specific to SATA CD/DVD writers though. And I 
thought Matt already fixed the issues with non aligned DMA transfers? Or 
was it in different path?

I don't have time and knowledge to work on this, but I think that it's 
showstopper for 2.2. Any takers?


-- 
Hasso Tepper
From: Steve O'Hara-Smith
Date: Monday, December 1, 2008 - 8:39 am

Hi,

	I'm not so sure about this - I just tried your 19 Nov version (I
didn't notice the commit earlier sorry), it gives me an interrupt storm on
boot while the 17 Nov version (DMA only on read/write) does not - but will
only burn once.

	There was an issue with non aligned DMA transfers that Matt fixed
(with changes to physio() around on 10 August). From the commit message it
allocates a bounce buffer if the buffer is not 16 byte aligned - I don't
understand the code well enough to see how the bounce buffer is aligned but
presumably it is at least 16 byte.

On Mon, 1 Dec 2008 15:16:05 +0200


-- 
C:>WIN                                      |   Directable Mirror Arrays
The computer obeys and wins.                | A better way to focus the sun
You lose and Bill collects.                 |    licences available see
                                            |    http://www.sohara.org/
From: Hasso Tepper (via DragonFly issue tracker)
Date: Sunday, February 1, 2009 - 12:46 am

Hasso Tepper <hasso@estpak.ee> added the comment:

My problems were fixed even before that - with 969f6a6d.

----------
status: chatting -> resolved

_____________________________________________________
DragonFly issue tracker <bugs@lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1158>
_____________________________________________________
Previous thread: [issue1157] tube by Derek Hval on Friday, October 31, 2008 - 11:45 am. (1 message)

Next thread: [issue1159] fdisk: If no partition table, partition 4 is a whole-disk DragonFly partition? (plus bonus bug) by Joe "Floid" Kanowitz on Monday, November 3, 2008 - 12:17 am. (3 messages)