DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: David Marchand <david.marchand@redhat.com>,
	"Wangyu (Eric)" <seven.wangyu@huawei.com>
Cc: dengxiaofeng <dengxiaofeng@huawei.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	Linuxarm <linuxarm@huawei.com>, "humin (Q)" <humin29@huawei.com>,
	"Liyuan (Larry)" <Larry.T@huawei.com>
Subject: Re: [dpdk-dev] [PATCH v2] bus/pci: resolve multiple NICs address conflicts
Date: Wed, 6 Nov 2019 11:14:48 +0000	[thread overview]
Message-ID: <8c50d8b6-4149-f101-fe90-b4c83f9b2b40@intel.com> (raw)
In-Reply-To: <CAJFAV8ybDuutVoeFj-pWp6SbsGMxXYQt3aT+85ezx+bObXA2Tg@mail.gmail.com>

On 06-Nov-19 7:37 AM, David Marchand wrote:
> On Wed, Nov 6, 2019 at 7:16 AM Wangyu (Eric) <seven.wangyu@huawei.com> wrote:
>>
>>
>> In 64K pagesize system, DPDK will read the size NIC need in uio/uio1/maps/map1/size,  when the size small than pagesize(e.g.,82599 is 16K), dev->mem_resource[i].len will be 16K, but the mmap function applies for at least 1 page size, which is 64K.
>> Then second NIC mmap, start address is first NIC address + 16K, which already used by first NIC.
> 
> Do you see this issue with vfio?
> 
> 
>> So if change the size to first NIC address + 64K, problem solved.
> 
> You are hacking a description of the device resources to workaround a problem.
> This patch is a no go for me.
> 
> Maybe there is something to do with the hint passed to mmap in uio case.
> Adding Anatoly to the loop.
> 
> 

I did a quick code inspection for VFIO and UIO. We do the same thing in 
both, so both code paths can be for all intents and purposes considered 
equivalent.

To reserve mappings for addresses, we start at some arbitrary address 
(find_max_va_end()), and start mapping from there. Then, we do an mmap() 
*and overwrite* whatever address we expected to get, and then the next 
address is (current.addr + current.len).

The mmap() is called without MAP_FIXED, so we get an address the kernel 
feels comfortable for us to get. Meaning, even if the initial address 
hint was not page-aligned, the return value from mmap() will be 
page-aligned. It seems to me that your platform/kernel does not do that, 
and allows mmap() to return page-unaligned addresses. I would strongly 
suggest checking the mmap() return address on your platform (in either 
UIO or VFIO - they both do it about the same way).

We could work around that by doing (next_addr = 
RTE_PTR_ALIGN(current.addr + current.len, pagesize)), but to me it seems 
like a bug in your kernel/mmap() implementation. This is an easy fix 
though, and i'm sure we can put in a workaround like i described.

-- 
Thanks,
Anatoly

  parent reply	other threads:[~2019-11-06 11:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  7:26 Wangyu (Turing Solution Development Dep)
2019-11-05 14:33 ` David Marchand
     [not found]   ` <D3165BB52137B64493C4E18DC69F10D62C8E7CDC@DGGEMM501-MBX.china.huawei.com>
2019-11-06  6:15     ` [dpdk-dev] 答复: " Wangyu (Eric)
2019-11-06  7:37       ` [dpdk-dev] " David Marchand
2019-11-06 10:35         ` Burakov, Anatoly
     [not found]           ` <D3165BB52137B64493C4E18DC69F10D62C8E903A@DGGEMM501-MBX.china.huawei.com>
2019-11-07  3:17             ` [dpdk-dev] 答复: " Wangyu (Eric)
2019-11-06 11:14         ` Burakov, Anatoly [this message]
     [not found]           ` <D3165BB52137B64493C4E18DC69F10D62C8E9085@DGGEMM501-MBX.china.huawei.com>
2019-11-07  5:44             ` Wangyu (Eric)
2019-11-07 12:24               ` Burakov, Anatoly
     [not found]                 ` <D3165BB52137B64493C4E18DC69F10D62C8F159A@dggemm521-mbx.china.huawei.com>
2019-11-11  9:37                   ` [dpdk-dev] 答复: " Wangyu (Eric)
2019-11-11 13:07                     ` Burakov, Anatoly
2019-11-12  6:37                     ` Gavin Hu (Arm Technology China)
2019-11-06 10:29       ` [dpdk-dev] " Burakov, Anatoly

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=8c50d8b6-4149-f101-fe90-b4c83f9b2b40@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=Larry.T@huawei.com \
    --cc=david.marchand@redhat.com \
    --cc=dengxiaofeng@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.com \
    --cc=linuxarm@huawei.com \
    --cc=seven.wangyu@huawei.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;
as well as URLs for NNTP newsgroup(s).