Message ID | cover.1545319839.git.anatoly.burakov@intel.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06C771BD47; Thu, 20 Dec 2018 16:32:49 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id AC5011BD31 for <dev@dpdk.org>; Thu, 20 Dec 2018 16:32:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2018 07:32:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,377,1539673200"; d="scan'208";a="261038800" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2018 07:32:43 -0800 Received: from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com [10.243.17.64]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id wBKFWg44013520; Thu, 20 Dec 2018 15:32:42 GMT Received: from sivswdev05.ir.intel.com (localhost [127.0.0.1]) by sivswdev05.ir.intel.com with ESMTP id wBKFWgTX020577; Thu, 20 Dec 2018 15:32:42 GMT Received: (from aburakov@localhost) by sivswdev05.ir.intel.com with LOCAL id wBKFWfk8020573; Thu, 20 Dec 2018 15:32:42 GMT From: Anatoly Burakov <anatoly.burakov@intel.com> To: dev@dpdk.org Cc: shahafs@mellanox.com, yskoh@mellanox.com, thomas@monjalon.net, shreyansh.jain@nxp.com Date: Thu, 20 Dec 2018 15:32:37 +0000 Message-Id: <cover.1545319839.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <cover.1544788118.git.anatoly.burakov@intel.com> References: <cover.1544788118.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v3 0/4] Allow using external memory without malloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
Allow using external memory without malloc
|
|
Message
Burakov, Anatoly
Dec. 20, 2018, 3:32 p.m. UTC
Currently, the only way to use externally allocated memory is through rte_malloc API's. While this is fine for a lot of use cases, it may not be suitable for certain other use cases like manual memory management, etc. This patchset adds another API to register memory segments with DPDK (so that API's like ``rte_mem_virt2memseg`` could be relied on by PMD's and such), but not create a malloc heap out of them. Aside from the obvious (not adding memory to a heap), the other major difference between this API and the ``rte_malloc_heap_*`` external memory functions is the fact that no DMA mapping is performed automatically, as well as no mem event callbacks are triggered. This really draws a line in the sand, and there are now two ways of doing things - do everything automatically (using the ``rte_malloc_heap_*`` API's), or do everything manually (``rte_extmem_*`` and future DMA mapping API [1] that would replace ``rte_vfio_dma_map``). This way, the consistency of API is kept, and flexibility is also allowed. [1] https://mails.dpdk.org/archives/dev/2018-November/118175.html v3: - Rebase on latest master v2: - More sanity checking of parameters Anatoly Burakov (4): malloc: separate creating memseg list and malloc heap malloc: separate destroying memseg list and heap data mem: allow registering external memory areas mem: allow usage of non-heap external memory in multiprocess .../prog_guide/env_abstraction_layer.rst | 63 +++++++-- doc/guides/rel_notes/release_19_02.rst | 7 + lib/librte_eal/common/eal_common_memory.c | 119 +++++++++++++++++ lib/librte_eal/common/include/rte_memory.h | 122 ++++++++++++++++++ lib/librte_eal/common/malloc_heap.c | 104 +++++++++++---- lib/librte_eal/common/malloc_heap.h | 15 ++- lib/librte_eal/common/rte_malloc.c | 116 +++++++---------- lib/librte_eal/rte_eal_version.map | 4 + 8 files changed, 447 insertions(+), 103 deletions(-)
Comments
On Thu, 20 Dec 2018 15:32:37 +0000 Anatoly Burakov <anatoly.burakov@intel.com> wrote: > Currently, the only way to use externally allocated memory > is through rte_malloc API's. While this is fine for a lot > of use cases, it may not be suitable for certain other use > cases like manual memory management, etc. > > This patchset adds another API to register memory segments > with DPDK (so that API's like ``rte_mem_virt2memseg`` could > be relied on by PMD's and such), but not create a malloc > heap out of them. > > Aside from the obvious (not adding memory to a heap), the > other major difference between this API and the > ``rte_malloc_heap_*`` external memory functions is the fact > that no DMA mapping is performed automatically, as well as > no mem event callbacks are triggered. > > This really draws a line in the sand, and there are now two > ways of doing things - do everything automatically (using > the ``rte_malloc_heap_*`` API's), or do everything manually > (``rte_extmem_*`` and future DMA mapping API [1] that would > replace ``rte_vfio_dma_map``). This way, the consistency of > API is kept, and flexibility is also allowed. > > [1] https://mails.dpdk.org/archives/dev/2018-November/118175.html Where are the examples for this? Give a sample application maybe. Also there are no test cases.
> Anatoly Burakov (4): > malloc: separate creating memseg list and malloc heap > malloc: separate destroying memseg list and heap data > mem: allow registering external memory areas > mem: allow usage of non-heap external memory in multiprocess Applied, thanks
20/12/2018 17:16, Stephen Hemminger: > On Thu, 20 Dec 2018 15:32:37 +0000 > Anatoly Burakov <anatoly.burakov@intel.com> wrote: > > > Currently, the only way to use externally allocated memory > > is through rte_malloc API's. While this is fine for a lot > > of use cases, it may not be suitable for certain other use > > cases like manual memory management, etc. > > > > This patchset adds another API to register memory segments > > with DPDK (so that API's like ``rte_mem_virt2memseg`` could > > be relied on by PMD's and such), but not create a malloc > > heap out of them. > > > > Aside from the obvious (not adding memory to a heap), the > > other major difference between this API and the > > ``rte_malloc_heap_*`` external memory functions is the fact > > that no DMA mapping is performed automatically, as well as > > no mem event callbacks are triggered. > > > > This really draws a line in the sand, and there are now two > > ways of doing things - do everything automatically (using > > the ``rte_malloc_heap_*`` API's), or do everything manually > > (``rte_extmem_*`` and future DMA mapping API [1] that would > > replace ``rte_vfio_dma_map``). This way, the consistency of > > API is kept, and flexibility is also allowed. > > > > [1] https://mails.dpdk.org/archives/dev/2018-November/118175.html > > Where are the examples for this? Give a sample application maybe. > > Also there are no test cases. It looks to be a big task, but yes, would be nice to have test of external memory allocation in DPDK unit tests.
On 20-Dec-18 5:18 PM, Thomas Monjalon wrote: > 20/12/2018 17:16, Stephen Hemminger: >> On Thu, 20 Dec 2018 15:32:37 +0000 >> Anatoly Burakov <anatoly.burakov@intel.com> wrote: >> >>> Currently, the only way to use externally allocated memory >>> is through rte_malloc API's. While this is fine for a lot >>> of use cases, it may not be suitable for certain other use >>> cases like manual memory management, etc. >>> >>> This patchset adds another API to register memory segments >>> with DPDK (so that API's like ``rte_mem_virt2memseg`` could >>> be relied on by PMD's and such), but not create a malloc >>> heap out of them. >>> >>> Aside from the obvious (not adding memory to a heap), the >>> other major difference between this API and the >>> ``rte_malloc_heap_*`` external memory functions is the fact >>> that no DMA mapping is performed automatically, as well as >>> no mem event callbacks are triggered. >>> >>> This really draws a line in the sand, and there are now two >>> ways of doing things - do everything automatically (using >>> the ``rte_malloc_heap_*`` API's), or do everything manually >>> (``rte_extmem_*`` and future DMA mapping API [1] that would >>> replace ``rte_vfio_dma_map``). This way, the consistency of >>> API is kept, and flexibility is also allowed. >>> >>> [1] https://mails.dpdk.org/archives/dev/2018-November/118175.html >> >> Where are the examples for this? Give a sample application maybe. >> >> Also there are no test cases. > > It looks to be a big task, but yes, would be nice to have test > of external memory allocation in DPDK unit tests. > I imagine if i submitted patches for this, since it's test code, it can go into rc1? Or is that considered a "feature"? I don't think it will be a lot of code, there are only 4 new API calls. Extending extmem autotest should do the trick. Adding a new testpmd mode is also possible but less trivial, and can be postponed to 19.05.