Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
libata: Fall back to unqueued READ LOG EXT if the DMA variant fails
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
libata-fall-back-to-unqueued-read-log-ext-if-the-dma-variant-fails.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0eMon Sep 17 00:00:00 2001
From: "Martin K. Petersen" <[email protected]>
Date: Mon, 4 May 2015 21:54:21 -0400
Subject: libata: Fall back to unqueued READ LOG EXT if the DMA variant fails
From: "Martin K. Petersen" <[email protected]>
commit 5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0e upstream.
Some devices advertise support for the READ/WRITE LOG DMA EXT commands but fail when we try to issue them. This can lead to queued TRIM being unintentionally disabled since the relevant feature flag is located in a general purpose log page.
Fall back to unqueued READ LOG EXT if the DMA variant fails while reading a log page.
--- drivers/ata/libata-eh.c | 12 +++++++++++- include/linux/libata.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/ata/libata-eh.c +11 -1
@@ -1507,13 +1507,17 @@ unsigned int ata_read_log_page(struct at {struct ata_taskfile tf;unsigned int err_mask; +bool dma = false;DPRINTK ("read log page - log 0x%x, page 0x%x\n" , log, page); +retry:ata_tf_init (dev, &tf); -if (dev->dma_mode &&ata_id_has_read_log_dma_ext (dev->id)) { +if (dev->dma_mode &&ata_id_has_read_log_dma_ext (dev->id) && + !(dev->horkage &ATA_HORKAGE_NO_NCQ_LOG )) { tf.command =ATA_CMD_READ_LOG_DMA_EXT ; tf.protocol =ATA_PROT_DMA ; + dma = true; }else { tf.command =ATA_CMD_READ_LOG_EXT ; tf.protocol =ATA_PROT_PIO ;
@@ -1527,6 +1531,12 @@ unsigned int ata_read_log_page(struct at err_mask =ata_exec_internal (dev, &tf,NULL ,DMA_FROM_DEVICE , buf, sectors *ATA_SECT_SIZE ,0 ); +if (err_mask && dma) { + dev->horkage |=ATA_HORKAGE_NO_NCQ_LOG ; +ata_dev_warn (dev,"READ LOG DMA EXT failed, trying unqueued\n" ); + goto retry; + } +DPRINTK ("EXIT, err_mask=%x\n" , err_mask);return err_mask; }
include/linux/libata.h +1 -0
@@ -431,6 +431,7 @@ enum {ATA_HORKAGE_NOLPM = (1 <<20 ),/* don't use LPM */ ATA_HORKAGE_WD_BROKEN_LPM = (1 <<21 ),/* some WDs have broken LPM */ ATA_HORKAGE_ZERO_AFTER_TRIM = (1 <<22 ),/* guarantees zero after trim */ + ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read *//* DMA mask for user DMA control: User visible values; DO NOT renumber */
Patches currently in stable-queue which might be from [email protected] are
queue-4.1/libata-fall-back-to-unqueued-read-log-ext-if-the-dma-variant-fails.patch queue-4.1/libata-expose-trim-capability-in-sysfs.patch queue-4.1/libata-do-not-blacklist-micron-m500dc.patch queue-4.1/libata-do-not-blacklist-m510dc.patch
Hi
Quoted 24 lines · On 2015-07-29, [email protected] wrote:
This is a note to let you know that I've just added the patch titled
libata: Fall back to unqueued READ LOG EXT if the DMA variant fails
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
libata-fall-back-to-unqueued-read-log-ext-if-the-dma-variant-fails.patch
and it can be found in the queue-4.1 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From
5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0eMon Sep 17 00:00:00 2001
From: "Martin K. Petersen" <[email protected]>
Date: Mon, 4 May 2015 21:54:21 -0400
Subject: libata: Fall back to unqueued READ LOG EXT if the DMA variant failsFrom: "Martin K. Petersen" <[email protected]>
commit
5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0eupstream.
Quoted 7 lines
Some devices advertise support for the READ/WRITE LOG DMA EXT commands but fail when we try to issue them. This can lead to queued TRIM being unintentionally disabled since the relevant feature flag is located in a general purpose log page.
Fall back to unqueued READ LOG EXT if the DMA variant fails while reading a log page.
This patch, as part of the current -stable queue-4.1 introduces a regression for me on an ivy-bridge Asus P8H77-M PRO[1] mainboard using a Toshiba DT01ACA3 attached. When trying to boot, the system stops with a high spinning loop (and many supressed printks) of
ata1.00: READ LOG DMA EXT failed, trying unqueued
while still being in the initramfs code.
00:1f.2 SATA controller [0106]: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] [8086:1e02] (rev 04) (prog-if 01 [AHCI 1.0])
Subsystem: ASUSTeK Computer Inc. P8 series motherboard [1043:84ca]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin B routed to IRQ 30
Region 0: I/O ports at f0b0 [size=8]
Region 1: I/O ports at f0a0 [size=4]
Region 2: I/O ports at f090 [size=8]
Region 3: I/O ports at f080 [size=4]
Region 4: I/O ports at f060 [size=32]
Region 5: Memory at f7f16000 (32-bit, non-prefetchable) [size=2K]
Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee00398 Data: 0000
Capabilities: [70] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold-)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004
Capabilities: [b0] PCI Advanced Features
AFCap: TP+ FLR+
AFCtrl: FLR-
AFStatus: TP-
Kernel driver in use: ahci
$ lsscsi [0:0:0:0] disk ATA Samsung SSD 840 6B0Q /dev/sda [1:0:0:0] disk ATA TOSHIBA DT01ACA3 ABB0 /dev/sdb [2:0:0:0] disk ATA SAMSUNG HD204UI 0001 /dev/sdc [3:0:0:0] disk ATA SAMSUNG HD204UI 0001 /dev/sdd [4:0:0:0] disk ATA ST3000DM001-1CH1 CC24 /dev/sde [5:0:0:0] disk ATA TOSHIBA DT01ACA3 ABB0 /dev/sdf
Reverting only this patch from the current queue-4.1, and fixing up the trivial merge conflicts this introduces for the subsequent patches
libata-add-ata_horkage_max_sec_1024-to-revert-back-to-previous-max_sectors-limit.patch libata-add-ata_horkage_notrim.patch
fixes the problem for me.
Regards
Stefan Lippers-Hollmann
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Stefan" == Stefan Lippers-Hollmann <[email protected]> writes:
Greg,
Please queue eab6ee1ce3c4.
Signature · 20 lines
Martin K. Petersen Oracle Linux Engineering commit eab6ee1ce3c4678224d70338134f7a02005768cb Author: Martin K. Petersen <[email protected]> Date: Tue May 19 19:44:17 2015 -0400 libata: Fix regression when the NCQ Send and Receive log page is absent Commit 5d3abf8ff67f ("libata: Fall back to unqueued READ LOG EXT if the DMA variant fails") allowed us to fall back to the unqueued READ LOG variant if the queued version failed. However, if the device did not support the page at all we would end up looping due to a merge snafu. Ensure we only take the fallback path once. Signed-off-by: Martin K. Petersen <[email protected]> Reported-by: Sergey Senozhatsky <[email protected]> Tested-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
drivers/ata/libata-eh.c +1 -0
@@ -1521,6 +1521,7 @@ retry: }else { tf.command =ATA_CMD_READ_LOG_EXT ; tf.protocol =ATA_PROT_PIO ; + dma = false; } tf.lbal = log; tf.lbam = page;
Greg KH
maintainerQuoted 5 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Stefan" == Stefan Lippers-Hollmann <[email protected]> writes:
Greg,
Please queue
eab6ee1ce3c4.
Now applied to the 4.1-stable queue, thanks.
greg k-h
Hi
Quoted 8 lines · Greg KH
Quoted 5 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Stefan" == Stefan Lippers-Hollmann <[email protected]> writes:
Greg,
Please queue
eab6ee1ce3c4.Now applied to the 4.1-stable queue, thanks.
[...]
Thanks, it's working now.
Regards
Stefan Lippers-Hollmann