# Disable ahci For Single Controller



## thavinci (Dec 10, 2010)

Good Day.

I'm hopeing someone can help me out here.

I have been using ahci without problem for a while now with my on-board controller with 6 Drives in zfs raidz.


```
cat /boot/loader.conf
autoboot_delay="1"
aio_load="YES"
ahci_load="YES"
atapicam_load="YES"
vm.kmem_size="6144M"
#vfs.zfs.txg.timeout="5"
vfs.zfs.txg.synctime="1"
#vfs.zfs.vdev.min_pending="1"
#vfs.zfs.vdev.max_pending="1"
# do not power devices without driver
hw.pci.do_power_nodriver=3
```

However i have recently added an additional PCI-E controller that has 6 Ports with an integrated Port-Multiplier to achieve this.



```
camcontrol devlist
<ST32000542AS 0955>                at scbus0 target 0 lun 0 (pass0,ada0)
<ST32000542AS CC34>                at scbus0 target 1 lun 0 (pass1,ada1)
<Port Multiplier 0325197b 000e>    at scbus0 target 15 lun 0 (pass2,pmp0)
<ST31500341AS CC1H>                at scbus2 target 0 lun 0 (pass3,ada2)
<ST32000542AS CC34>                at scbus3 target 0 lun 0 (ada7,pass8)
<ST31500341AS CC1H>                at scbus4 target 0 lun 0 (pass4,ada3)
<ST31500341AS CC1H>                at scbus5 target 0 lun 0 (pass5,ada4)
<ST31500341AS CC1H>                at scbus6 target 0 lun 0 (pass6,ada5)
<ST31500341AS CC1H>                at scbus7 target 0 lun 0 (pass7,ada6)
```

This controller does NOT like ahci with more than two devices added and i continuously get timeout errors and all drives disconnecting.

What i would like to do is disable using ahci for this new controller ONLY yet continue using it for on-board controller.

Is this possible and how?


----------



## thavinci (Dec 10, 2010)

Oh some more info if needed...


```
dmesg | egrep -i "ahci|ada"
ahci0: <JMicron JMB363 AHCI SATA controller> on atapci0
ahci0: [ITHREAD]
ahci0: AHCI v1.00 with 2 3Gbps ports, Port Multiplier supported
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich0: [ITHREAD]
ahcich1: <AHCI channel> at channel 1 on ahci0
ahcich1: [ITHREAD]
ahci1: <Intel ICH9 AHCI SATA controller> port 0x4428-0x442f,0x4434-0x4437,0x4420-0x4427,0x4430-0x4433,0x4020-0x403f mem 0xe432100 0-0xe43217ff 
irq 21 at device 31.2 on pci0
ahci1: [ITHREAD]
ahci1: AHCI v1.20 with 6 3Gbps ports, Port Multiplier supported
ahcich2: <AHCI channel> at channel 0 on ahci1
ahcich2: [ITHREAD]
ahcich3: <AHCI channel> at channel 1 on ahci1
ahcich3: [ITHREAD]
ahcich4: <AHCI channel> at channel 2 on ahci1
ahcich4: [ITHREAD]
ahcich5: <AHCI channel> at channel 3 on ahci1
ahcich5: [ITHREAD]
ahcich6: <AHCI channel> at channel 4 on ahci1
ahcich6: [ITHREAD]
ahcich7: <AHCI channel> at channel 5 on ahci1
ahcich7: [ITHREAD]
pmp0 at ahcich0 bus 0 scbus0 target 15 lun 0
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <ST32000542AS 0955> ATA-7 SATA 2.x device
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 512bytes)
ada0: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
ada1 at ahcich0 bus 0 scbus0 target 1 lun 0
ada1: <ST32000542AS CC34> ATA-8 SATA 2.x device
ada1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada1: Command Queueing enabled
ada1: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
ada2 at ahcich2 bus 0 scbus2 target 0 lun 0
ada2: <ST31500341AS CC1H> ATA-8 SATA 2.x device
ada2: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada2: Command Queueing enabled
ada2: 1430799MB (2930277168 512 byte sectors: 16H 63S/T 16383C)
ada3 at ahcich4 bus 0 scbus4 target 0 lun 0
ada3: <ST31500341AS CC1H> ATA-8 SATA 2.x device
ada3: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada3: Command Queueing enabled
ada3: 1430799MB (2930277168 512 byte sectors: 16H 63S/T 16383C)
ada4 at ahcich5 bus 0 scbus5 target 0 lun 0
ada4: <ST31500341AS CC1H> ATA-8 SATA 2.x device
ada4: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada4: Command Queueing enabled
ada4: 1430799MB (2930277168 512 byte sectors: 16H 63S/T 16383C)
ada5 at ahcich6 bus 0 scbus6 target 0 lun 0
ada5: <ST31500341AS CC1H> ATA-8 SATA 2.x device
ada5: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada5: Command Queueing enabled
ada5: 1430799MB (2930277168 512 byte sectors: 16H 63S/T 16383C)
ada6 at ahcich7 bus 0 scbus7 target 0 lun 0
ada6: <ST31500341AS CC1H> ATA-8 SATA 2.x device
ada6: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada6: Command Queueing enabled
ada6: 1430799MB (2930277168 512 byte sectors: 16H 63S/T 16383C)
ada7 at ahcich3 bus 0 scbus3 target 0 lun 0
ada7: <ST32000542AS CC34> ATA-8 SATA 2.x device
ada7: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada7: Command Queueing enabled
ada7: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
```


