public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* max_hw_sectors error caused by recent NVMe driver commit
@ 2023-02-11  5:33 Michael Kelley (LINUX)
  2023-02-11  9:38 ` Daniel Gomez
  2023-02-13  5:59 ` Christoph Hellwig
  0 siblings, 2 replies; 11+ messages in thread
From: Michael Kelley (LINUX) @ 2023-02-11  5:33 UTC (permalink / raw)
  To: Christoph Hellwig, Keith Busch
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Gerd Bayer,
	asahi@lists.linux.dev, linux-nvme@lists.infradead.org

Commit 3f30a79c2e2c ("nvme-pci: set constant paramters in nvme_pci_alloc_ctrl")
appears to have introduced an error in how max_hw_sectors is calculated.  The
value of max_hw_sectors is based on dma_max_mapping_size(), which indirectly
uses dma_addressing_limited() to decide if swiotlb_max_mapping_size() should
be used.

In this commit, setting max_hw_sectors is moved to nvme_pci_alloc_dev().
But dma_addressing_limited() depends on the dev->dma_mask, which hasn't
been set.  dma_addressing_limited() returns "true", and the swiotlb max mapping
size is used, limiting NVMe transfers to 504 sectors (252 Kbytes).

Prior to this commit, max_hw_sectors isn't set until after the call to
dma_set_mask_and_coherent() in nvme_pci_enable(), as called from
nvme_reset_work().   max_hw_sectors is correctly determined based on
values reported by the NVMe controller.

I haven't provided a fix because I'm not that familiar with the overall structure
of the code and the intent of the code reorganization.  I'm not sure if setting
the DMA mask should be moved earlier, or setting max_hw_sectors should
be moved back to its original location.

Michael




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

end of thread, other threads:[~2023-03-03 16:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-11  5:33 max_hw_sectors error caused by recent NVMe driver commit Michael Kelley (LINUX)
2023-02-11  9:38 ` Daniel Gomez
2023-02-13 16:42   ` Michael Kelley (LINUX)
2023-02-13 16:57     ` Keith Busch
2023-02-17 13:28       ` Daniel Gomez
2023-02-17 16:05         ` Michael Kelley (LINUX)
2023-03-03 16:24           ` Daniel Gomez
2023-03-03 16:44             ` Keith Busch
2023-02-13  5:59 ` Christoph Hellwig
2023-02-13  6:41   ` Michael Kelley (LINUX)
2023-02-13  6:42     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox