Re: Kernel warning at drivers/infiniband/core/rw.c:349

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2021-10-12 11:34 p.m., Bart Van Assche wrote:
> On 10/12/21 17:30, Logan Gunthorpe wrote:
>> Best I can see from the code is that someone is passing an sg_cnt of
>> zero. Previously that would have returned -ENOMEM, but now it might be
>> ignored, in which case it would hit that WARNING and return -EIO.
> 
> That is not what is happening. The debug patch shown below learned me
> the following:
> * The sg_cnt argument of rdma_rw_ctx_init() is not zero.
> * After the rdma_rw_map_sgtable() call, sgt.nents is zero.
> 
> The debug patch that I used is as follows:

Ah, hmm. Perhaps it's this... The virt path in
ib_dma_map_sgtable_attrs() doesn't set the sgt.nents...

Maybe try this something like the patch below.

Thanks,

Logan

--


diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 4b50d9a3018a..4ba642fc8a19 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -4097,8 +4097,13 @@ static inline int ib_dma_map_sgtable_attrs(struct ib_dev>
                                           enum dma_data_direction direction,
                                           unsigned long dma_attrs)
 {
+       int nents;
+
        if (ib_uses_virt_dma(dev)) {
-               ib_dma_virt_map_sg(dev, sgt->sgl, sgt->orig_nents);
+               nents = ib_dma_virt_map_sg(dev, sgt->sgl, sgt->orig_nents);
+               if (!nents)
+                       return -EIO;
+               sgt->nents = nents;
                return 0;
        }
        return dma_map_sgtable(dev->dma_device, sgt, direction, dma_attrs);



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux