linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] nvme: temporary fix for Apple NVMe controller reset
@ 2015-11-20 18:57 Stephan Günther
  2015-11-21  8:20 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Günther @ 2015-11-20 18:57 UTC (permalink / raw)


Recent patches added basic support for the Apple NVMe controller but
still cause controller resets and data corruption when a specific
pattern of read/flush commands occurs on that controller.

This patch prevents that and was tested for a weeek by myself running
4.4-rc1. It is also confirmed to work around that problem by at least
one other guy.

Maybe this hotfix can be done in a more elegant way, but something
like that should definitely go into 4.4 as the controller will otherwise
destroy file systems.


Signed-off-by: Stephan G?nther <guenther at tum.de>
Signed-off-by: Maurice Leclaure <leclaire at in.tum.de
---
 drivers/nvme/host/pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8187df2..15bbedb 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2701,6 +2701,14 @@ static int nvme_dev_map(struct nvme_dev *dev)
 	dev->q_depth = min_t(int, NVME_CAP_MQES(cap) + 1, NVME_Q_DEPTH);
 	dev->db_stride = 1 << NVME_CAP_STRIDE(cap);
 	dev->dbs = ((void __iomem *)dev->bar) + 4096;
+
+	/*
+	 * Temporary fix for the Apple controller found in the MacBook8,1 and
+	 * some MacBook7,1 to avoid controller resets and data loss.
+	 */
+	if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001)
+		dev->q_depth = 2;
+
 	if (readl(&dev->bar->vs) >= NVME_VS(1, 2))
 		dev->cmb = nvme_map_cmb(dev);

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

* [PATCH 1/1] nvme: temporary fix for Apple NVMe controller reset
  2015-11-20 18:57 [PATCH 1/1] nvme: temporary fix for Apple NVMe controller reset Stephan Günther
@ 2015-11-21  8:20 ` Christoph Hellwig
  2015-11-21 12:16   ` Stephan Günther
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2015-11-21  8:20 UTC (permalink / raw)


Hi Stephan,

> +	/*
> +	 * Temporary fix for the Apple controller found in the MacBook8,1 and
> +	 * some MacBook7,1 to avoid controller resets and data loss.
> +	 */
> +	if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001)
> +		dev->q_depth = 2;

Can you add a dev_warn() here?  A NVMe device with queue depth is going
to perform bady, and we should tell people that we're applying a crude
workaround.

Otherwise this looks fine to me to get you guys going, but I really hope
we'll find the root cause soon.

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

* [PATCH 1/1] nvme: temporary fix for Apple NVMe controller reset
  2015-11-21  8:20 ` Christoph Hellwig
@ 2015-11-21 12:16   ` Stephan Günther
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Günther @ 2015-11-21 12:16 UTC (permalink / raw)


On 2015/November/21 12:20, Christoph Hellwig wrote:
> Hi Stephan,
> 
> > +	/*
> > +	 * Temporary fix for the Apple controller found in the MacBook8,1 and
> > +	 * some MacBook7,1 to avoid controller resets and data loss.
> > +	 */
> > +	if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001)
> > +		dev->q_depth = 2;
> 
> Can you add a dev_warn() here?  A NVMe device with queue depth is going
> to perform bady, and we should tell people that we're applying a crude
> workaround.

I'll resend the patch with an updated commit message and dev_warn().

Interestingly, I cannot really complain about performance with that
patch applied. That little notebook behaves really well. But that queue
depth cannot be the solution of course.

> 
> Otherwise this looks fine to me to get you guys going, but I really hope
> we'll find the root cause soon.

I wish Apple would show any interest in that matter...

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

end of thread, other threads:[~2015-11-21 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 18:57 [PATCH 1/1] nvme: temporary fix for Apple NVMe controller reset Stephan Günther
2015-11-21  8:20 ` Christoph Hellwig
2015-11-21 12:16   ` Stephan Günther

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).