public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Saleem, Shiraz" <shiraz.saleem@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	Doug Ledford <dledford@redhat.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"Ruhl, Michael J" <michael.j.ruhl@intel.com>,
	"Weiny, Ira" <ira.weiny@intel.com>,
	Adit Ranadive <aditr@vmware.com>,
	Gal Pressman <galpress@amazon.com>,
	Selvin Xavier <selvin.xavier@broadcom.com>
Subject: Re: [PATCH 2/4] RDMA/core: Set DMA parameters correctly
Date: Mon, 21 Oct 2019 11:10:12 -0700	[thread overview]
Message-ID: <4d1fb001-ead8-81ce-893e-1ff94214c389@acm.org> (raw)
In-Reply-To: <9DD61F30A802C4429A01CA4200E302A7B6B0D6EE@fmsmsx124.amr.corp.intel.com>

On 10/21/19 10:44 AM, Saleem, Shiraz wrote:
>> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
>> index a667636f74bf..a523d844ad9d 100644
>> --- a/drivers/infiniband/core/device.c
>> +++ b/drivers/infiniband/core/device.c
>> @@ -1199,9 +1199,21 @@ 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 */
>> -	dma_set_max_seg_size(device->dma_device, SZ_2G);
>>
>> +	if (!device->dev.dma_parms) {
>> +		if (parent) {
>> +			/*
>> +			 * The caller did not provide DMA parameters, so
>> +			 * 'parent' probably represents a PCI device. The PCI
>> +			 * core sets the maximum segment size to 64
>> +			 * KB. Increase this parameter to 2G.
>> +			 */
>> +			device->dev.dma_parms = parent->dma_parms;
>> +			dma_set_max_seg_size(device->dma_device, SZ_2G);
> 
> Did you mean dma_set_max_seg_size(&device->dev, SZ_2G)?

Have you realized that that call has the same effect as what I proposed 
since both devices share the dma_parms parameter?

> device->dma_device could be pointing to parent if the caller
> did not provide dma_ops. So wont this update the parent device
> dma params?

That's correct, this will update the parent device DMA parameters.

> Also do we want to ensure all callers device max_seg_sz
> params >= threshold (=2G)? If so, perhaps we can do something
> similar to vb2_dma_contig_set_max_seg_size()
> 
> https://elixir.bootlin.com/linux/v5.4-rc2/source/drivers/media/common/videobuf2/videobuf2-dma-contig.c#L734

It depends on what PCIe RDMA adapters support. If all PCIe RDMA adapters 
supported by the Linux kernel support max_segment_size >= 2G the above 
code is probably the easiest approach.

Thanks,

Bart.

  reply	other threads:[~2019-10-21 18:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  2:10 [PATCH 0/4] Fixes related to the DMA max_segment_size parameter Bart Van Assche
2019-10-21  2:10 ` [PATCH 1/4] RDMA/core: Fix ib_dma_max_seg_size() Bart Van Assche
2019-10-21 14:09   ` Jason Gunthorpe
2019-10-21 15:03     ` Bart Van Assche
2019-10-21 15:27       ` Jason Gunthorpe
2019-10-21 15:56         ` Bart Van Assche
2019-10-21  2:10 ` [PATCH 2/4] RDMA/core: Set DMA parameters correctly Bart Van Assche
2019-10-21 14:10   ` Jason Gunthorpe
2019-10-21 16:26     ` Bart Van Assche
2019-10-21 17:44       ` Saleem, Shiraz
2019-10-21 18:10         ` Bart Van Assche [this message]
2019-10-21 20:32           ` Saleem, Shiraz
2019-10-22 14:40           ` Jason Gunthorpe
2019-10-22 22:11             ` Bart Van Assche
2019-10-21  2:10 ` [PATCH 3/4] rdma_rxe: Increase DMA max_segment_size parameter Bart Van Assche
2019-10-21  2:10 ` [PATCH 4/4] siw: " Bart Van Assche
2019-10-21  9:36   ` Bernard Metzler
2019-10-21 13:53     ` Bart Van Assche

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=4d1fb001-ead8-81ce-893e-1ff94214c389@acm.org \
    --to=bvanassche@acm.org \
    --cc=aditr@vmware.com \
    --cc=dledford@redhat.com \
    --cc=galpress@amazon.com \
    --cc=ira.weiny@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michael.j.ruhl@intel.com \
    --cc=selvin.xavier@broadcom.com \
    --cc=shiraz.saleem@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox