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 26986A0577; Mon, 13 Apr 2020 09:50:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2BEF32986; Mon, 13 Apr 2020 09:50:34 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80077.outbound.protection.outlook.com [40.107.8.77]) by dpdk.org (Postfix) with ESMTP id 1EC00293C for ; Mon, 13 Apr 2020 09:50:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XhdeLHCJoVrEU9nwGW3L5PEusI7o7XEgHdtnUStNYQadk1H3oDQZ6Z+mj0uWl1z4iF+QJaasweXW/IlHBNvH5B4nP5NCa0W5zmA4qBosEYGBdIqq9d/0oKDSUA3/9ce1LHvaxIYItr71Mucn+A+NoZaTvwTmaid/AjJds1jwXK0loeqJLcX5qW4G6COeECDWQotxB0n5Jib/iNjT79rKmLbhf1SyMN2MqQnHMgSm3siPhgonCsCjmPtlrdOiGcTfFFQ4HCRK87PX77LzxOXFjJsXX/uUYagmySVRfgfKp8WTs+EKUVSiV8VJX6Y3t05JSZ6TpZRd6enSq4nAG/6XZQ== 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=0TUgYQ7ucJzSjN6MpJ1hrOzt1XHYMJINYHmxpD/oamo=; b=GjjtzLLQccuz1Ju6jkDW0hWdyZmVico0XOg63Ua2B+JD4kqpCapfKI3oR8cLne83osFv9dIjfuoaPLxcHKAfabYdbad8opL8CoL+O4jsQ67hoUSkJQUpq9S/zZmc9bKzy3KGeAJYFbb1iIFNIxE0WbuehvXVWlF7i2aHZnrXFXgUhAdi2qQnrwDvtbhXtF6e/Bpe/ny9pxdP5dr11Q/An6I/cwuRQsCFP3Sj8zUtHjRVVR6kVduK80eYvwE7aAINxzmK07N3uoHnKQ1F3HEOQMOWF54kKiI29VK7nv6BnZ4UatUl8p4VzPNjPWdPZaaVf3qt/p3nc6vumZgJiGQmDw== 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=0TUgYQ7ucJzSjN6MpJ1hrOzt1XHYMJINYHmxpD/oamo=; b=AxHR4Li3DKsBEzhnj1KBu2sz+GGUr5A2qKYJcKOu9BgatU737Hqrjj5ZqJu+qAyZ+LQWe/bk65eOkS21rWBzL1oG+Ja/96dpYKSNrBYnN4+ClFdQNOunkA8gfZIYGWA56puONVytjWpijTMNeQAix0SNRAqEFScHJ0BevTjvTW4= Received: from AM0PR05MB5313.eurprd05.prod.outlook.com (2603:10a6:208:f2::28) by AM0PR05MB5172.eurprd05.prod.outlook.com (2603:10a6:208:f3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.28; Mon, 13 Apr 2020 07:50:30 +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.2900.026; Mon, 13 Apr 2020 07:50:30 +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 v2 06/10] eal: introduce memory management wrappers Thread-Index: AQHWD1c9sSoU4IYyVUWuDqYzzPeXVah2rJzQ Date: Mon, 13 Apr 2020 07:50:30 +0000 Message-ID: References: <20200330041026.784624-1-dmitry.kozliuk@gmail.com> <20200410164342.1194634-1-dmitry.kozliuk@gmail.com> <20200410164342.1194634-7-dmitry.kozliuk@gmail.com> In-Reply-To: <20200410164342.1194634-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: 28378a79-5f22-4cbe-8ba2-08d7df7f56f0 x-ms-traffictypediagnostic: AM0PR05MB5172:|AM0PR05MB5172: 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:8882; x-forefront-prvs: 037291602B 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)(376002)(366004)(396003)(39860400002)(346002)(136003)(6506007)(26005)(5660300002)(2906002)(71200400001)(9686003)(7416002)(4326008)(52536014)(55016002)(110136005)(33656002)(54906003)(316002)(7696005)(64756008)(66556008)(8936002)(81156014)(86362001)(66446008)(478600001)(66476007)(8676002)(186003)(66946007)(76116006); 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: j5DgqIlT9VICiwtsoZG2Lp4hN/tXKQ3D9bSMIev6cMtDUs7RD6bFAsjlY9A3oPk8S+5zK4JZxcI84d0JpqZ/Cf6H+rtIIYjZF4WF5irLfIQSzttYeldfsjYIgVcg52HJ/QCN92TrbduxP99jt8sv8DTqkp68JUOOxLGPNWTT5dUWM2iqS45S9qhENGYhFyt2ll8SiGISXeYZkuhAszbt/1Jvn99SO91j5cKnbYfBbEq8NX96S0CVIx3Ztqj5PYqfztpPP9IRoM9Y6MunoI4gnEMLAlkaBN4VYrYTP8jqV1UnadvxaITT3GufPudYeieydDriGskQ7ZSalVy8AqL7MjdNqtnIWRnn+TSCR4POxxgxkZ5y7oByfbIBzvzwVlC9idV5DpBNTR6iv1MtH9E3f2ryFqTJtpOVZTNiEmemHQ/H4T852XRDiba9kpwSN/YX x-ms-exchange-antispam-messagedata: SJKcryCrwiTuLxdBK6ZzMIO6aMO4WDzz2cNfTU2OBf0tumDw2N3fYX4nQk8B/5HCmFAizvUqWmLgaLP9LeJxgHTH3pKxMg1yC+opiFgFu6zgJCmQAmyYHeMlXUAH2rnukp+UM+Az9ICGWyz+qHyW8g== 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: 28378a79-5f22-4cbe-8ba2-08d7df7f56f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Apr 2020 07:50:30.7510 (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: QLxCkH3Lfz5gE3ufM6v+0vlgaQI9FjJgXhLbHNBoL6Jczuv7Rafmc7pTlx2gE3+Jj7A444pM4mE4sTEAWEgPVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5172 Subject: Re: [dpdk-dev] [PATCH v2 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" > Subject: [PATCH v2 06/10] eal: introduce memory management wrappers >=20 > 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 > --- > +void * > +rte_mem_map(void *requested_addr, size_t size, enum rte_mem_prot > prot, > + enum rte_map_flags flags, int fd, size_t offset) { > + int sys_prot =3D 0; > + int sys_flags =3D 0; > + > + sys_prot =3D mem_rte_to_sys_prot(prot); > + > + if (flags & RTE_MAP_SHARED) > + sys_flags |=3D MAP_SHARED; > + if (flags & RTE_MAP_ANONYMOUS) > + sys_flags |=3D MAP_ANONYMOUS; > + if (flags & RTE_MAP_PRIVATE) > + sys_flags |=3D MAP_PRIVATE; > + if (flags & RTE_MAP_FIXED) > + sys_flags |=3D MAP_FIXED; > + > + return mem_map(requested_addr, size, sys_prot, sys_flags, fd, > offset); > +} Looks like there is a different behavior in the Windows and Unix implementa= tion of rte_mem_map in case of memory mapping failure, in Windows the funct= ion returns NULL however in Unix the return value is the MAP_FAILED value o= f mmap which is ((void *)-1)