> From: h...@lst.de <h...@lst.de> > Sent: Tuesday, October 27, 2020 1:41 PM > > On Mon, Oct 26, 2020 at 05:23:48AM +0000, Parav Pandit wrote: > > Hi Christoph, > > > > > From: Jakub Kicinski <k...@kernel.org> > > > Sent: Saturday, October 24, 2020 11:45 PM > > > > > > CC: rdma, looks like rdma from the stack trace > > > > > > On Fri, 23 Oct 2020 20:07:17 -0700 syzbot wrote: > > > > syzbot has found a reproducer for the following issue on: > > > > > > > > HEAD commit: 3cb12d27 Merge tag 'net-5.10-rc1' of > git://git.kernel.org/.. > > > > In [1] you mentioned that dma_mask should not be set for dma_virt_ops. > > So patch [2] removed it. > > > > But check to validate the dma mask for all dma_ops was added in [3]. > > > > What is the right way? Did I misunderstood your comment about > dma_mask in [1]? > > No, I did not say we don't need the mask. I said copying over the various > dma-related fields from the parent is bogus. > > I think rxe (and ther other drivers/infiniband/sw drivers) need a simple > dma_coerce_mask_and_coherent and nothing else.
I see. Does below fix make sense? Is DMA_MASK_NONE correct? >From cfad78c35788b4ff604abedd96559500c5fd2a72 Mon Sep 17 00:00:00 2001 From: Parav Pandit <pa...@nvidia.com> Date: Tue, 27 Oct 2020 14:20:07 +0200 Subject: [PATCH] RDMA: Fix software RDMA drivers for dma mapping error A cited commit in fixes tag avoided setting dma_mask of the ib_device. Commit [1] made dma_mask as mandetory field to be setup even for dma_virt_ops based dma devices. Fix it by setting empty DMA MASK for software based RDMA devices. [1] commit: f959dcd6ddfd2 ("dma-direct: Fix potential NULL pointer dereference") Reported-by: syzbot+34dc2fea3478e659a...@syzkaller.appspotmail.com Fixes: e0477b34d9d1 ("RDMA: Explicitly pass in the dma_device to ib_register_device") Signed-off-by: Parav Pandit <pa...@nvidia.com> --- drivers/infiniband/sw/rdmavt/vt.c | 5 +++-- drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +++- drivers/infiniband/sw/siw/siw_main.c | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c index 52218684ad4a..1b456f4d4fcf 100644 --- a/drivers/infiniband/sw/rdmavt/vt.c +++ b/drivers/infiniband/sw/rdmavt/vt.c @@ -580,8 +580,9 @@ int rvt_register_device(struct rvt_dev_info *rdi) /* DMA Operations */ rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; - dma_set_coherent_mask(&rdi->ibdev.dev, - rdi->ibdev.dev.parent->coherent_dma_mask); + ret = dma_coerce_mask_and_coherent(&rdi->ibdev.dev, DMA_MASK_NONE); + if (ret) + goto bail_wss; /* Protection Domain */ spin_lock_init(&rdi->n_pds_lock); diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 1fc022362fbe..357787688293 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -1130,7 +1130,9 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) rxe->ndev->dev_addr); dev->dev.dma_parms = &rxe->dma_parms; dma_set_max_seg_size(&dev->dev, UINT_MAX); - dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev)); + err = dma_coerce_mask_and_coherent(&dev->dev, DMA_MASK_NONE); + if (err) + return err; dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c index ca8bc7296867..d3dc50a42dab 100644 --- a/drivers/infiniband/sw/siw/siw_main.c +++ b/drivers/infiniband/sw/siw/siw_main.c @@ -384,8 +384,9 @@ static struct siw_device *siw_device_create(struct net_device *netdev) base_dev->dev.parent = parent; base_dev->dev.dma_parms = &sdev->dma_parms; dma_set_max_seg_size(&base_dev->dev, UINT_MAX); - dma_set_coherent_mask(&base_dev->dev, - dma_get_required_mask(&base_dev->dev)); + if (dma_coerce_mask_and_coherent(&base_dev->dev, DMA_MASK_NONE)) + goto error; + base_dev->num_comp_vectors = num_possible_cpus(); xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1); -- 2.26.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel