ata_piix used instead of AHCI for Mac Pro

Bug #96692 reported by Shaw Terwilliger
22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Expired
Undecided
Unassigned
linux-source-2.6.20 (Ubuntu)
Won't Fix
Wishlist
Kyle McMartin

Bug Description

Binary package hint: linux-source-2.6.20

I'm using a Mac Pro running Feisty (2007/03/26), which was previously running Edgy. There is a single WD Raptor disk in the box and when 2.6.20-12 boots it prefers the ata_piix driver instead of AHCI, which causes high CPU usage when the disk is busy. It's also slower (especially in one pathological case with Eclipse/Java 6/xfs). Edgy's 2.6.17 kernel correctly used the AHCI driver. I don't know if this is a regression or a policy decision for Feisty.

Although I'm not using the actual Boot Camp application to start Linux (I just formatted the disk PC-style and put GRUB on it and it magically boots), it's probably correct to say I'm using the Boot Camp BIOS emulation in the Mac's firmware. As far as I know there isn't a way to make the BIOS/firmware set up the disk in AHCI mode, so it's up to Linux to detect this correctly. Edgy used to, with the drawback that my DVD-ROM didn't work right.

I have now unplugged my DVD-ROM drive from the power and IDE cables to simplify things (I would rather have my disk speed back).

I'll attach two dmesg outputs. One is from Edgy with 2.6.17-10-generic and one is from Feisty with 2.6.20-12-generic. I can't test 2.6.20-13 now (see bug 96480).

I think my PATA/SATA controller suffers from the Intel "combined mode" driver detection problem that has been addressed in newer kernels. Maybe there's a fix to backport.

Revision history for this message
Shaw Terwilliger (sterwill) wrote :
Revision history for this message
Shaw Terwilliger (sterwill) wrote :
Revision history for this message
Christian Kellner (gicmo) wrote :

This is acutally a dup of bug 64433 I filed a while ago. I am pretty sure it was fixed at some point but is now back again. The slow disk speed is damn annoying.

Revision history for this message
Shaw Terwilliger (sterwill) wrote : Re: [Bug 96692] Re: ata_piix used instead of AHCI for Mac Pro

Christian Kellner wrote:
> This is acutally a dup of bug 64433 I filed a while ago. I am pretty
> sure it was fixed at some point but is now back again. The slow disk
> speed is damn annoying.

I have only tracked Feisty for about two weeks, and my drives performed
great with Edgy and 2.6.17. Actually took me a while to notice that
certain things were a little slower. One thing is much slower: I have
an XFS partition where I keep an Eclipse workspace. Eclipse (running
with Sun's Java 6 VM) writes a small file when the build process is
done, deletes it, and re-writes it about a dozen times (it's some
Eclipse metadata file about property indexes that I don't completely
understand--not part of my project). There was no apparent delay doing
this under 2.6.17/ahci, but with 2.6.20/piix it takes about 5 seconds
and (one) CPU is hammered the whole time. And Eclipse does incremental
compilation all the time (whenever you save a resource).

Java thread dumps during the big pause point to a thread waiting to
close the file stream or channel, which shouldn't take that long for a
200 byte file.

--
Shaw Terwilliger <`echo sterwill1io2nu | tr 12 @.`>

Revision history for this message
Christian Kellner (gicmo) wrote :

You mentioned something about combined mode issue and that might be fixed upstream? Do you have any details or pointers? The fix that I did for 2.6.17 and that got committed (see bug 64433) was to add the ID to the list of ahci chipsets. I looked and that id is still missing upstream (2.6.21-rc4). Did they fix it some other way? It's really sad that my uber-fast MacPro machine is outperformed by my X60 tablet with its little notebook harddrive ;-(

Revision history for this message
Kyle McMartin (kyle) wrote :

Can you please post the "lspci -vvnn" from feisty so we can see what the device is claiming to be?

Cheers,
 Kyle

Kyle McMartin (kyle)
Changed in linux-source-2.6.20:
assignee: nobody → kyle
status: Unconfirmed → Needs Info
Revision history for this message
Shaw Terwilliger (sterwill) wrote :

I'm not sure if the combined mode stuff even applies for the Mac Pro's IDE controller. I read about the patch that added the ID to the AHCI chipsets, but I didn't test it. Now that you've confirmed it works (or worked), the best fix would be to add the ID to the Feisty kernel.

Revision history for this message
Christian Kellner (gicmo) wrote :

Sure. Here you go!

Revision history for this message
Christian Kellner (gicmo) wrote :

----
00:1f.1 IDE interface [0101]: Intel Corporation 631xESB/632xESB IDE Controller [8086:269e] (rev 09) (prog-if 8f [Master SecP SecO PriP PriO])
 Subsystem: Intel Corporation Unknown device [8086:7270]
 Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
 Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
 Latency: 0
 Interrupt: pin A routed to IRQ 20
 Region 0: I/O ports at 30e8 [size=8]
 Region 1: I/O ports at 30fc [size=4]
 Region 2: I/O ports at 30e0 [size=8]
 Region 3: I/O ports at 30f8 [size=4]
 Region 4: I/O ports at 30c0 [size=16]

00:1f.2 IDE interface [0101]: Intel Corporation 631xESB/632xESB/3100 Chipset SATA Storage Controller IDE [8086:2680] (rev 09) (prog-if 8f [Master SecP SecO PriP PriO])
        Subsystem: Intel Corporation Unknown device [8086:7270]
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0
        Interrupt: pin B routed to IRQ 21
        Region 0: I/O ports at 30d8 [size=8]
        Region 1: I/O ports at 30f4 [size=4]
        Region 2: I/O ports at 30d0 [size=8]
        Region 3: I/O ports at 30f0 [size=4]
        Region 4: I/O ports at 3020 [size=16]
        Region 5: Memory at 52f04400 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [70] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-
---

This time with "sudo" so the Capabilities are shown instead of "Permission denied" ;-)
So yeah, 2680 is still missing on the ahci device list. Not sure why because IIRC that is also in the spec for esb2.

Revision history for this message
Matthew Garrett (mjg59) wrote :

New Intel IDs aren't being added to ahci because ahci controllers have their own PCI class ID (0x010601) which ahci can key off. Apple seem to have declined to program yours as an ahci device - it's still claiming to be an IDE device (0x0101), and so ata_piix is the correct driver to be using.

Of course, this ignores the fact that in reality we'd prefer to use ahci. The "easiest" way to do this would probably be to add a PCI quirk that reprograms it, but Apple seem to have declined to provide an Apple subsystem ID to key off and argh it hurts.

Revision history for this message
Kyle McMartin (kyle) wrote :

Patch in testing to fix this issue.

Revision history for this message
Norman Molhant (nwm) wrote :

Same problem/bug/feature found on Supermicro's X7DBE+ motherboard: the Intel ESB2 IDE+SATA controller gets the ata_piix driver instead of the ahci driver under Fiesty (Ubuntu kernel 2.6.20-15-generic). On top of making the IDE controller flaky, this removes 1/3 of the SATA controller: the ata_piix dirver recognizes only 4 SATA drives instead of 6. :( :(
Here are the two salient lines of the lspci -vvnn report:

 IDE interface [0101]: Intel Corporation 631xESB/632xESB IDE Controller [8086:269e] (rev 09) (prog-if 8f [Master SecP SecO PriP PriO])
 IDE interface [0101]: Intel Corporation 631xESB/632xESB/3100 Chipset SATA Storage Controller IDE [8086:2680] (rev 09) (prog-if 8f [Master SecP SecO PriP PriO])

Exactly the same problem as reported by Shaw hereabove.

