[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190617122000.22181-3-hch@lst.de>
Date: Mon, 17 Jun 2019 14:19:54 +0200
From: Christoph Hellwig <hch@....de>
To: "Martin K . Petersen" <martin.petersen@...cle.com>
Cc: Sagi Grimberg <sagi@...mberg.me>, Max Gurtovoy <maxg@...lanox.com>,
Bart Van Assche <bvanassche@....org>,
linux-rdma@...r.kernel.org, linux-scsi@...r.kernel.org,
megaraidlinux.pdl@...adcom.com, MPT-FusionLinux.pdl@...adcom.com,
linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/8] scsi: take the DMA max mapping size into account
We need to limit the devices max_sectors to what the DMA mapping
implementation can support. If not we risk running out of swiotlb
buffers easily.
Signed-off-by: Christoph Hellwig <hch@....de>
---
drivers/scsi/scsi_lib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index d333bb6b1c59..f233bfd84cd7 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1768,6 +1768,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
blk_queue_max_integrity_segments(q, shost->sg_prot_tablesize);
}
+ shost->max_sectors = min_t(unsigned int, shost->max_sectors,
+ dma_max_mapping_size(dev) << SECTOR_SHIFT);
blk_queue_max_hw_sectors(q, shost->max_sectors);
if (shost->unchecked_isa_dma)
blk_queue_bounce_limit(q, BLK_BOUNCE_ISA);
--
2.20.1
Powered by blists - more mailing lists