From patchwork Fri Jul 6 13:17:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 42498 Return-Path: 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 96C7C1BE4F; Fri, 6 Jul 2018 15:17:38 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0D09F1BE41 for ; Fri, 6 Jul 2018 15:17:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2018 06:17:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,316,1526367600"; d="scan'208";a="54516396" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga007.jf.intel.com with ESMTP; 06 Jul 2018 06:17:33 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w66DHX2r027466; Fri, 6 Jul 2018 14:17:33 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w66DHWOW003739; Fri, 6 Jul 2018 14:17:32 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w66DHWFH003731; Fri, 6 Jul 2018 14:17:32 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: srinath.mannam@broadcom.com, scott.branden@broadcom.com, ajit.khaparde@broadcom.com Date: Fri, 6 Jul 2018 14:17:21 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [RFC 00/11] Support externally allocated memory in DPDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This is a proposal to enable using externally allocated memory in DPDK. In a nutshell, here is what is being done here: - Index malloc heaps by NUMA node index, rather than NUMA node itself - Add identifier string to malloc heap, to uniquely identify it - Allow creating named heaps and add/remove memory to/from those heaps - Allocate memseg lists at runtime, to keep track of IOVA addresses of externally allocated memory - If IOVA addresses aren't provided, use RTE_BAD_IOVA - Allow malloc and memzones to allocate from named heaps The responsibility to ensure memory is accessible before using it is on the shoulders of the user - there is no checking done with regards to validity of the memory (nor could there be...). The following limitations are present: - No multiprocess support - No thread safety There is currently no way to allocate memory during initialization stage, so even if multiprocess support is added, it is not guaranteed to work because of underlying issues with mapping fbarrays in secondary processes. This is not an issue in single process scenario, but it may be an issue in a multiprocess scenario in case where primary doesn't intend to share the externally allocated memory, yet adding such memory could fail because some other process failed to attach to this shared memory when it wasn't needed. Anatoly Burakov (11): mem: allow memseg lists to be marked as external eal: add function to rerieve socket index by socket ID malloc: index heaps using heap ID rather than NUMA node malloc: add name to malloc heaps malloc: enable retrieving statistics from named heaps malloc: enable allocating from named heaps malloc: enable creating new malloc heaps malloc: allow adding memory to named heaps malloc: allow removing memory from named heaps malloc: allow destroying heaps memzone: enable reserving memory from named heaps config/common_base | 1 + lib/librte_eal/common/eal_common_lcore.c | 15 + lib/librte_eal/common/eal_common_memory.c | 51 +++- lib/librte_eal/common/eal_common_memzone.c | 283 ++++++++++++++---- .../common/include/rte_eal_memconfig.h | 5 +- lib/librte_eal/common/include/rte_lcore.h | 19 +- lib/librte_eal/common/include/rte_malloc.h | 158 +++++++++- .../common/include/rte_malloc_heap.h | 2 + lib/librte_eal/common/include/rte_memzone.h | 183 +++++++++++ lib/librte_eal/common/malloc_heap.c | 277 +++++++++++++++-- lib/librte_eal/common/malloc_heap.h | 26 ++ lib/librte_eal/common/rte_malloc.c | 197 +++++++++++- lib/librte_eal/rte_eal_version.map | 10 + 13 files changed, 1118 insertions(+), 109 deletions(-)