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 8B1D8A034F; Wed, 13 May 2020 11:09:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BE771D441; Wed, 13 May 2020 11:09:25 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80083.outbound.protection.outlook.com [40.107.8.83]) by dpdk.org (Postfix) with ESMTP id A5BB31C440 for ; Wed, 13 May 2020 11:09:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SUcX+KbsIA2v/5j0tEFiLZaEzvlLE5fHnWGsfON+ikEgJzlhTEF0z/GRtgrWlOwNG1EcQLmfnoQQzPZKKNDI3aEU3nRJ31ibLSPSpe2r4DqGTcYoqjo9KQTkEhmOvz8d02Oy6UnR09MiPen5n2YY2Uut+TKC6bbHlxb3IMnINoT5jr2tETM6s0ngbCb35xlnaOi8fe8qFoiC52FyHz4TQHqqNRQCGUBLwzB3S5FsqTDib1kacCOmaMK9Jri/By23ClNHz0xRe3Dy0nGlWkuH3GTAouP6XJZb2TOh1nS/sEtOirQ9Mrlza3jAnHTDNzBdqBOaCDoQbghct+tLxdsczQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JUVXfTUl/0LhlIYzHrMsWDXsTtfwHDv+2lO6lvP842s=; b=FNrMX8N9YmTaiRk7frecwOxuh9KOLNLqge6YdzQ3AMAEAaxrv0VyuHQYzJ299F+leXTow1RMVWt87m49ITtmGU9eoyteebRdQ7txCE8zvZfQCGTf9bwdlRDX+NR/bu/xV6mZ+qijvIUnoplg/ePVjMNQIMf27BsuJx45cYCygOXJp6rd9po7Hm3Wnl0Dt/uvt0o2pLeWtPoDMOMzvVH/7OX7FJ0twheWImE7fRcAVy5wGfoKkXsnao19BN741UiNZJA/qM5P50VfXqtsMXJndRNFXbv+SswK3bxMMIZu2v4J6hxvmomPbrpDqSSEFb3yVubc9bESzBoKuh8VoKVB0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JUVXfTUl/0LhlIYzHrMsWDXsTtfwHDv+2lO6lvP842s=; b=Iitl5jvxQO88F32x7pa6jo1K4krmhFsQ8FNhqiyFwkKOckhf7TDdwxWQos5kn4NrwyPz5v4XQl1g7KUFpgIRr0MmLsVkYNAqHgpwWPdTXIEqj6TZm9amuqVlwNv1wrLn07uTZLDmiLtnmX/j6detcIAxBffBy5u0H9um6y+YcaQ= Received: from AM0PR0502MB4034.eurprd05.prod.outlook.com (2603:10a6:208:12::14) by AM0PR0502MB4065.eurprd05.prod.outlook.com (2603:10a6:208:e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Wed, 13 May 2020 09:09:22 +0000 Received: from AM0PR0502MB4034.eurprd05.prod.outlook.com ([fe80::a0ec:2aee:7f28:8d22]) by AM0PR0502MB4034.eurprd05.prod.outlook.com ([fe80::a0ec:2aee:7f28:8d22%7]) with mapi id 15.20.2979.033; Wed, 13 May 2020 09:09:22 +0000 From: Fady Bader To: Dmitry Kozlyuk CC: "dev@dpdk.org" , "Dmitry Malloy (MESHCHANINOV)" , Narcisa Ana Maria Vasile , Tal Shnaiderman , Thomas Monjalon , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon , John McNamara , Marko Kovacevic , Anatoly Burakov Thread-Topic: [PATCH v4 8/8] eal/windows: implement basic memory management Thread-Index: AQHWHbfQx0ufnJgIC0i7LHh3WkZ/BKilvyyQgAAKWQCAAAVZQA== Date: Wed, 13 May 2020 09:09:22 +0000 Message-ID: References: <20200410164342.1194634-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-9-dmitry.kozliuk@gmail.com> <20200513114248.6183d14f@sovereign> In-Reply-To: <20200513114248.6183d14f@sovereign> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [79.176.112.213] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 11ee04d2-40a1-4700-00d0-08d7f71d53c4 x-ms-traffictypediagnostic: AM0PR0502MB4065: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:287; x-forefront-prvs: 0402872DA1 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /vuwCameiC7iNtxP+pA7O6+BwgMLsWPPXau2P65ZtfP02uWFKXKoJiHBgoleyZ3/lbpoB96iCwl/J8m9CB3xhvpCS++4qH9wDam+NoAlJ44PtWE+LJx+mQiffhvnZLJPm/9z4oSQg7sm4spzvNFJCjPxEaTx9+/BX4wYKue5StnxfdYRaIMLDniCXE9tZDvpjlgBOq+peL0EjyJf2NkyCDo+xkimGN4l+RDcMAC/xUaMuoKxoH/ftEtmWeAUW6uRxkyWA/OeAcyekuYpU5QaKVYvsPVn12s7BG4UjZPcH36gLf7CWZrFJQmexPtkTvIFNjRMqgQDOpvNc6CWv1F+cpgLI9UPoXgLUYGYncugpKlnyv6XURNdGxhs5GEEg3U8bPa5UYftsDg3E3fg6gJrBR2PqgdWacdiQXCAf6TTMyo2gMDIc9tAkLD50T80OVGQ6sr1ZTM/e/qJeSAVlrQiqJuShbO8EHmrVuDWb3p0uouGX4SgpTENyKTaMA0R4LsWIu7AE3a4DmDx8G7LB3DSOA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR0502MB4034.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(366004)(396003)(376002)(346002)(33430700001)(186003)(2906002)(71200400001)(7416002)(6506007)(33440700001)(478600001)(316002)(6916009)(54906003)(53546011)(8936002)(52536014)(26005)(7696005)(33656002)(55016002)(64756008)(5660300002)(66556008)(9686003)(66476007)(76116006)(66446008)(66946007)(8676002)(4326008)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: /fOmac4kUtZx0eZZBX00sNV3jy/Y2MG4tJQKMS+4Vxr3E71DgVHxSVTcEMzGdEPlfPDc3nFNnBrL/l6hpZYTj8XB9Yvy2ki0cQgpaLRFA9Z/1a7cpFkDIbGMFCAjzn2W58BdohPFi3UebgkAM6dsVNaW7H/4wRCgv1GZLIG6El9Qq3Lug34QvtgegvSC+NIK1j5sliInIECAtAZ/QBWbrQvE+FQXKAcQ2LjH5U9kOg7QWG6Y+/vGbLMJexrev6XA+WZRoLqYztU1cstHysFZ5ihAGk9JCA/kvrOasj9vhYdmMFjff8n4r90V5ye0jbFmWv12yl3d4YGuKnyWntu3udilZPfgouMhRjPd7HdQw/IWVyPVfgsGxBiGHFlWRCYnok83uGKXr6+zEYoYVBW3bx5XFvX4xP9bqXGj+YV7jrzW8k1gfK1O05VlTSxfsKvIVZrYziC4Wpb0SCenKHOOFREdbxAyjWl9UuwKdDIx11Icsk4G6QhgiEJZcJFPyswL Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11ee04d2-40a1-4700-00d0-08d7f71d53c4 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2020 09:09:22.6601 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: L32Zxl3eqZRHVoyeOw0/hgHfSSFSQp6QXyq/GWijvN4CRHoh1fojeAugQtHHM/HJC9Kg2J/x8+5e9LSEo62q2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB4065 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" > -----Original Message----- > From: Dmitry Kozlyuk > Sent: Wednesday, May 13, 2020 11:43 AM > To: Fady Bader > Cc: dev@dpdk.org; Dmitry Malloy (MESHCHANINOV) > ; Narcisa Ana Maria Vasile > ; Tal Shnaiderman ; > Thomas Monjalon ; Harini Ramakrishnan > ; Omar Cardona > ; Pallavi Kadam ; > Ranjit Menon ; John McNamara > ; Marko Kovacevic > ; Anatoly Burakov > > Subject: Re: [PATCH v4 8/8] eal/windows: implement basic memory > management >=20 > On Wed, 13 May 2020 08:24:12 +0000 > Fady Bader wrote: >=20 > > Hi Dmitry, > > I'm using your latest memory management patchset and getting an error > > in the function VirualAlloc2 in eal_mem_commit, error code: 0x57 > > (ERROR_INVALID_PARAMETER). I'm using Windows server 2019 build > 17763, > > and followed the steps to Grant *Lock pages in memory* Privilege. > > > > The parameters that are sent to the function are: > > GetCurrentProcess() is -1. > > requested_addr is 0x0000025b`93800000. > > Size is 0x200000 (sysInfo.dwAllocationGranularity is 0x10000). > > Flags is 0x20007000. > > Also, Socket_id is 0. > > > > The call stack is: > > 00 dpdk_mempool_test!eal_mem_commit+0x253 > > 01 dpdk_mempool_test!alloc_seg+0x1b0 > > 02 dpdk_mempool_test!alloc_seg_walk+0x2a1 > > 03 dpdk_mempool_test!rte_memseg_list_walk_thread_unsafe+0x81 > > 04 dpdk_mempool_test!eal_memalloc_alloc_seg_bulk+0x1a5 > > 05 dpdk_mempool_test!alloc_pages_on_heap+0x13a > > 06 dpdk_mempool_test!try_expand_heap_primary+0x1dc > > 07 dpdk_mempool_test!try_expand_heap+0xf5 > > 08 dpdk_mempool_test!alloc_more_mem_on_socket+0x693 > > 09 dpdk_mempool_test!malloc_heap_alloc_on_heap_id+0x2a7 > > 0a dpdk_mempool_test!malloc_heap_alloc+0x184 > > 0b dpdk_mempool_test!malloc_socket+0xf9 > > 0c dpdk_mempool_test!rte_malloc_socket+0x39 > > 0d dpdk_mempool_test!rte_zmalloc_socket+0x31 > > 0e dpdk_mempool_test!rte_zmalloc+0x2d > > 0f dpdk_mempool_test!rte_mempool_create_empty+0x1c9 > > 10 dpdk_mempool_test!rte_mempool_create+0xf8 >=20 > Hi Fady, >=20 > Can you share the code snippet causing this? >=20 [snip] + +void* +eal_mem_commit(void *requested_addr, size_t size, int socket_id) +{ + MEM_EXTENDED_PARAMETER param; + DWORD param_count =3D 0; + DWORD flags; + void *addr; + + if (requested_addr !=3D NULL) { + MEMORY_BASIC_INFORMATION info; + if (VirtualQuery(requested_addr, &info, sizeof(info)) =3D=3D 0) { + RTE_LOG_WIN32_ERR("VirtualQuery()"); + return NULL; + } + + /* Split reserved region if only a part is committed. */ + flags =3D MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER; + if ((info.RegionSize > size) && + !VirtualFree(requested_addr, size, flags)) { + RTE_LOG_WIN32_ERR("VirtualFree(%p, %zu, " + ")", requested_addr, size); + return NULL; + } + } + + if (socket_id !=3D SOCKET_ID_ANY) { + param_count =3D 1; + memset(¶m, 0, sizeof(param)); + param.Type =3D MemExtendedParameterNumaNode; + param.ULong =3D eal_socket_numa_node(socket_id); + } + + flags =3D MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; + if (requested_addr !=3D NULL) + flags |=3D MEM_REPLACE_PLACEHOLDER; + + addr =3D VirtualAlloc2(GetCurrentProcess(), requested_addr, size, + flags, PAGE_READWRITE, ¶m, param_count); + if (addr =3D=3D NULL) { + DWORD err =3D GetLastError(); + RTE_LOG_WIN32_ERR("VirtualAlloc2(%p, %zu, " + ")", addr, size); + set_errno_from_win32_alloc_error(err); + return NULL; + } + + return addr; +} + > -- > Dmitry Kozlyuk