Message ID | 1460414846-29540-2-git-send-email-hch@lst.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On 04/11/2016 03:47 PM, Christoph Hellwig wrote: > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 8106515..04c660d 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -2120,7 +2120,8 @@ static void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) > blk_queue_segment_boundary(q, shost->dma_boundary); > dma_set_seg_boundary(dev, shost->dma_boundary); > > - blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); > + blk_queue_max_segment_size(q, > + min(shost->max_segment_size, dma_get_max_seg_size(dev))); > > if (!shost->use_clustering) > q->limits.cluster = 0; Hello Christoph, Since Scsi_Host.max_segment_size is initialized to zero, shouldn't min() be changed into min_not_zero()? Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 11, 2016 at 04:32:16PM -0700, Bart Van Assche wrote: > Since Scsi_Host.max_segment_size is initialized to zero, shouldn't min() be > changed into min_not_zero()? It probably should. Thanks for catching this. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks Bart Good catch, I completely missed it. Laurence Oberman Principal Software Maintenance Engineer Red Hat Global Support Services ----- Original Message ----- From: "Bart Van Assche" <bart.vanassche@sandisk.com> To: "Christoph Hellwig" <hch@lst.de>, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org Sent: Monday, April 11, 2016 7:32:16 PM Subject: Re: [PATCH 1/2] scsi: add a max_segment_size limitation to struct Scsi_Host On 04/11/2016 03:47 PM, Christoph Hellwig wrote: > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 8106515..04c660d 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -2120,7 +2120,8 @@ static void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) > blk_queue_segment_boundary(q, shost->dma_boundary); > dma_set_seg_boundary(dev, shost->dma_boundary); > > - blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); > + blk_queue_max_segment_size(q, > + min(shost->max_segment_size, dma_get_max_seg_size(dev))); > > if (!shost->use_clustering) > q->limits.cluster = 0; Hello Christoph, Since Scsi_Host.max_segment_size is initialized to zero, shouldn't min() be changed into min_not_zero()? Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Modified patch to use min_not_zero() Ran a number of tests overnight on F/C, SCSI/SAS and SRP (RDMA) and no issues found. Tested-by: Laurence Oberman <loberman@redhat.com> Laurence Oberman Principal Software Maintenance Engineer Red Hat Global Support Services ----- Original Message ----- From: "Laurence Oberman" <loberman@redhat.com> To: "Bart Van Assche" <bart.vanassche@sandisk.com> Cc: "Christoph Hellwig" <hch@lst.de>, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org Sent: Monday, April 11, 2016 7:44:24 PM Subject: Re: [PATCH 1/2] scsi: add a max_segment_size limitation to struct Scsi_Host Thanks Bart Good catch, I completely missed it. Laurence Oberman Principal Software Maintenance Engineer Red Hat Global Support Services ----- Original Message ----- From: "Bart Van Assche" <bart.vanassche@sandisk.com> To: "Christoph Hellwig" <hch@lst.de>, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org Sent: Monday, April 11, 2016 7:32:16 PM Subject: Re: [PATCH 1/2] scsi: add a max_segment_size limitation to struct Scsi_Host On 04/11/2016 03:47 PM, Christoph Hellwig wrote: > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 8106515..04c660d 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -2120,7 +2120,8 @@ static void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) > blk_queue_segment_boundary(q, shost->dma_boundary); > dma_set_seg_boundary(dev, shost->dma_boundary); > > - blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); > + blk_queue_max_segment_size(q, > + min(shost->max_segment_size, dma_get_max_seg_size(dev))); > > if (!shost->use_clustering) > q->limits.cluster = 0; Hello Christoph, Since Scsi_Host.max_segment_size is initialized to zero, shouldn't min() be changed into min_not_zero()? Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 8106515..04c660d 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2120,7 +2120,8 @@ static void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) blk_queue_segment_boundary(q, shost->dma_boundary); dma_set_seg_boundary(dev, shost->dma_boundary); - blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); + blk_queue_max_segment_size(q, + min(shost->max_segment_size, dma_get_max_seg_size(dev))); if (!shost->use_clustering) q->limits.cluster = 0; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index fcfa3d7..f11d3fe 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -621,6 +621,7 @@ struct Scsi_Host { short unsigned int sg_tablesize; short unsigned int sg_prot_tablesize; unsigned int max_sectors; + unsigned int max_segment_size; unsigned long dma_boundary; /* * In scsi-mq mode, the number of hardware queues supported by the LLD.
RDMA drivers need segments that aren't larger than a single HCA page for memory registrations to work properly, so wire up this limitation in the host. While we could just call blk_queue_max_segment_size from ->slave_configure, that would override the global limit based on the DMA device, so let's do it the traditional way by adding a field to the Scsi_Host structure. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/scsi/scsi_lib.c | 3 ++- include/scsi/scsi_host.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)