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 CE576A00BE; Wed, 29 Apr 2020 03:18:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5E8FE1D6DB; Wed, 29 Apr 2020 03:18:24 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 555671D6DA for ; Wed, 29 Apr 2020 03:18:22 +0200 (CEST) IronPort-SDR: kKlfce8x01gzujEE2xIpHcsA1LK2e2X2huED/93yRKc4sJ9io7WjG1ObS+l7EnX6h6uLTaoJM7 wwUnBUHlq3ow== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 18:18:21 -0700 IronPort-SDR: N6jWo1kc9QczR/POGLohGMHyqVYVp0uNt91miDixgdFwRIW+vRFG8uWRQQv7Wv60UVDNFd2rYG p1MREwvIxAmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,329,1583222400"; d="scan'208";a="293050002" Received: from rmenon-mobl.amr.corp.intel.com (HELO [10.212.38.45]) ([10.212.38.45]) by fmsmga002.fm.intel.com with ESMTP; 28 Apr 2020 18:18:20 -0700 To: Dmitry Kozlyuk , dev@dpdk.org Cc: "Dmitry Malloy (MESHCHANINOV)" , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Thomas Monjalon , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , John McNamara , Marko Kovacevic , Anatoly Burakov References: <20200410164342.1194634-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-9-dmitry.kozliuk@gmail.com> From: Ranjit Menon Message-ID: <93aab43e-8e36-023a-651a-fb82bc12c186@intel.com> Date: Tue, 28 Apr 2020 18:18:20 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428235015.2820677-9-dmitry.kozliuk@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 8/8] eal/windows: implement 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" On 4/28/2020 4:50 PM, Dmitry Kozlyuk wrote: > Basic memory management supports core libraries and PMDs operating in > IOVA as PA mode. It uses a kernel-mode driver, virt2phys, to obtain > IOVAs of hugepages allocated from user-mode. Multi-process mode is not > implemented and is forcefully disabled at startup. > > Signed-off-by: Dmitry Kozlyuk > --- [snip] > +void * > +eal_mem_reserve(void *requested_addr, size_t size, int flags) > +{ > + void *virt; > + > + /* Windows requires hugepages to be committed. */ > + if (flags & EAL_RESERVE_HUGEPAGES) { > + rte_errno = ENOTSUP; > + return NULL; > + } > + > + virt = VirtualAlloc2(GetCurrentProcess(), requested_addr, size, > + MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS, > + NULL, 0); > + if (virt == NULL) { > + DWORD err = GetLastError(); > + RTE_LOG_WIN32_ERR("VirtualAlloc2()"); > + set_errno_from_win32_alloc_error(err); > + } > + > + if ((flags & EAL_RESERVE_FORCE_ADDRESS) && (virt != requested_addr)) { > + if (!VirtualFree(virt, 0, MEM_RELEASE)) Shouldn't this be VirtualFreeEx() here? > + RTE_LOG_WIN32_ERR("VirtualFree()"); > + rte_errno = ENOMEM; > + return NULL; > + } > + > + return virt; > +} > + ranjit m.