All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Gal Pressman <galpress@amazon.com>
Cc: Leon Romanovsky <leon@kernel.org>, Christoph Hellwig <hch@lst.de>,
	RDMA mailing list <linux-rdma@vger.kernel.org>
Subject: Re: ib_umem_get and DMA_API_DEBUG question
Date: Wed, 28 Aug 2019 11:15:56 -0300	[thread overview]
Message-ID: <20190828141556.GA933@ziepe.ca> (raw)
In-Reply-To: <c8c058a9-f9ac-0228-646c-0ae1739652a2@amazon.com>

On Tue, Aug 27, 2019 at 04:53:01PM +0300, Gal Pressman wrote:
> On 27/08/2019 16:37, Jason Gunthorpe wrote:
> > On Tue, Aug 27, 2019 at 04:22:51PM +0300, Gal Pressman wrote:
> >> On 27/08/2019 16:17, Jason Gunthorpe wrote:
> >>> On Tue, Aug 27, 2019 at 03:53:29PM +0300, Gal Pressman wrote:
> >>>> On 27/08/2019 15:00, Jason Gunthorpe wrote:
> >>>>> On Tue, Aug 27, 2019 at 11:28:20AM +0300, Gal Pressman wrote:
> >>>>>> On 26/08/2019 17:05, Gal Pressman wrote:
> >>>>>>> Hi all,
> >>>>>>>
> >>>>>>> Lately I've been seeing DMA-API call traces on our automated testing runs which
> >>>>>>> complain about overlapping mappings of the same cacheline [1].
> >>>>>>> The problem is (most likely) caused due to multiple calls to ibv_reg_mr with the
> >>>>>>> same address, which as a result DMA maps the same physical addresses more than 7
> >>>>>>> (ACTIVE_CACHELINE_MAX_OVERLAP) times.
> >>>>>>
> >>>>>> BTW, on rare occasions I'm seeing the boundary check in check_sg_segment [1]
> >>>>>> fail as well. I don't have a stable repro for it though.
> >>>>>>
> >>>>>> Is this a known issue as well? The comment there states it might be a bug in the
> >>>>>> DMA API implementation, but I'm not sure.
> >>>>>>
> >>>>>> [1] https://elixir.bootlin.com/linux/v5.3-rc3/source/kernel/dma/debug.c#L1230
> >>>>>
> >>>>> Maybe we are missing a dma_set_seg_boundary ?
> >>>>>
> >>>>> PCI uses low defaults:
> >>>>>
> >>>>> 	dma_set_max_seg_size(&dev->dev, 65536);
> >>>>> 	dma_set_seg_boundary(&dev->dev, 0xffffffff);
> >>>>
> >>>> What would you set it to?
> >>>
> >>> Full 64 bits.
> >>>
> >>> For umem the driver is responsible to chop up the SGL as required, not
> >>> the core code.
> >>
> >> But wouldn't this possibly hide driver bugs? Perhaps even in other flows?
> > 
> > The block stack also uses this information, I've been meaning to check
> > if we should use dma_attrs in umem so we can have different
> > parameters.
> > 
> > I'm not aware of any issue with the 32 bit boundary on RDMA devices..
> 
> So something like this?
> 
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index 99c4a55545cf..2aa0e48f8dac 100644
> +++ b/drivers/infiniband/core/device.c
> @@ -1199,8 +1199,9 @@ static void setup_dma_device(struct ib_device *device)
>  		WARN_ON_ONCE(!parent);
>  		device->dma_device = parent;
>  	}
> -	/* Setup default max segment size for all IB devices */
> +	/* Setup default DMA properties for all IB devices */
>  	dma_set_max_seg_size(device->dma_device, SZ_2G);
> +	dma_set_seg_boundary(device->dma_device, U64_MAX);
>  
>  }

Hum. So there are two issues here, the SGL combiner in umem is
supposed to respect the DMA settings, so it should be fixed to check
boundary as well as seg_size too.

Then we can add the above as well. AFAIK all PCI-E HW is OK to do
arbitary DMAs.

Jason  

      reply	other threads:[~2019-08-28 14:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 14:05 ib_umem_get and DMA_API_DEBUG question Gal Pressman
2019-08-26 14:23 ` Leon Romanovsky
2019-08-26 14:39   ` Gal Pressman
2019-08-26 14:39 ` Jason Gunthorpe
2019-08-27  8:28 ` Gal Pressman
2019-08-27 12:00   ` Jason Gunthorpe
2019-08-27 12:53     ` Gal Pressman
2019-08-27 13:17       ` Jason Gunthorpe
2019-08-27 13:22         ` Gal Pressman
2019-08-27 13:37           ` Jason Gunthorpe
2019-08-27 13:53             ` Gal Pressman
2019-08-28 14:15               ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190828141556.GA933@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=galpress@amazon.com \
    --cc=hch@lst.de \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.