SATA Hotplug は安全にできるのか?

http://linux-ata.org/software-status.html#hotplug

Hotplug support
libata supports host controller hotplug ("yank the card").
All SATA devices are hotplug-capable.
libata does not support device hotplug ("yank the drive")... yet.
Update: Lukasz Kosewski has contributed an initial implementation of SATA device hotplug.
The following SATA controllers will never support hotplug: Intel ICH5, Intel ICH5-R, Intel ICH6 (non-AHCI), Pacific Digital Talon (ADMA), Promise SATA SX4.
These controllers do not export enough information about the SATA phy to make it possible to support hotplug. In some cases, such as Intel ICH5/ICH6, it is possible to support "coldplug" operation: the user informs the OS driver he wishes to disconnect his SATA device, rather than simply disconnecting it.

hostレベルでのhotplugはできるようになっているようだ。でもデバイスレベルではまだなのかな。
一部のコントローラーについては、SATA device hotplug patchがあるということなので調べる。
これかな?

[PATCH 2.6.15-rc7-git3 2/3] libata: framework API for hotswapping drives on libata controllers, Lukasz Kosewski
http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-12/msg08266.html
[PATCH 2.6.15-rc7-git3 3/3] sata_promise: a hotswap implementation using the new hotswap API, Lukasz Kosewski
http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-12/msg08265.html
[PATCH 2.6.15-rc7-git3 1/3] sata_promise: add correct read/write of hotplug registers for SATAII devices, Lukasz Kosewski
http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-12/msg08263.html

promise向けの実装ということか。
全体にはどうだろう。
Linux libata feature table December 15, 2005
http://linux-ata.org/features.html

Not supported

  • Port Multipliers
  • Command protocols:
    • PIO Read/write multiple (patch available)
    • Soft reset
    • Hard reset
    • Legacy TCQ (no support planned)
    • NCQ (early patch available)
  • ATA/ATAPI device support:
    • hotplug (i.e. unplug the drive; early patch available)
    • Device reset on error
    • Suspend/resume, ACPI (patch available)
    • Host-protected area (HPA)
    • ATA commands:
      • Read/write multiple sectors
      • Read/write TCQ
      • Read/write NCQ
      • On some controllers, vendor-specific commands will fail.
  • Host controllers:
    • Legacy ISA devices
    • Simplex DMA
    • Suspend/resume (patch available)

まだ全然だな。デバイスホットプラグだけじゃなくて、NCQもダメなのか。
メーカー独自ドライバと、未採用patchの変遷を追ってみますかね。
88SX60x1については、sata_mvでNCQ対応ができているようだ。デバイスホットプラグについては何も書いてない。
http://linux-ata.org/sata-status.html#marvell
sata_mv important note
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg06547.html

For sata_mv users, you should be aware of three things:
1) The Marvell driver is experimental, and not yet considered ready for production use. As Kconfig notes: HIGHLY EXPERIMENTAL.
2) There are PCI Message Signalled Interrupt (MSI) problems that are not yet diagnosed. Workaround is to disable MSI.
3) There are still some errata that are not yet implemented. Thus, for some systems, you may see either lockups or data corruption. That's the price of running a HIGHLY EXPERIMENTAL driver.
Rest assured that all problem reports are read, even if you don't receive a reply. After enough feedback is received, the exact problem becomes more clear.

これはつらいね。やっぱベンダ提供ドライバに頼るしかないの?
このパッチで安定しているという話もある。
http://www.keffective.com/mvsata/FC3/mvSata-3.4.2a-patched.tbz
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg06592.html
ディレクトリ下にはFC向けのものもある。同じ時期に3.6.1もあるのは何だろう。
LVM上のRAID6で、まだうまく動いていないようだ。
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg06721.html
nmi_watchdog=1を試すとよいとの指摘。
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg07504.html
でも効果はなかったらしい。LVMなしのmdでのRAID6でもハングするようだ。
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg08114.html
この流れの間にも、SATAを含めたATAのkernl設定メニューが変更になったり、ACPI対応が進められたりしている。
[PATCH 2.6.15.4 rel.2 1/1] libata: add hotswap to sata_svw, Martin Devera
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-02/msg05864.html
Serverworks/BroadCom用ドライバであるsvwにはhotswapができるようになったようだ。
複数ドライブに書き込むときにブロックが起きる問題がある? そのmv用パッチ。
[PATCH] Add missing FUA write to sata_mv dma command list
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-02/msg05549.html
完全に止まっちゃった人。
[2.6.15 / sata_mv] Oops!
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-02/msg01253.html
MSIPCIの問題へのパッチ?
[git patch] libata: sata_mv MSI workaround
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-02/msg00823.html
2.6.16.1で採用されたパッチにもmvが含まれている。
[patch 00/20] 2.6.16.1 Stable review
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg08748.html
[patch 01/20] sata_mv: fix irq port status usage
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg08765.html
[patch 04/20] 2.6.xx: sata_mv: another critical fix,
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg08767.html
こんなのもある。
[PATCH] 2.6.xx: sata_mv: another critical fix
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg06808.html
16mm2への取り込み。
2.6.16-rc6-mm2
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg05886.html
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg05917.html
5081用パッチ
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-03/msg02626.html
結局、まだOSSではmvのデバイスホットプラグはできないらしい。
 
Marvellのサイトで配布していないかどうか調べる。
http://www.marvell.com/drivers/search.do
検索しても、GbEYukonのドライバしか出てこない。おまけに、何か独自の許諾を承認しないといけないのでアクセスせず。
プロプラドライバもメーカーに請求するしかないようだ。
http://www.marvell.com/products/sata_host.jsp
プロプラドライバがSCSI風のコーディングになっているということなら、HotPlugができる可能性はあるな。RHはサポートしてあるって書いてあるけど。
http://www.marvell.com/products/discovery_2.jsp
モンタとRHのツールはボードに付属するのかな?

sata_mvは、 
ftp://ftp.abit.com.tw/pub/download/drivers/linux/marvell/
にある mvsata340.zip が起源であるようだ。日付は2004/12/22になっている。
ここには、他にも同じ日付で、
bcm5704lanlunixdrive_v.7.1.22.zip
uli1563.zip
via_8237_ver0.8.gz
なども置いてある。
Marvell SATA driver + Fedora Core 3 and 4 HOWTO
http://www.keffective.com/mvsata/
この文書は、06/3/31なのでかなり最近のもの。
Fedora Core 4 Kernel Compilation mini-HOWTO
http://www.keffective.com/mvsata/fc4_howto.html
ここではsata_mvの最新版を適用したFC4用kernelのコンパイル方法が書かれている。
FC3/4で使われているドライバは、ここに置かれているようだ。
http://www.keffective.com/mvsata/FC3/mvsata-3.4.2-1.0_fc4.tgz
これで調査の最初に戻ってきたので、一巡したのかもしれない。
 
ついでで。
gentooで340ドライバを使う方法。パッチもある。
http://www.edoceo.com/liber/marvell-sata.php
Marvell 4ch/8chSATAのためにadaptecが配布しているドライバ。RHEL3/4向けのものがある。
ftp://ftp.supermicro.com/driver/Diskimag/Adaptec/Marvell/H2/
これも参考になるか。06/03/13なので比較的新しい。
Serial ATA (SATA) chipsets ― Linux support status
http://linuxmafia.com/faq/Hardware/sata.html
OpenSUSEでは、sata_mvのライセンスが不明確としている。
http://en.opensuse.org/Wishlist_Drivers