linux/drivers
Tejun Heo 31daabda16 libata: reimplement reset sequencing
libata previously depended upon waits in prereset to get resets after
hotplug right for both spin up and device ready wait.  This was
necessary both for reliablity and speed as reset was likely to fail if
initiated too early and each try usually took more than 30secs to
fail.  Previous patches fixed the reliability part by fixing status
and SCR handling in resets.  This patch remedies the speed part by
improving reset sequencing.

Prereset waiting timeout is adjusted to 10s because spinup wait is
replaced by reset sequencing and !BSY wait is not as important as
before.  During boot or module loading where the drive is already
fully spun up, !BSY wait succeeds immediately, so 10s should be enough
in most cases.  It matters after hotplugging or other error
conditions, but in those cases, !BSY wait in prereset simply can't be
relied upon due to the varied and weird behaviors ATA controllers and
devices show.

Reset is now driven by ata_eh_reset_timeouts[] table which contains
timeouts for each reset try.  The first reset can be softreset but the
following ones are always hardreset if available.  Each timeout
defines deadline for the reset try.  If a reset try fails, reset is
retried with the next timeout till the end of the timeout table is
reached.  If a reset try fails before the timeout with error, libata
waits till the deadline of the failed try before retrying.

IOW, the timeout table defines timetable of reset tries such that the
n'th try always begins at least after the sum of all previous timeouts
has passed.  The current timetable defines 4 tries and takes around 1
minute.

@0	: First try.  This should succeed most of the time during boot.
@10	: 10s is enough to spin up most consumer harddrives.  Give it
	  another shot.
@20	: 20s should spin up > 99% of working drives.  This has 30s
	  timeout for retarded devices needing long idleness post reset.
@55	: Final try with 5s timeout just in case.

The above timetable is trade off between not annoying the device too
much with frequent resets and taking reasonable amount of time in most
cases.  Some controllers may do better with shorter timeouts while
others may fare better with longer but we just can't rely upon LLD
writers to test each controller with wide variety of devices using
various scenarios.  We need default behavior which reasonably fits
most cases.

I've tested the above timetable on a dozen SATA controllers and a few
PATA controllers with about a dozen different drives from all major
vendors and 4 different ODDs from three different vendors for both
boot and hotplug (if available) cases.

