Difference between revisions of "Lt hotswap"

From ThinkWiki
Jump to: navigation, search
(Supported models: - no ata_piix)
m (Features)
 
(25 intermediate revisions by 14 users not shown)
Line 3: Line 3:
 
|style="vertical-align:top" |
 
|style="vertical-align:top" |
 
=== lt_hotswap ===
 
=== lt_hotswap ===
The <tt>lt_hotswap</tt> kernel module enables hot-swapping for disk drives with full DMA support under Linux.
+
The <tt>lt_hotswap</tt> kernel module enables hot-swapping of UltraBay disk drives under Linux, with DMA support on machines with an old kernel where you might still be required to use piix+ide-disk. With 2.6.2x or better, you should use the new driver, ata_pixx with native hotswapping support.:
It should work on any ThinkPad with hot-swappable bays and ACPI support. The driver needs [[ibm-acpi]] to be running.
+
 
|}
 
|}
 
===Features===
 
===Features===
*enable hotswapping of [[UltraBay]] drives
+
*enable hotswapping of [[UltraBay]] drives if you have to use the old piix/ide-disk drive instead of ata_piix which supports hotswap natively. On new kernels, you should not bother with piix+ide-disk+lt_hotswap and just use ata_piix. See the [[How to hotswap UltraBay devices]] page for more detaoils on ata_piix vs iix+ide-disk+lt_hotswap
 
*automatic IDE unregistering on [[ibm-acpi]] eject event
 
*automatic IDE unregistering on [[ibm-acpi]] eject event
 
*leaves DMA support intact
 
*leaves DMA support intact
  
 
===Limitations===
 
===Limitations===
*does '''not''' work with APM
+
* Requires [[ibm-acpi]] to be running (does not work with [[APM]]).
 +
* Works only in conjunction with the <tt>ide-disk</tt> driver (recent ThinkPad models use <tt>ata_piix</tt> instead).
 +
* Does '''not''' get on well with idectl. Use one, or the other, or crash.
 +
* On Kernel >= 2.6.19 "#include <linux/config.h>" in lt_hotswap.c has to be replaced by "#include <linux/autoconf.h>"
 +
* On Kernel >= 2.6.22, "create_proc_ide_interfaces();" in lt_hotswap.c has to be replaced by "ide_proc_register_port(&ide_hwifs[num]);".
 +
* On Kernel >= 2.6.23, all occurrences of "acpi_bus_generate_event" in lt_hotswap.c need to be replaced by "acpi_bus_generate_proc_event".
  
 
===Project Homepage / Availability===
 
===Project Homepage / Availability===
*Latest version: http://churchofjim.org/sources/lt_hotswap-0.2.0.tar.gz
+
*Project page: http://www.sourceforge.net/projects/lths
 +
*Latest version: http://prdownloads.sourceforge.net/lths/lt_hotswap-0.3.6.tar.gz?download
  
Development and discursion of lt_hotswap is currently being held in  
+
Development and discussion of lt_hotswap is currently being held in  
 