I work with a small ISP in Canada, where we use this Supermicro motherboard in our servers, with two dual-core Xeon 5150 apiece. Losing 2 of our 6 SATA drive is as real problem as having our servers running way too slow. (We are using KVM + kqemu in these servers.)
I've been trying to patch the driver as mentionned by Christian hereabove, using the source I got from
 apt-get install linux-source-2.6.20
and the .config I got from
 apt-get install linux-headers-2.6.20-15-generic
but I keep getting strangely bloated modules (I guess all symbols are still in there), many times bigger than the modules that came with the install cdrom (Ubuntu 7.04 server for x86_64)

Any help would be welcome.
Norman.

Revision history for this message
Stephen Touset (stephen-touset) wrote :

Has this been fixed?

It was reported that there was a patch in testing, but I've seen no activity since. This seems to still be in Gutsy.

Revision history for this message
Shaw Terwilliger (sterwill) wrote :

Stephen Touset wrote:
> Has this been fixed?
>
> It was reported that there was a patch in testing, but I've seen no
> activity since. This seems to still be in Gutsy.

The bug is still present in Gutsy as of a previous beta (I'm about 2
months out-of-date). I can retest this week with the latest kernel, but
as far as I know it was never fixed in a released Ubuntu kernel.

--
Shaw Terwilliger <`echo sterwill1io2nu | tr 12 @.`>

Revision history for this message
Matthew Garrett (mjg59) wrote :

The firmware programs the sata controller into piix mode, not ahci mode. On this specific hardware, the ahci driver is able to reprogram it - however, that isn't guaranteed in general, and attempts to do so have led to unfortunate behaviour like missing CD drives. Right now, the easiest thing to do would be to convince Apple to program the device into AHCI mode.

Changed in linux-source-2.6.20:
importance: Undecided → Wishlist
status: Incomplete → Confirmed
Revision history for this message
Shaw Terwilliger (sterwill) wrote :

Matthew Garrett wrote:
> The firmware programs the sata controller into piix mode, not ahci mode.
> On this specific hardware, the ahci driver is able to reprogram it -
> however, that isn't guaranteed in general, and attempts to do so have
> led to unfortunate behaviour like missing CD drives. Right now, the
> easiest thing to do would be to convince Apple to program the device
> into AHCI mode.

I doubt convincing Apple to release new firmware will be "easy," even if
it's the best solution. I have no idea how to go about that. Adding a
single line to ahci.c is definitely easy, though it may be a hack.

With a status of Wishlist, we'll have another Ubuntu release where this
problem will be left unsolved. This is an old bug (actually a
regression--it used to work!) and I wish it could be solved in a way
that didn't require constant kernel patching on the behalf of all Mac
Pro users.

--
Shaw Terwilliger <`echo sterwill1io2nu | tr 12 @.`>

Revision history for this message
Matthew Garrett (mjg59) wrote :

Just adding the ID to ahci.c would break a large number of other machines, so while easy it's not possible.

Revision history for this message
Shaw Terwilliger (sterwill) wrote :

Matthew Garrett wrote:
> Just adding the ID to ahci.c would break a large number of other
> machines, so while easy it's not possible.

I spent a few hours one day trying to reprogram the controller using
setpci from initramfs and didn't have any luck. It appeared that once
the controller had its mode set (by the Apple firmware?), the registers
were read-only.

A boot-time solution like this would make me very happy as a Mac Pro
user, if it were possible (and it may be). I'd volunteer to
write/submit/maintain a Mac Pro AHCI package that provided the initramfs
scripts in this case.

--
Shaw Terwilliger <`echo sterwill1io2nu | tr 12 @.`>

Revision history for this message
Christian Kellner (gicmo) wrote :

I have a sata based dvdrom on the only available sata port and of course it is one of the ports that don't work due to that bug, so my DVD drive is not recognized due to that bug. /-:

Revision history for this message
Christian Kellner (gicmo) wrote :

