DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Fady Bader <fady@mellanox.com>
Cc: Tal Shnaiderman <talshn@mellanox.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [dpdk-dev] questions about Windows basic memory management patch
Date: Mon, 6 Apr 2020 15:37:34 +0300	[thread overview]
Message-ID: <20200406153734.40cb5c5a@Sovereign> (raw)
In-Reply-To: <AM0PR0502MB4034253D9FB173F686590D66BFC20@AM0PR0502MB4034.eurprd05.prod.outlook.com>

Hi,

> In the "eal/windows: fix rte_page_sizes with Clang on Windows" (http://patches.dpdk.org/patch/67390/) patch I didn't understand the work around that you did and what the problem was.

Clang on Windows always uses uint32_t as an underlying type for enums. As a
consequence, rte_hugepage_sizes cannot contain elements from 4GB onwards,
because they will be clamped to 0, resulting in the following error:

[17/41] Compiling C object lib/76b5a35@@rte_eal@sta/librte_eal_common_malloc_heap.c.obj.
FAILED: lib/76b5a35@@rte_eal@sta/librte_eal_common_malloc_heap.c.obj
clang @lib/76b5a35@@rte_eal@sta/librte_eal_common_malloc_heap.c.obj.rsp
../../../lib/librte_eal/common/malloc_heap.c:69:7: error: duplicate case value: 'RTE_PGSIZE_4G' and 'RTE_PGSIZE_16G' both equal '0'
        case RTE_PGSIZE_16G:
             ^
../../../lib/librte_eal/common/malloc_heap.c:66:7: note: previous case defined here
        case RTE_PGSIZE_4G:
             ^
1 error generated.

Maybe there's a better way to explain it in comments and commit message?

After I moved RTE_PGSIZE_4G and RTE_PGSIZE_16G outside of the enum, I had to
add `-fno-strict-enum` so that these values could be passed to where
rte_page_sizes is expected.


> Regarding rte_mp functions I see you implemented a stub, i.e. empty functions. I don't know why it is needed.

They're called from common EAL memory management routines.


> Just to make sure, does the rte_mem_map function that you implemented replaces Linux's mmap function ?

Yes. DPDK libraries have a few places they need memory-mapped files or
anonymous mappings, so I exported it (librte_mempool being the closest one,
libre_bpf also comes to my mind).


> Lastly, in the patch you implemented functions that were common for Linux and FreeBSD and in order to use them in Windows (e.g. eal_file_truncate that replaced ftruncate) and you got a duplicate code for Linux and FreeBSD, how can we solve this duplication ?

In v2 I'm going to create lib/librte_eal/posix subdirectory and move such
code there. I expect more code to end up there eventually, for example,
dynamic library loading. This possibility was among motivations for EAL
directory split.

There're another duplication that worries me: copy & paste from Linux EAL in
eal_malloc.c and eal_memory.c initialization. However, it this can't be
helped, I'd rather leave it be for now and reconsider it when implementing
advanced memory management.

-- 
Dmitry Kozlyuk

  reply	other threads:[~2020-04-06 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 11:44 Fady Bader
2020-04-06 12:37 ` Dmitry Kozlyuk [this message]
2020-04-06 13:24   ` Thomas Monjalon

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=20200406153734.40cb5c5a@Sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=fady@mellanox.com \
    --cc=talshn@mellanox.com \
    --cc=thomas@monjalon.net \
    /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).