• Damien Le Moal's avatar
    libata: fix read log timeout value · 68dbbe7d
    Damien Le Moal authored
    Some ATA drives are very slow to respond to READ_LOG_EXT and
    READ_LOG_DMA_EXT commands issued from ata_dev_configure() when the
    device is revalidated right after resuming a system or inserting the
    ATA adapter driver (e.g. ahci). The default 5s timeout
    (ATA_EH_CMD_DFL_TIMEOUT) used for these commands is too short, causing
    errors during the device configuration. Ex:
    
    ...
    ata9: SATA max UDMA/133 abar m524288@0x9d200000 port 0x9d200400 irq 209
    ata9: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
    ata9.00: ATA-9: XXX  XXXXXXXXXXXXXXX, XXXXXXXX, max UDMA/133
    ata9.00: qc timeout (cmd 0x2f)
    ata9.00: Read log page 0x00 failed, Emask 0x4
    ata9.00: Read log page 0x00 failed, Emask 0x40
    ata9.00: NCQ Send/Recv Log not supported
    ata9.00: Read log page 0x08 failed, Emask 0x40
    ata9.00: 27344764928 sectors, multi 16: LBA48 NCQ (depth 32), AA
    ata9.00: Read log page 0x00 failed, Emask 0x40
    ata9.00: ATA Identify Device Log not supported
    ata9.00: failed to set xfermode (err_mask=0x40)
    ata9: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
    ata9.00: configured for UDMA/133
    ...
    
    The timeout error causes a soft reset of the drive link, followed in
    most cases by a successful revalidation as that give enough time to the
    drive to become fully ready to quickly process the read log commands.
    However, in some cases, this also fails resulting in the device being
    dropped.
    
    Fix this by using adding the ata_eh_revalidate_timeouts entries for the
    READ_LOG_EXT and READ_LOG_DMA_EXT commands. This defines a timeout
    increased to 15s, retriable one time.
    Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    68dbbe7d
libata-eh.c 105 KB