Boot probing is not affected unless the device is broken in which
cases new code gives up on the port after a minute rather than five or
nine minutes.  When hotplugging, most devices get detected on the
first or second try.  Multi-platter drives with long spin up time
which sometimes took > 40 secs with the original code, now usually
comes up during the second try and at least right after the third try
@20.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-01 07:49:54 -04:00
..
acorn [ARM] Acorn: move the i2c bus driver into drivers/i2c 2007-03-04 20:40:50 +00:00
acpi power management: implement pm_ops.valid for everybody 2007-04-30 16:40:40 -07:00
amba uevent: use add_uevent_var() instead of open coding it 2007-04-27 10:57:29 -07:00
ata libata: reimplement reset sequencing 2007-05-01 07:49:54 -04:00
atm [ATM]: Use mutex instead of binary semaphore in FORE Systems 200E-series driver 2007-04-26 01:41:49 -07:00
auxdisplay [PATCH] cfag12864b: fix crash when built-in and no parport present 2007-02-20 17:10:14 -08:00
base drivers/base/attribute_container.c: use mutex instead of binary semaphore 2007-04-27 10:57:34 -07:00
block ub: Bind to first endpoint, not to last 2007-04-27 13:28:34 -07:00
bluetooth [SK_BUFF]: Introduce skb_copy_from_linear_data{_offset} 2007-04-25 22:28:23 -07:00
cdrom [PATCH] Fix soft lockup with iSeries viocd driver 2007-03-05 07:57:51 -08:00
char Merge branch 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2007-04-30 08:10:12 -07:00
clocksource ACPI: correct pathname in comment 2007-04-25 14:27:06 -04:00
connector [NETLINK]: Switch cb_lock spinlock to mutex and allow to override it 2007-04-25 22:29:03 -07:00
cpufreq [PATCH] Fix maxcpus=1 trigerring BUG() in cpufreq 2007-03-27 08:55:56 -07:00
crypto [PATCH] geode-aes: use unsigned long for spin_lock_irqsave 2007-03-06 09:30:25 -08:00
dio
dma [PATCH] rm pointless dmaengine exports 2007-03-16 19:25:03 -07:00
edac [PATCH] EDAC: Add Fully-Buffered DIMM APIs to core 2007-02-12 09:48:32 -08:00
eisa [PATCH] drivers/eisa/pci_eisa.c:pci_eisa_init() should be init 2007-03-27 09:05:15 -07:00
fc4 [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
firmware [PATCH] docbook: add edd firmware interfaces 2007-02-11 10:51:32 -08:00
hid Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jikos/hid 2007-04-30 08:58:21 -07:00
hwmon Merge branch 'linux-2.6' into for-2.6.22 2007-04-30 12:38:01 +10:00
i2c Minor bug fixes to i2c-pasemi 2007-04-17 16:36:28 -07:00
ide IDE: remove rwsem use from ide-proc core 2007-04-27 10:57:30 -07:00
ieee1394 ieee1394: remove garbage from Kconfig 2007-04-30 00:00:33 +02:00
infiniband Merge branch 'linux-2.6' into for-2.6.22 2007-04-30 12:38:01 +10:00
input Input: gameport - do not touch bus's rwsem 2007-04-27 10:57:30 -07:00
isdn [SK_BUFF]: Introduce skb_copy_to_linear_data{_offset} 2007-04-25 22:28:29 -07:00
kvm KVM: Fix off-by-one when writing to a nonpae guest pde 2007-04-19 18:39:26 +03:00
leds leds: Add support for Cobalt Server front LED 2007-02-15 21:37:29 +00:00
macintosh Merge branch 'linux-2.6' into for-2.6.22 2007-04-30 12:38:01 +10:00
mca
md [BLOCK] Don't pin lots of memory in mempools 2007-04-30 09:08:17 +02:00
media Merge branch 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2007-04-30 08:10:12 -07:00
message [SK_BUFF]: Introduce skb_copy_from_linear_data{_offset} 2007-04-25 22:28:23 -07:00
mfd [PATCH] drivers/mfd/sm501.c: fix an off-by-one 2007-04-02 10:06:08 -07:00
misc Pull thinkpad into release branch 2007-04-28 23:11:19 -04:00
mmc uevent: use add_uevent_var() instead of open coding it 2007-04-27 10:57:29 -07:00
mtd [MTD] [MAPS] drivers/mtd/maps/ck804xrom.c: convert pci_module_init() 2007-04-27 23:34:21 +01:00
net Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2007-04-30 08:14:42 -07:00
nubus
oprofile [PATCH] oprofile: fix potential deadlock on oprofilefs_lock 2007-03-28 13:58:02 -07:00
parisc [NET]: Remove NETIF_F_INTERNAL_STATS, default to internal stats. 2007-04-28 21:04:03 -07:00
parport [PARPORT] SUNBPP: Fix OOPS when debugging is enabled. 2007-04-23 23:33:17 -07:00
pci Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev 2007-04-29 10:48:21 -07:00
pcmcia [PATCH] omap_cf: oops-on-suspend fix 2007-04-08 19:47:55 -07:00
pnp PNP: stop using the subsystem rwsem 2007-04-27 10:57:30 -07:00
ps3 [POWERPC] Remove dev_dbg redefinition in drivers/ps3/vuart.c 2007-04-30 13:03:39 +10:00
rapidio [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
rtc [PATCH] rtc-cmos lockdep fix, irq updates 2007-04-02 10:06:09 -07:00
s390 s390: cio: Delay uevents for subchannels 2007-04-27 10:57:32 -07:00
sbus [OPENPROM]: Use pci_device_to_OF_node(). 2007-04-26 01:54:59 -07:00
scsi Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block 2007-04-30 08:12:39 -07:00
serial Merge branch 'linux-2.6' into for-2.6.22 2007-04-30 12:38:01 +10:00
sh
sn [PATCH] IOC3/IOC4: PCI mem space resources 2007-02-11 10:51:25 -08:00
spi spi: fix use of set_cs in spi_s3c24xx driver 2007-04-17 16:36:27 -07:00
tc [PATCH] Fix build error on zs serial driver 2007-04-04 21:12:47 -07:00
telephony [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
usb Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jikos/hid 2007-04-30 08:58:21 -07:00
video Merge branch 'linux-2.6' into for-2.6.22 2007-04-30 12:38:01 +10:00
w1 [PATCH] w1: Use ARRAY_SIZE macro when appropriate 2007-02-12 09:48:28 -08:00
zorro [PATCH] mark struct file_operations const 6 2007-02-12 09:48:45 -08:00
Kconfig [PATCH] drivers: add LCD support 2007-02-11 10:51:24 -08:00
Makefile IB: Remove reference to obsolete CONFIG_IPATH_CORE 2007-04-18 20:20:53 -07:00