stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree
@ 2015-07-30  0:25 gregkh
  2015-07-30 17:52 ` Stefan Lippers-Hollmann
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2015-07-30  0:25 UTC (permalink / raw)
  To: martin.petersen, gregkh, hare, tj; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From 5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0e Mon Sep 17 00:00:00 2001
From: "Martin K. Petersen" <martin.petersen@oracle.com>
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" <martin.petersen@oracle.com>

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.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/ata/libata-eh.c |   12 +++++++++++-
 include/linux/libata.h  |    1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -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;
 }
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -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 martin.petersen@oracle.com 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree
  2015-07-30  0:25 Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree gregkh
@ 2015-07-30 17:52 ` Stefan Lippers-Hollmann
  2015-07-30 18:45   ` Martin K. Petersen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Lippers-Hollmann @ 2015-07-30 17:52 UTC (permalink / raw)
  To: gregkh; +Cc: martin.petersen, hare, tj, stable

Hi

On 2015-07-29, gregkh@linuxfoundation.org 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=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 <stable@vger.kernel.org> know about it.
> 
> 
> From 5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0e Mon Sep 17 00:00:00 2001
> From: "Martin K. Petersen" <martin.petersen@oracle.com>
> 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" <martin.petersen@oracle.com>
> 
> 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.

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

[1]	http://www.asus.com/Motherboards/P8H77M_PRO

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree
  2015-07-30 17:52 ` Stefan Lippers-Hollmann
@ 2015-07-30 18:45   ` Martin K. Petersen
  2015-07-30 19:13     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Martin K. Petersen @ 2015-07-30 18:45 UTC (permalink / raw)
  To: Stefan Lippers-Hollmann; +Cc: gregkh, martin.petersen, hare, tj, stable

>>>>> "Stefan" == Stefan Lippers-Hollmann <s.l-h@gmx.de> writes:

Greg,

Please queue eab6ee1ce3c4.

-- 
Martin K. Petersen	Oracle Linux Engineering

commit eab6ee1ce3c4678224d70338134f7a02005768cb
Author: Martin K. Petersen <martin.petersen@oracle.com>
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 <martin.petersen@oracle.com>
    Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 2893563d0537..2b370ee0ae86 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree
  2015-07-30 18:45   ` Martin K. Petersen
@ 2015-07-30 19:13     ` Greg KH
  2015-07-30 20:18       ` Stefan Lippers-Hollmann
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2015-07-30 19:13 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Stefan Lippers-Hollmann, hare, tj, stable

On Thu, Jul 30, 2015 at 02:45:59PM -0400, Martin K. Petersen wrote:
> >>>>> "Stefan" == Stefan Lippers-Hollmann <s.l-h@gmx.de> writes:
> 
> Greg,
> 
> Please queue eab6ee1ce3c4.

Now applied to the 4.1-stable queue, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree
  2015-07-30 19:13     ` Greg KH
@ 2015-07-30 20:18       ` Stefan Lippers-Hollmann
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Lippers-Hollmann @ 2015-07-30 20:18 UTC (permalink / raw)
  To: Greg KH; +Cc: Martin K. Petersen, hare, tj, stable

Hi

On 2015-07-30, Greg KH wrote:
> On Thu, Jul 30, 2015 at 02:45:59PM -0400, Martin K. Petersen wrote:
> > >>>>> "Stefan" == Stefan Lippers-Hollmann <s.l-h@gmx.de> writes:
> > 
> > Greg,
> > 
> > Please queue eab6ee1ce3c4.
> 
> Now applied to the 4.1-stable queue, thanks.
[...]

Thanks, it's working now.

Regards
	Stefan Lippers-Hollmann

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-30 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-30  0:25 Patch "libata: Fall back to unqueued READ LOG EXT if the DMA variant fails" has been added to the 4.1-stable tree gregkh
2015-07-30 17:52 ` Stefan Lippers-Hollmann
2015-07-30 18:45   ` Martin K. Petersen
2015-07-30 19:13     ` Greg KH
2015-07-30 20:18       ` Stefan Lippers-Hollmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).