[[Mailinglists#Linux-ThinkPad Mailinglist|Linux-ThinkPad Mailinglist]].
 
[[Mailinglists#Linux-ThinkPad Mailinglist|Linux-ThinkPad Mailinglist]].
  
Line 27: Line 32:
 
===Supported models===
 
===Supported models===
 
The driver has been explicitly reported to work on the following models. It should work on many others as well:
 
The driver has been explicitly reported to work on the following models. It should work on many others as well:
*ThinkPad {{T22}}, {{T40}}
+
*ThinkPad {{A31p}} (warmswap), {{X22}}, {{X24}}, {{T30}}, {{T22}}, {{T23}}, {{T40}}, {{T42}}
 +
 
 +
<tt>lt_hotswap</tt> does '''not''' work well on models that require  the <tt>ata_piix</tt> driver rather than the generic <tt>ide-disk</tt> IDE driver. See [[problems with SATA and Linux]] for a list, and [[How to hotswap UltraBay devices]] for an alternative solution on these models.
 +
 
 +
At least for a thinkpad T41p with a 2.6.15 kernel I recommend to use version 0.2 of lt_hotswap - the latest version reproducable produces oopses and kernel crashes for me.
 +
 
 +
===Script to eject an optical ultrabay drive===
 +
I configured my system to automatically eject my optical drive in battery mode, because it saves about 500mW which is about 5% when my system is idle.
 +
But when the drive is in use, issuing an eject will result in a kernel ooops/crash.
 +
So the problem is: How do I check if the device is still in use, either by the kernel or by some other process?
 +
The trick is to compile "cdrom and ide_cd" as modules. If the unload of ide_cd failes some other process is still using the device.
 +
<bash>
 +
#!/bin/sh
 +
# disable bay if possible
 +
# saves about 500mW
 +
 
 +
if modprobe -r ide_cd; then
 +
  modprobe -r cdrom
 +
  echo "MSTR eject" > /proc/acpi/lths
 +
  modprobe ide-cd
 +
  modprobe cdrom
 +
else
 +
  echo ""
 +
  echo "$(fuser -vm /dev/hdc)"
 +
fi
 +
</bash>
  
The <tt>lt_hotswap</tt> driver will not work if you use the <tt>ata_piix</tt> driver rather than the generic IDE driver (<tt>ata_piix</tt> is necessary on some models to get DMA support, see [[problems with SATA and Linux]]).
 
  
 
[[Category:Drivers]] [[Category:Patches]]
 
[[Category:Drivers]] [[Category:Patches]]
 +
 +
==See also==
 +
* [[How to hotswap UltraBay devices]]
 +
* [[How_to_hotswap_the_UltraBase]]

Latest revision as of 01:26, 27 December 2007

lt_hotswap

The lt_hotswap kernel module enables hot-swapping of UltraBay disk drives under Linux, with DMA support on machines with an old kernel where you might still be required to use piix+ide-disk. With 2.6.2x or better, you should use the new driver, ata_pixx with native hotswapping support.:

Features

  • enable hotswapping of UltraBay drives if you have to use the old piix/ide-disk drive instead of ata_piix which supports hotswap natively. On new kernels, you should not bother with piix+ide-disk+lt_hotswap and just use ata_piix. See the How to hotswap UltraBay devices page for more detaoils on ata_piix vs iix+ide-disk+lt_hotswap
  • automatic IDE unregistering on ibm-acpi eject event
  • leaves DMA support intact

Limitations

  • Requires ibm-acpi to be running (does not work with APM).
  • Works only in conjunction with the ide-disk driver (recent ThinkPad models use ata_piix instead).
  • Does not get on well with idectl. Use one, or the other, or crash.
  • On Kernel >= 2.6.19 "#include <linux/config.h>" in lt_hotswap.c has to be replaced by "#include <linux/autoconf.h>"
  • On Kernel >= 2.6.22, "create_proc_ide_interfaces();" in lt_hotswap.c has to be replaced by "ide_proc_register_port(&ide_hwifs[num]);".
  • On Kernel >= 2.6.23, all occurrences of "acpi_bus_generate_event" in lt_hotswap.c need to be replaced by "acpi_bus_generate_proc_event".

Project Homepage / Availability

Development and discussion of lt_hotswap is currently being held in Linux-ThinkPad Mailinglist.

Installation

In order to use the driver you must use ACPI and also have the ibm-acpi driver linked to your kernel (module or compiled).

When loading the hotswap module, you can use the module parameter: auto_eject=1 to automatically unregister the drives IDE interface. This will happen upon popping out the UltraBay lever.

Supported models

The driver has been explicitly reported to work on the following models. It should work on many others as well:

lt_hotswap does not work well on models that require the ata_piix driver rather than the generic ide-disk IDE driver. See problems with SATA and Linux for a list, and How to hotswap UltraBay devices for an alternative solution on these models.

At least for a thinkpad T41p with a 2.6.15 kernel I recommend to use version 0.2 of lt_hotswap - the latest version reproducable produces oopses and kernel crashes for me.

Script to eject an optical ultrabay drive

I configured my system to automatically eject my optical drive in battery mode, because it saves about 500mW which is about 5% when my system is idle. But when the drive is in use, issuing an eject will result in a kernel ooops/crash. So the problem is: How do I check if the device is still in use, either by the kernel or by some other process? The trick is to compile "cdrom and ide_cd" as modules. If the unload of ide_cd failes some other process is still using the device. <bash>

  1. !/bin/sh
  2. disable bay if possible
  3. saves about 500mW

if modprobe -r ide_cd; then

 modprobe -r cdrom
 echo "MSTR eject" > /proc/acpi/lths
 modprobe ide-cd
 modprobe cdrom

else

 echo ""
 echo "$(fuser -vm /dev/hdc)"

fi </bash>

See also