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 8D767A0561; Mon, 20 Apr 2020 08:00:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 459431D17C; Mon, 20 Apr 2020 07:59:59 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) by dpdk.org (Postfix) with ESMTP id D65651C193 for ; Mon, 20 Apr 2020 07:59:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qu+E42nBOvCQZxT6p+/PRr++UgtjRRvPlwAjjQe5AtHoc0g611lnrsUncAS5+N2SRFRm7qD+RKgeRb/OVKyYb8/o8HU7EZiHtRVVZyJeoWcN0rEKsNV+ihEsnY6Ftwg6W63UxS8iKifXXDl8UAFtrS2kpn6Z9ma8+FeEExTjFRma1WvbYnExnOl964sqKHHzX16t6Ehzg0ww3Rkg3C5ocfJWn1n9Lz1TxD6T5ZNl5i+NAvh9erBpJYZJdPGHSgPSLb+7GSl5gfb+Q2KxS3He1Q3ADKindlvyenTxzbM26uKwm9QjlRhAU5hsjqgNaSzndWv/MmSVcnaJFJSgwWzoGw== 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=5vVbT8200onz23U3OY+ltvYcte68zV3HeQa3dNyvE6w=; b=i3MqmiqQ9rLdrUadWQv4JOmcpO4RDXth0zUhtBAW8yimCtrRpAAPk2vredI9Ht1sGWFAU/rJ+jbjLE+2bL3bfarAQ762jg8CCX0W2kGLEy56jW+Urq3rs+E7CTNA+ar/5lzeOOjxgGglaGH2FuqlZRKLoKF1uUVS0UCL8u+ni22JUfCvZOYWxCbLcf3eFtnIX99B32I8pQCZds/Ndlg7/hGnHmKIdrFc9uySqt57rbkVh1CWskM7Gz3qOHESkGW8nupcQjbexH6Iq8KqGaZQeEDPnRqlvjKuOxHbDg9WG+5S+EmH57ZJ+zXziFcuBywwar3JuZ5IJNE7Eq2t3FjtkA== 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=5vVbT8200onz23U3OY+ltvYcte68zV3HeQa3dNyvE6w=; b=aoUSt/79L/4206b6KxFHldgAXl/PaOAd9XCUr/ovc+/y1ZRmS2TFQ/ooyXzx9kVObubhlpCLCDF4cXd0yEKoDMwsfEpkZirM9YrnVclr6889oCZ+8uTPlPvE+BIiJMeHe/Qo82jEpJBDqO5v5OEYRmQ26xZIK3bmzO4cK8q8tEQ= Received: from AM0PR05MB5313.eurprd05.prod.outlook.com (2603:10a6:208:f2::28) by AM0PR05MB4243.eurprd05.prod.outlook.com (2603:10a6:208:62::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Mon, 20 Apr 2020 05:59:56 +0000 Received: from AM0PR05MB5313.eurprd05.prod.outlook.com ([fe80::d3a:60bb:d61b:ea19]) by AM0PR05MB5313.eurprd05.prod.outlook.com ([fe80::d3a:60bb:d61b:ea19%7]) with mapi id 15.20.2921.027; Mon, 20 Apr 2020 05:59:56 +0000 From: Tal Shnaiderman To: Dmitry Kozlyuk , "dev@dpdk.org" CC: "Dmitry Malloy (MESHCHANINOV)" , Narcisa Ana Maria Vasile , Fady Bader , Thomas Monjalon , Anatoly Burakov , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Thread-Topic: [PATCH v3 06/10] eal: introduce memory management wrappers Thread-Index: AQHWEpUq7MoDDZt3i0KsivPz4mxA/6iAe45w Date: Mon, 20 Apr 2020 05:59:56 +0000 Message-ID: References: <20200410164342.1194634-1-dmitry.kozliuk@gmail.com> <20200414194426.1640704-1-dmitry.kozliuk@gmail.com> <20200414194426.1640704-7-dmitry.kozliuk@gmail.com> In-Reply-To: <20200414194426.1640704-7-dmitry.kozliuk@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=talshn@mellanox.com; x-originating-ip: [37.142.1.17] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d872bfd6-e794-439a-4539-08d7e4f00d46 x-ms-traffictypediagnostic: AM0PR05MB4243:|AM0PR05MB4243: 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:8273; x-forefront-prvs: 03793408BA x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB5313.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(396003)(366004)(39860400002)(376002)(346002)(136003)(186003)(4326008)(86362001)(8936002)(71200400001)(7416002)(54906003)(9686003)(55016002)(81156014)(8676002)(110136005)(33656002)(5660300002)(316002)(478600001)(7696005)(2906002)(26005)(52536014)(76116006)(6506007)(45080400002)(66446008)(64756008)(66556008)(66476007)(66946007); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UvyyZZl01p69cQpGtfwk4i6mO3eHu6CvM+5rDdmI2poAXjzJx9qijjkK/CgJMovFWcFeiDtlT+tVcWwxx/39Is+byCRf1wGwcjdCItM9JmP5fypZYKkKXa2IL2jo6nIjNzxv3tQVdmCifjUth/f4DieLD1pHZ3ePGQVFTt4IhopEiLesq+H+LUNAGqylaF7bBJKGNWtzyRXsBfSrQKKIwcuBWGVOUVumoEcjhbKIQAujxx8YzFsEqg/JDAJXW0lUjUM64xvNsfG9Qhbww7qOLkSjSLth8RWokNq1RAMCnDtC96n1zyNYZfSup4PifLv+WMWvbFVgLkYMEC/RRe2RSjq8AExAWB5L95+YNDL7KOVoNkn+Tvvq8LlUvo9bMwtUZFfZt3I65jvSoeXFdEwlYm4RCS5+AVre7vp/o9YfeKQ4SG4rcUnfa26Dq0CrVU/p x-ms-exchange-antispam-messagedata: q61g1JWcu/pOd2V0+TOwvtMIuVegsNgMtHd81ydBVJgHNZHDOt+sKtO4S0al8QxBtkDJ0Iybk1YKyzvch9u9LuQMti474JgjUWdCDiry2joLixGMA0/UZ9ZeL58eojaWcRBNHb/wMeXk0gyaM2HAwQ== 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: d872bfd6-e794-439a-4539-08d7e4f00d46 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2020 05:59:56.1368 (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: vKuI2/xD/cqDS4QCuWPlQU652XUNycyF1h/jGh2Ud2NVSXfWAC4K3mc1jar61fUarZTCnlO5zQ7rfTzOrfmGfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4243 Subject: Re: [dpdk-dev] [PATCH v3 06/10] eal: introduce memory management wrappers 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" > System meory management is implemented differently for POSIX and > Windows. Introduce wrapper functions for operations used across DPDK: >=20 > * rte_mem_map() > Create memory mapping for a regular file or a page file (swap). > This supports mapping to a reserved memory region even on Windows. >=20 > * rte_mem_unmap() > Remove mapping created with rte_mem_map(). >=20 > * rte_get_page_size() > Obtain default system page size. >=20 > * rte_mem_lock() > Make arbitrary-sized memory region non-swappable. >=20 > Wrappers follow POSIX semantics limited to DPDK tasks, but their signatur= es > deliberately differ from POSIX ones to be more safe and expressive. >=20 > Signed-off-by: Dmitry Kozlyuk > --- > config/meson.build | 10 +- > lib/librte_eal/common/eal_private.h | 51 +++- > lib/librte_eal/include/rte_memory.h | 68 +++++ > lib/librte_eal/rte_eal_exports.def | 4 + > lib/librte_eal/rte_eal_version.map | 4 + > lib/librte_eal/unix/eal_memory.c | 113 +++++++ > lib/librte_eal/unix/meson.build | 1 + > lib/librte_eal/windows/eal.c | 6 + > lib/librte_eal/windows/eal_memory.c | 437 > +++++++++++++++++++++++++++ lib/librte_eal/windows/eal_windows.h | > +eal_mem_win32api_init(void) > +{ > + static const char library_name[] =3D "kernelbase.dll"; > + static const char function[] =3D "VirtualAlloc2"; > + > + OSVERSIONINFO info; > + HMODULE library =3D NULL; > + int ret =3D 0; > + > + /* Already done. */ > + if (VirtualAlloc2 !=3D NULL) > + return 0; > + > + /* IsWindows10OrGreater() may also be unavailable. */ > + memset(&info, 0, sizeof(info)); > + info.dwOSVersionInfoSize =3D sizeof(info); > + GetVersionEx(&info); I'd remove the GetVersionEx check entirely and add the comments regarding O= S dependency to the RTE_LOG=20 Of the LoadLibraryA failure below, GetVersionEx returns the Windows 8 OS ve= rsion on newer servers Also, it looks like not all Win2016 servers versions support VirtualAlloc2,= I'm using Microsoft Windows Server 2016 Datacenter Version 10.0.14393 and = LoadLibraryA failed to load VirtualAlloc2. > + /* Checking for Windows 10+ will also detect Windows Server 2016+. > + * Do not abort, because Windows may report false version > depending > + * on executable manifest, compatibility mode, etc. > + */ > + if (info.dwMajorVersion < 10) > + RTE_LOG(DEBUG, EAL, "Windows 10+ or Windows Server > 2016+ " > + "is required for advanced memory features\n"); > + > + library =3D LoadLibraryA(library_name); > + if (library =3D=3D NULL) { > + RTE_LOG_WIN32_ERR("LoadLibraryA(\"%s\")", > library_name); > + return -1; > + } > +