Tuesday, 9 March 2010

Slow boot due to libata problems with mwdma2

I use a lot of old kit. Recent linux kernels are starting to have problems with old kit. An old laptop harddrive suddenly started to 'freeze' during bootup. The kernel was trying to access it with various DMA modes, none of which seemed to work. Finally it would fall back to PIO, and work, but this was annoying, because it meant the laptop took ages to boot.

I'm attaching a dump of what the kernel spewed out while it was trying to talk to the hard-drive. The main thing to look for if you have the same problem is:

[ 23.107017] ata2: soft resetting link
[ 23.259250] ata2.00: configured for MWDMA1



and it will gradually work thorugh the possiblities until

[ 65.107128] ata2: soft resetting link
[ 65.262031] ata2.00: configured for PIO4

What you want to do, of course, is tell the kernel 'just go for PIO4 straight away', and at least it will boot quickly.

Turns out you can!

I added 'libata.force=2:pio4' to my kernel 'append' line. I use lilo to boot my system, so it's as simple as:

append="libata.force=2:pio4"

added to my lilo.conf

This tells the bit of the kernel that deals with harddrives (libata) to use pio4 (not sure what that is, but it works, whereas mwdma2, which I'm also unsure what it is, doesn't) on the second 'ata' interface.

I gathered that it was the second ata interface from all the bootup messages about 'ata2'

And it works fine, if, I suspect, rather slowly.

So if you're seeing the following in your logs, you probably want to do this.


[ 1.671100] scsi 2:0:0:0: Direct-Access ATA TOSHIBA MK1403MA D3.0 PQ: 0 ANSI: 5
[ 1.677462] sd 2:0:0:0: [sda] 2818368 512-byte logical blocks: (1.44 GB/1.34 GiB)
[ 1.678301] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 1.682247] sd 2:0:0:0: [sda] Write Protect is off
[ 1.682439] sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 1.684011] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 1.687772] sda: sda1 sda4
[ 1.808661] sd 2:0:0:0: [sda] Attached SCSI disk
[ 23.105610] ata2: lost interrupt (Status 0x5)
[ 23.105777] ata2: drained 4 bytes to clear DRQ.
[ 23.105848] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 23.105989] scsi 3:0:0:0: CDB: Inquiry: 12 00 00 00 60 00
[ 23.106497] ata2.00: cmd a0/01:00:00:60:00/00:00:00:00:00/a0 tag 0 dma 96 in
[ 23.106520] res 40/00:02:00:24:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 23.106841] ata2.00: status: { DRDY }
[ 23.107017] ata2: soft resetting link
[ 23.259250] ata2.00: configured for MWDMA1
[ 23.259684] ata2: EH complete
[ 44.105592] ata2: lost interrupt (Status 0x5)
[ 44.105752] ata2: drained 4 bytes to clear DRQ.
[ 44.105815] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 44.105954] scsi 3:0:0:0: CDB: Inquiry: 12 00 00 00 60 00
[ 44.106456] ata2.00: cmd a0/01:00:00:60:00/00:00:00:00:00/a0 tag 0 dma 96 in
[ 44.106480] res 40/00:02:00:24:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 44.106798] ata2.00: status: { DRDY }
[ 44.106970] ata2: soft resetting link
[ 44.259253] ata2.00: configured for MWDMA1
[ 44.259674] ata2: EH complete
[ 65.105597] ata2: lost interrupt (Status 0x5)
[ 65.105758] ata2: drained 4 bytes to clear DRQ.
[ 65.105819] ata2.00: limiting speed to PIO4
[ 65.105946] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 65.106086] scsi 3:0:0:0: CDB: Inquiry: 12 00 00 00 60 00
[ 65.106655] ata2.00: cmd a0/01:00:00:60:00/00:00:00:00:00/a0 tag 0 dma 96 in
[ 65.106679] res 40/00:02:00:24:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 65.106954] ata2.00: status: { DRDY }
[ 65.107128] ata2: soft resetting link
[ 65.262031] ata2.00: configured for PIO4
[ 65.262467] ata2: EH complete

4 comments:

  1. Hey, thanks for the tip! Finally can boot my old computer up without having to wait for 2 minutes :)

    ReplyDelete
  2. Glad to hear it was some use to someone!

    Colum

    ReplyDelete
  3. Thanks dude! Worked a treat!

    ReplyDelete
  4. Do you find your windows system become more and more slowly after used it a few month, the reason is your windows registry stored much rubbish and it becomes bloated. To solve this problem, you can use windows registry cleaners software.

    ReplyDelete