There exists a work-around by patching grub stage1. Find the patch and the binary here: http://boeglin.org/blog/. I did it here and its working like a charm.

Revision history for this message
Shaw Terwilliger (sterwill) wrote :

Christian Kellner wrote:
> There exists a work-around by patching grub stage1. Find the patch and
> the binary here: http://boeglin.org/blog/. I did it here and its working
> like a charm.

This is a neat hack. If I get a morning or afternoon clear (with a boot
disc handy), I might try it. I hacked on trying to do it via initramfs,
but I think the PCI configuration was locked down at that point (no
changes I made to the controller would stick).

I still wish there were a good long-term solution for the kernel. If it
was as simple as writing some smart detection code, I'd do it. But it
appears the hardest part of the problem is understanding just what Apple
did to the hardware classification that makes it incompatible with the
standard IDs.

--
Shaw Terwilliger <`echo sterwill1tinfig2com | tr 12 @.`>

Revision history for this message
Launchpad Janitor (janitor) wrote : This bug is now reported against the 'linux' package

Beginning with the Hardy Heron 8.04 development cycle, all open Ubuntu kernel bugs need to be reported against the "linux" kernel package. We are automatically migrating this bug to the new "linux" package. However, development has already began for the upcoming Intrepid Ibex 8.10 release. It would be helpful if you could test the upcoming release and verify if this is still an issue - http://www.ubuntu.com/testing . If the issue still exists, please update this report by changing the Status of the "linux" task from "Incomplete" to "New". We appreciate your patience and understanding as we make this transition. Thanks!

Revision history for this message
Leann Ogasawara (leannogasawara) wrote :

The Ubuntu Kernel Team is planning to move to the 2.6.27 kernel for the upcoming Intrepid Ibex 8.10 release. As a result, the kernel team would appreciate it if you could please test this newer 2.6.27 Ubuntu kernel. There are one of two ways you should be able to test:

1) If you are comfortable installing packages on your own, the linux-image-2.6.27-* package is currently available for you to install and test.

--or--

2) The upcoming Alpha5 for Intrepid Ibex 8.10 will contain this newer 2.6.27 Ubuntu kernel. Alpha5 is set to be released Thursday Sept 4. Please watch http://www.ubuntu.com/testing for Alpha5 to be announced. You should then be able to test via a LiveCD.

Please let us know immediately if this newer 2.6.27 kernel resolves the bug reported here or if the issue remains. More importantly, please open a new bug report for each new bug/regression introduced by the 2.6.27 kernel and tag the bug report with 'linux-2.6.27'. Also, please specifically note if the issue does or does not appear in the 2.6.26 kernel. Thanks again, we really appreicate your help and feedback.

Revision history for this message
Shaw Terwilliger (sterwill) wrote :

I just had an opportunity to upgrade from 8.10 to 9.04 Beta on my Mac Pro (actually did an installation to a new disk, not an upgrade), and the kernel that came with it (2.6.28-11-generic) still has this problem: piix is used instead of AHCI, and the drive is pretty slow.

Revision history for this message
Kai Krueger (kakrueger) wrote :

