From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0F4AA0093; Mon, 15 Jun 2020 02:44:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1DBCC4C87; Mon, 15 Jun 2020 02:44:04 +0200 (CEST) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id 0712225B3 for ; Mon, 15 Jun 2020 02:44:03 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id q19so17098272lji.2 for ; Sun, 14 Jun 2020 17:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5lcaWBxBxcweM9MnYExxVMdu2CrahZO137olyZ8P/i0=; b=Fi7OZFjq9MJ8SdaQWFR8rN5gOxHog89LTMgAiXnb/QCNbVQjY2VIABNJwi1B1c6sdd +I51rDoINQVx2DpnQatXU28pN2TntyysszWU/IIK1DSdAP3VYstclnYc2gJWCF0uVIBy 9D5EK8Lqxhkn2A/aWVz+0q3GwdvAWgYgCjAXq749yM7WP/jkVCmDeADD0ZAKvDiQLruv 7UThvYycBC09bQXtrzJGEDV3eI8/coW/oaXyj/KotpLhK4RxQGtT2CpTRw1Dt67OQZ9K 0Wux0Kn7uL7cIIe6wq1LLI+eDdWCzZWRjkSzMG5OqBCBFgfbvKxBRMqNhUpGnoHWacPU Y8lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5lcaWBxBxcweM9MnYExxVMdu2CrahZO137olyZ8P/i0=; b=Jt7js1dui2HtzzgJaVa/NgP5A2AcfrxFT2CzWdAAkhgXzDrJ/EPHFveQzB0Kz6ru5Q uCOjhE7diBUIrmF/kDGN9KmSC3XcJHFcxzYmzqe7gUv0DuY4xy8SuW4G/siqRxbrRlei jf6fFaFmKyfBYg4Cs+Ck6OHETS9ZLqSqzc5yA5RNkzjmwAFb2bQlwI8Tk9dIrXfbaHow ZRaYonUXANTGebEKcQJUGyEftYSeQ7Ebpg+q5QHU/Qi9LlgvWZwMTbaRIH4zaGxMTewr JqQIM5oe6LuP1qS+vD+TjofmszELgoiD+D3HK6M/rT27zfJbJdGfzhy8ooqzcyJcHvkq UCqQ== X-Gm-Message-State: AOAM53059axEq03bgXUCThkzc7CNLCbN9xPYj6aRP1GOYrJz97tJ6sbP Jt3Tvy/TMxD69l3W29mUt+zDcW9RqXA= X-Google-Smtp-Source: ABdhPJw2R+BuA33MORcbMlHxIoIv+Z0BQOYHVu9RMt49/H2aV33DlFTQQDKzms6UXRNyL3wwGhuyWw== X-Received: by 2002:a2e:1558:: with SMTP id 24mr11509262ljv.202.1592181842162; Sun, 14 Jun 2020 17:44:02 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id f19sm4176342lfk.24.2020.06.14.17.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 17:44:01 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Malloy , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Dmitry Kozlyuk Date: Mon, 15 Jun 2020 03:43:42 +0300 Message-Id: <20200615004354.14380-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200610142730.31376-1-dmitry.kozliuk@gmail.com> References: <20200610142730.31376-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v9 00/12] Windows basic memory management 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" Note for v9: rte_eal_memory.h renamed, dependent patchsets have to be updated. This patchset implements basic MM with the following features: * Hugepages are dynamically allocated in user-mode. * Only 2MB hugepages are supported. * IOVA is always PA, obtained through kernel-mode driver. * No 32-bit support (presumably not demanded). * Ni multi-process support (it is forcefully disabled). * No-huge mode for testing without IOVA is available. Testing revealed Windows Server 2019 does not allow allocating hugepage memory at a reserved address, despite advertised API. So allocator has to temporary free the region to be allocated. This creates in inherent race condition. This issue is being discussed with Microsoft privately. New EAL public functions for memory mapping are introduced to mitigate OS differences in DPDK libraries and applications: rte_mem_map, rte_mem_unmap, rte_mem_lock, rte_mem_page_size. To support common MM routines, internal wrappers for low-level memory reservation and file management are introduced. These changes affect Linux and FreeBSD EAL. Shared code is placed unded /unix/ subdirectory (suggested by Thomas). To avoid code duplication between Linux and Windows EAL, common code for EALs supporting dynamic memory allocation is extracted (discussed with Anatoly Burakov in v4 thread). This is a separate patch to ease the review, but it can be merged with the previous one. EAL tracepoints save size_t values as long, which is invalid on Windows. New size_t emitter for tracepoints is introduced (suggested by Jerin Jacob to Fady Bader, see [1]). Also, to avoid workaround in every file using the tracepoints, stubs are added to Windows EAL. Entire is imported from FreeBSD, replacing existing partial import. There is already a license exception for this file. The file is imported as-is, so it causes a bunch of checkpatch warnings. [1]: http://mails.dpdk.org/archives/dev/2020-May/168076.html --- v9: * Fix build on 32-bit and FreeBSD. * Rename rte_eal_memory.h to rte_eal_paging.h. * Do not use rte_panic() in library code. * Fix typos, comments, string formatting. * Split documentation commits. v8: * Log eal_memseg_list_alloc() failure at caller sites (Anatoly Burakov). v7: * Change EAL internal file management API (Neil Horman). v6: * Fix 32-bit build on x86 (CI). * Fix Makefile build (Anatoly Burakov, Thomas Monjalon). * Restore 32-bit common code (Anatoly Burakov). * Fix error reporting in memory management (Anatoly Burakov). * Add Doxygen comment for size_t tracepoint emitter (Jerin Jacob). * Update MAINTAINERS for new files and new code (Thomas Monjalon). * Rename rte_get_page_size to rte_mem_page_size. * Mark DPDK-only wrappers internal, move them to separate file. * Get rid of warnings in enabled common code with Clang on Windows. v5: * Fix allocation and deallocation on Windows Server (Fady Bader). * Replace remaining VirtualFree with VirtualFreeEx (Ranjit Menon). * Fix errors in eal_get_virtual_area (Anatoly Burakov). * Fix error handling and documentation for rte_mem_lock (Anatoly Burakov). * Extract common code for EALs w/dynamic allocation (Anatoly Burakov). * Use POSIX value for rte_errno after rte_mem_unmap() on Windows. * Add stubs to use tracing functions without workarounds. v4: * Rebase on ToT, drop patches merged into master. * Rearrange patches to split Windows code (Jerin). * Fix Linux and FreeBSD build with make (Ophir). * Use int instead of enum to hold a set of flags (Anatoly). * Rename eal_mem_reserve items and fix their description (Anatoly). * Add eal_mem_set_dump() wrapper around madvise (Anatoly). * Don't claim Windows Server 2016 support due to lack of API (Tal). * Replace enum rte_page_sizes with a set of #defines (Jerin). * Fix documentation, SPDX tags, logging (Thomas). v3: * Fix Linux build on and aarch64 and 32-bit x86 (reported by CI). * Fix logic and error handling while allocating segments. * Fix Unix rte_mem_map(): return NULL on failure. * Fix some checkpatch.sh issues: * Do not return positive errno, use DWORD for GetLastError(). * Make dpdk-kmods source files non-executable. * Improve GSG for Windows Server (suggested by Ranjit Menon). v2: * Rebase on ToT. Move all new code shared between Linux and FreeBSD to /unix/ subdirectory, also factor out some existing code there. * Improve description of Clang issue with rte_page_sizes on Windows. Restore -fstrict-enum for EAL. Check running, not target compiler. * Use EAL prefix for private facilities instead if RTE. * Improve documentation comments for new functions. * Remove co-installer for virt2phys. Add a typecast for clarity. * Document virt2phys in user guide, improve its own README. * Explicitly and forcefully disable multi-process. Dmitry Kozlyuk (12): eal: replace rte_page_sizes with a set of constants eal: introduce internal wrappers for file operations eal: introduce memory management wrappers eal/mem: extract common code for memseg list initialization eal/mem: extract common code for dynamic memory allocation trace: add size_t field emitter eal/windows: add tracing support stubs eal/windows: replace sys/queue.h with a complete one from FreeBSD eal/windows: improve CPU and NUMA node detection doc/windows: split build and run instructions eal/windows: initialize hugepage info eal/windows: implement basic memory management MAINTAINERS | 7 + config/meson.build | 12 +- doc/guides/rel_notes/release_20_08.rst | 2 + doc/guides/windows_gsg/build_dpdk.rst | 20 - doc/guides/windows_gsg/index.rst | 1 + doc/guides/windows_gsg/run_apps.rst | 95 +++ lib/librte_eal/common/eal_common_dynmem.c | 521 +++++++++++++ lib/librte_eal/common/eal_common_fbarray.c | 71 +- lib/librte_eal/common/eal_common_memory.c | 157 +++- lib/librte_eal/common/eal_common_thread.c | 5 +- lib/librte_eal/common/eal_private.h | 254 ++++++- lib/librte_eal/common/meson.build | 16 + lib/librte_eal/common/rte_malloc.c | 1 + lib/librte_eal/freebsd/Makefile | 5 + lib/librte_eal/freebsd/eal_memory.c | 102 +-- lib/librte_eal/include/rte_eal_paging.h | 98 +++ lib/librte_eal/include/rte_eal_trace.h | 8 +- lib/librte_eal/include/rte_memory.h | 23 +- lib/librte_eal/include/rte_trace_point.h | 3 + lib/librte_eal/linux/Makefile | 6 + lib/librte_eal/linux/eal_memalloc.c | 5 +- lib/librte_eal/linux/eal_memory.c | 617 +-------------- lib/librte_eal/meson.build | 4 + lib/librte_eal/rte_eal_exports.def | 119 +++ lib/librte_eal/rte_eal_version.map | 9 + lib/librte_eal/unix/eal_file.c | 80 ++ lib/librte_eal/unix/eal_unix_memory.c | 152 ++++ lib/librte_eal/unix/meson.build | 7 + lib/librte_eal/windows/eal.c | 114 ++- lib/librte_eal/windows/eal_file.c | 125 +++ lib/librte_eal/windows/eal_hugepages.c | 108 +++ lib/librte_eal/windows/eal_lcore.c | 205 +++-- lib/librte_eal/windows/eal_memalloc.c | 441 +++++++++++ lib/librte_eal/windows/eal_memory.c | 710 ++++++++++++++++++ lib/librte_eal/windows/eal_mp.c | 103 +++ lib/librte_eal/windows/eal_windows.h | 90 ++- lib/librte_eal/windows/include/meson.build | 1 + lib/librte_eal/windows/include/rte_os.h | 17 + .../windows/include/rte_virt2phys.h | 34 + lib/librte_eal/windows/include/rte_windows.h | 2 + lib/librte_eal/windows/include/sys/queue.h | 663 ++++++++++++++-- lib/librte_eal/windows/include/unistd.h | 3 + lib/librte_eal/windows/meson.build | 7 + lib/librte_mempool/rte_mempool_trace.h | 10 +- 44 files changed, 4088 insertions(+), 945 deletions(-) create mode 100644 doc/guides/windows_gsg/run_apps.rst create mode 100644 lib/librte_eal/common/eal_common_dynmem.c create mode 100644 lib/librte_eal/include/rte_eal_paging.h create mode 100644 lib/librte_eal/unix/eal_file.c create mode 100644 lib/librte_eal/unix/eal_unix_memory.c create mode 100644 lib/librte_eal/unix/meson.build create mode 100644 lib/librte_eal/windows/eal_file.c create mode 100644 lib/librte_eal/windows/eal_hugepages.c create mode 100644 lib/librte_eal/windows/eal_memalloc.c create mode 100644 lib/librte_eal/windows/eal_memory.c create mode 100644 lib/librte_eal/windows/eal_mp.c create mode 100644 lib/librte_eal/windows/include/rte_virt2phys.h -- 2.25.4