----------



## mav@ (Dec 11, 2010)

Probably it's impossible without patching sources.

I can't say what's wrong happened there without more info, but I want to warn you that as soon as JMB363 controller has no FIS-based switching support, devices beyond port multiplier connected to in could be accessed only one by one - driver will serialize access to them that may/will significantly limit performance. Though it is not a reason for timeouts.

I am curious - what is this controller?

PS: without ahci(4) driver you have much less chances to get port multiplier working.


----------



## thavinci (Dec 11, 2010)

Thank you for the response. The Controller In Question is called a "LIAN LI IB-01"


The reason why i was looking into this direction was because the controller becomes pretty much unusable with more than two devices connected to it...

The setup originally looked like this...

6x 1.5TB Drives in raidz on Motherboard controller
3x 2TB Drives in raidz on JMB363

What happens is as soon as there is any form of disk thrashing such as a scrub, timeouts would occur and lock up the system. In some cases all devices attached to the controller would disappear! I have verified it's not the disks and the controller can in fact operate as long as there are no more than two disks only connected to it.

As a test i moved one of the 2TB drives off the JMB363 onto the motherboard controller and kept the zfs setup as is. This resolved issues immediately and no timeouts.

What would you suggest to get this setup stable if i need to remain using ahci on it?

http://computershateme.net/post/2008071300.html

I could try the above?


----------



## mav@ (Dec 12, 2010)

You may try to limit interface speed using hint.ahcich.X.sata_rev=1 loader tunable. On some of my experiments with JMB363 and external port multiplier that fixed some timeouts, but it could have different reasons from yours.

In any case I can repeat that JMB363 and port multiplier is not a good combination. I would recommend you some SiI3124 chip based board. Chip alone has 4 ports and if you wish - it has one of the best multipliers support. Chip itself is PCI-X, but there are cards with PCIe x1 and x8 interfaces with built-in bridge.


----------



## thavinci (Dec 18, 2010)

Unfort the Port-Multiplier is part of the card, and being unemployed atm i can't re-buy 

The good news is that setting all the drives on that controller to SATA1 did the trick....

I do however want to state for others using this card its a disaster... Hot-swapping doesn't work as ahci takes for-ever to notice a disk is removed and when it does it disconnects ALL drives on controller and proceeds to re-detect.

I also noticed that weird as it may seem, one of the drives aren't being picked up correctly... With the drive physically set via jumper to SATA1 it detects as such in my PC but on this card...


```
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <ST32000542AS 0955> ATA-7 SATA 2.x device
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 512bytes)
ada0: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
```
Also another look revealed it is also incorrectly detecting the firmware version of that drive! It has in fact been updated to CC35 yet it reports 0955

Where-ass the other Drives Pick up as SATA1



```
ada1: <ST32000542AS CC34> ATA-8 SATA 1.x device
ada1: 150.000MB/s transfers (SATA 1.x, UDMA6, PIO 8192bytes)
ada1: Command Queueing enabled
ada1: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
ada2 at ahcich0 bus 0 scbus0 target 2 lun 0
ada2: <ST32000542AS CC34> ATA-8 SATA 1.x device
ada2: 150.000MB/s transfers (SATA 1.x, UDMA6, PIO 8192bytes)
ada2: Command Queueing enabled
ada2: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
```


Thanks for the advise and pointing me in correct direction!


----------

