Re: [PATCH 1/8] scsi: add a host / host template field for the virt boundary

From: Bart Van Assche
Date: Mon Jun 17 2019 - 16:56:04 EST


On 6/17/19 5:19 AM, Christoph Hellwig wrote:
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 65d0a10c76ad..d333bb6b1c59 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1775,7 +1775,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
dma_set_seg_boundary(dev, shost->dma_boundary);
blk_queue_max_segment_size(q, shost->max_segment_size);
- dma_set_max_seg_size(dev, shost->max_segment_size);
+ blk_queue_virt_boundary(q, shost->virt_boundary_mask);
+ dma_set_max_seg_size(dev, queue_max_segment_size(q));

Although this looks fine to me for LLDs that own a PCIe device, I doubt this is correct for SCSI LLDs that share a PCIe device with other ULP drivers. From the RDMA core:

/* Setup default max segment size for all IB devices */
dma_set_max_seg_size(device->dma_device, SZ_2G);

Will instantiating a SCSI host (iSER or SRP) for an RDMA adapter cause the maximum segment size to be modified for all ULP drivers associated with that HCA?

Thanks,

Bart.