I am having the same issue on my macbook. 9.04 beta is using the ata_piix driver instead of the AHCI driver. As others mentioned earlier in this thread, the problem seems to be that the Apple bios emulator puts the controler into legacy mode (for which the ata_piix probably is the correct driver). ( http://forum.onmac.net/showthread.php?t=2739 has a reasonable summery of the problem and a solution). In a previous install of ubuntu, I had tried the fix using the modified stage1 grub and it worked perfectly fine. However, I would rather not install code into my MBR from a random untrusted webpage again and thus I would prefer, If ubuntu could provide a correctly patched stage1 for grub that reenables the AHCI mode on the MacBook. It is also necessary to make sure that you have the correct one (either RAID version or the AHCI version) and I wasn't sure which version the ones found on the various websites are.

Would it be possible for Ubuntu to provide this modified grub and perhaps add some comments about this issue on the documentation pages for running Ubuntu on a intel mac?

Revision history for this message
Anton (avelo) wrote :

Happens also for with Macbook2,1 and latest Karmic upgraded to 20091016 (2.6.31-14)

Computer is very very very slow when doing I/O (basically bloated even when copying some files)

uname -a:
Linux xxxxx 2.6.31-14-generic #47-Ubuntu SMP Thu Oct 15 02:08:08 UTC 2009 i686 GNU/Linux

dmesg:
[ 0.869569] ata_piix 0000:00:1f.1: version 2.13
[ 0.869613] ata_piix 0000:00:1f.1: power state changed by ACPI to D0
[ 0.869621] alloc irq_desc for 18 on node -1
[ 0.869624] alloc kstat_irqs on node -1
[ 0.869629] ata_piix 0000:00:1f.1: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[ 0.869672] ata_piix 0000:00:1f.1: setting latency timer to 64
[ 0.869787] scsi0 : ata_piix
[ 0.869958] scsi1 : ata_piix
[ 0.870573] ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x20b0 irq 14
[ 0.870577] ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x20b8 irq 15
[ 0.870600] alloc irq_desc for 19 on node -1
[ 0.870602] alloc kstat_irqs on node -1
[ 0.870607] ata_piix 0000:00:1f.2: PCI INT B -> GSI 19 (level, low) -> IRQ 19
[ 0.870613] ata_piix 0000:00:1f.2: MAP [ P0 P2 -- -- ]
[ 0.998987] ACPI: Battery Slot [BAT0] (battery present)
[ 1.035298] ata_piix 0000:00:1f.2: setting latency timer to 64
[ 1.035430] scsi2 : ata_piix
[ 1.035535] scsi3 : ata_piix
[ 1.036519] ata3: SATA max UDMA/133 cmd 0x20c8 ctl 0x20ec bmdma 0x20a0 irq 19
[ 1.036522] ata4: SATA max UDMA/133 cmd 0x20c0 ctl 0x20e8 bmdma 0x20a8 irq 19

lspci -vvnn:
00:1f.1 IDE interface [0101]: Intel Corporation 82801G (ICH7 Family) IDE Controller [8086:27df] (rev 02) (prog-if 8a [Master SecP PriP])
 Subsystem: Intel Corporation Device [8086:7270]
 Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
 Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
 Latency: 0
 Interrupt: pin A routed to IRQ 18
 Region 0: I/O ports at 01f0 [size=8]
 Region 1: I/O ports at 03f4 [size=1]
 Region 2: I/O ports at 0170 [size=8]
 Region 3: I/O ports at 0374 [size=1]
 Region 4: I/O ports at 20b0 [size=16]
 Kernel driver in use: ata_piix

00:1f.2 IDE interface [0101]: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller [8086:27c4] (rev 02) (prog-if 8f [Master SecP SecO PriP PriO])
 Subsystem: Intel Corporation Device [8086:7270]
 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
 Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
 Latency: 0
 Interrupt: pin B routed to IRQ 19
 Region 0: I/O ports at 20c8 [size=8]
 Region 1: I/O ports at 20ec [size=4]
 Region 2: I/O ports at 20c0 [size=8]
 Region 3: I/O ports at 20e8 [size=4]
 Region 4: I/O ports at 20a0 [size=16]
 Region 5: Memory at 90445000 (32-bit, non-prefetchable) [size=1K]
 Capabilities: <access denied>
 Kernel driver in use: ata_piix

Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

This bug report was marked as Incomplete and has not had any updated comments for quite some time. As a result this bug is being closed. Please reopen if this is still an issue in the current Ubuntu release http://www.ubuntu.com/getubuntu/download . Also, please be sure to provide any requested information that may have been missing. To reopen the bug, click on the current status under the Status column and change the status back to "New". Thanks.

[This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: kj-expired
Changed in linux (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.