Message ID | 20250327114724.3454268-3-huangjunxian6@hisilicon.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | RDMA/hns: Cleanup and Bugfix | expand |
On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote: > @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) > if (ret) > return ret; > } > - dma_set_max_seg_size(dev, UINT_MAX); > + dma_set_max_seg_size(dev, SZ_2G); Are you sure? What do you think this does in the RDMA stack? Jason
On 2025/4/2 0:39, Jason Gunthorpe wrote: > On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote: >> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) >> if (ret) >> return ret; >> } >> - dma_set_max_seg_size(dev, UINT_MAX); >> + dma_set_max_seg_size(dev, SZ_2G); > > Are you sure? What do you think this does in the RDMA stack? > This is the maximum DMA segment size when mapping ULP's scatter/gather list to DMA address, right? In some cases, it is possible to map a DMA segment exceeding 2G. This exceeds the limit of our HW. Junxian > Jason
On Wed, Apr 02, 2025 at 12:05:36PM +0800, Junxian Huang wrote: > > > On 2025/4/2 0:39, Jason Gunthorpe wrote: > > On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote: > >> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) > >> if (ret) > >> return ret; > >> } > >> - dma_set_max_seg_size(dev, UINT_MAX); > >> + dma_set_max_seg_size(dev, SZ_2G); > > > > Are you sure? What do you think this does in the RDMA stack? > > > > This is the maximum DMA segment size when mapping ULP's scatter/gather > list to DMA address, right? Yes, but only for ib_sge But I think there are other possible problems if your HW cannot implement the full ib_sge :\ Jason
On 2025/4/4 21:27, Jason Gunthorpe wrote: > On Wed, Apr 02, 2025 at 12:05:36PM +0800, Junxian Huang wrote: >> >> >> On 2025/4/2 0:39, Jason Gunthorpe wrote: >>> On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote: >>>> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) >>>> if (ret) >>>> return ret; >>>> } >>>> - dma_set_max_seg_size(dev, UINT_MAX); >>>> + dma_set_max_seg_size(dev, SZ_2G); >>> >>> Are you sure? What do you think this does in the RDMA stack? >>> >> >> This is the maximum DMA segment size when mapping ULP's scatter/gather >> list to DMA address, right? > > Yes, but only for ib_sge > > But I think there are other possible problems if your HW cannot > implement the full ib_sge :\ Why? According to IB spec, the maximum RDMA messgae size is 2GB, so IMHO supporting ib_sge with DMA size larger than 2GB doesn't seem to have much practical meaning. Junxian > > Jason
On Mon, Apr 07, 2025 at 09:51:37PM +0800, Junxian Huang wrote: > > > On 2025/4/4 21:27, Jason Gunthorpe wrote: > > On Wed, Apr 02, 2025 at 12:05:36PM +0800, Junxian Huang wrote: > >> > >> > >> On 2025/4/2 0:39, Jason Gunthorpe wrote: > >>> On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote: > >>>> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) > >>>> if (ret) > >>>> return ret; > >>>> } > >>>> - dma_set_max_seg_size(dev, UINT_MAX); > >>>> + dma_set_max_seg_size(dev, SZ_2G); > >>> > >>> Are you sure? What do you think this does in the RDMA stack? > >>> > >> > >> This is the maximum DMA segment size when mapping ULP's scatter/gather > >> list to DMA address, right? > > > > Yes, but only for ib_sge > > > > But I think there are other possible problems if your HW cannot > > implement the full ib_sge :\ > > Why? According to IB spec, the maximum RDMA messgae size is 2GB, > so IMHO supporting ib_sge with DMA size larger than 2GB doesn't > seem to have much practical meaning. I'm not sure we comprehensively check that everywhere.. Jason
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index ae24c81c9812..18a78f577c1b 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) if (ret) return ret; } - dma_set_max_seg_size(dev, UINT_MAX); + dma_set_max_seg_size(dev, SZ_2G); ret = ib_register_device(ib_dev, "hns_%d", dev); if (ret) { dev_err(dev, "ib_register_device failed!\n");