From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09B09A0524; Tue, 13 Apr 2021 20:50:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E58CE161279; Tue, 13 Apr 2021 20:50:53 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2068.outbound.protection.outlook.com [40.107.223.68]) by mails.dpdk.org (Postfix) with ESMTP id 0A05F161273 for ; Tue, 13 Apr 2021 20:50:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lI2CSYHfT7D8YlTxV6kiri1GQqLGnTPudN+ItyJ5fVmRUh+VDR/CGiCMrbeCv02h7wLt06C5QOb/E2mmfB0Jfe16zohJpSvqy36pijNVul51UJ6aVKkcbkM0SeFdeBqiMRgR/fzq8AbnsVg0tt9pmx+NWw+qUFlF1X62SfZwsNOnnMqk3xP+rsjVTbcVOAcC7BcPie4qUt+55e6WU30Yj4bX4I3gHR0Y25RPQf8V2eB/gSGSTpAtYMVl91L6V8+uJDTAzajG9Ttuj34JZqr0dOJcLf2zOkJg16ExdB29c4AcGl9Sy3e6NB/zql4GCGVxcb+3St8kIbIHTHndAWuvuQ== 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=3dAuNkHmw3oYzvCedUqBQce5sBa9hXP4C54EnjsQTS8=; b=hx82TnDLmCqurHqPRQJPQntWurVp2RPwOjJ7JCEMh6PI2fkVuar28FgUtyUmk4SNrOtKRgknM6N1s0mRmw8pLBh8blmzJH0GrHM4Z0b0VYtPOqOCjeaFscMQMwap4QLl+/uDo32s85MLl66YE17B2upRgIcBiF/Wfi1YTwguTBsTKjTEe3Cym5kot52bIytdPmkqkBYVvp7L+g5AW0oap0CIwU4qTkiyFX+fSA1LTPWIaJyNF4MP8IrZJuqs1cqCB55NnI6I/ibf5P0wHqsOi0GRB1FoiaasnzNUikxmcEC5wEDEAorOHC6XNmw3WCi9jFzpyMviDYmgzUJvQTltXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3dAuNkHmw3oYzvCedUqBQce5sBa9hXP4C54EnjsQTS8=; b=QcbldWpigT2fVt3y8QVszWmC9lg811sCJHCr4igz5kyi3acfo4MLpcngqMxJ0dYVEE17Hhi9nImJxXPiAyM9Pt/6Wwl3YIA9tWgFxbW2R5wqG9WFukiqUaBWkwrMf37DRRxfxumpau1aSMMLqh7D7+t+MC3/22QkwckRB06cyB8Cfah2hZf/rnA7s7Kzu5Yn95nb5TCLJQdUpqFr8soFpzpbdglTDBqiI6dz1P7Qe6bgkep2mdzc66q0WuiwlFxANdRsZufokve1XNdCukj4p0JWMaEARoccWeI/hbSFTNAYdhRz4i6xfYMY38M9154eTtK6s50F+e5oByoEH5ElBQ== Received: from DM6PR12MB3945.namprd12.prod.outlook.com (2603:10b6:5:1c2::27) by DM6PR12MB4187.namprd12.prod.outlook.com (2603:10b6:5:212::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.20; Tue, 13 Apr 2021 18:50:50 +0000 Received: from DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::9d62:2f16:264b:285d]) by DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::9d62:2f16:264b:285d%5]) with mapi id 15.20.4020.022; Tue, 13 Apr 2021 18:50:50 +0000 From: Tal Shnaiderman To: Jie Zhou , "dev@dpdk.org" CC: "dmitry.kozliuk@gmail.com" , "xiaoyun.li@intel.com" , "roretzla@microsoft.com" , "pallavi.kadam@intel.com" , NBU-Contact-Thomas Monjalon , "bruce.richardson@intel.com" , "ferruh.yigit@intel.com" Thread-Topic: [dpdk-dev] [PATCH v3 5/6] app/testpmd: add rte_mem_lockall in librte_eal Thread-Index: AQHXMIlBNnZCnyoif0OipE0vY5M4z6qywjgA Date: Tue, 13 Apr 2021 18:50:50 +0000 Message-ID: References: <1616172695-28505-1-git-send-email-jizh@linux.microsoft.com> <1618334363-15147-1-git-send-email-jizh@linux.microsoft.com> <1618334363-15147-6-git-send-email-jizh@linux.microsoft.com> In-Reply-To: <1618334363-15147-6-git-send-email-jizh@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux.microsoft.com; dkim=none (message not signed) header.d=none;linux.microsoft.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [5.29.61.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: adb49982-16ec-4d15-86fc-08d8fead0f11 x-ms-traffictypediagnostic: DM6PR12MB4187: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NNkS5CYNNKGkM357cgpYsyF7l+UYtJ80gNWDzugd6xuLohag8FrK0QHjb5O97a/5nHuUB8s8ruUH8ATYrV+TpiBVF/doMH0FDrfgP4KhFN1Q5yk1Tc3FlMB3pdUfrn1Bz83fuPq6s9T0PDiNmPyCcm0GDD9OCDhItCAL4WRM23nWL/9yiRCbzgwgfi0Zuw2geWV0Xb1W4xYFUFLY3WC6GnPnoJMWJu7OV0TTZEZZk1sGNsuvNmuxuZ0c5q21lTHk7Kqa9/uHLSYMUqJ04L2l9FR8qP2iZa9q+rBkGOOKN/SNR3MNtBF+YDCG8AGTi2HUjaipO4XPaX2EUIze7QSfTLC/igvF1Tpk0qDnj09wlUsKG4yUP9dKDoIzbmRLuDrUcZQuIaD37j+fEKkaeN92nN1XgW/H3npy69MVR7B2iCubjqXfEmz6rDVx0D/Q1S5OEQeVebcLf5thHT+bTuUklpzkTaO0Y7ilNufHRlLin2s5TPyANpCoP3nIvUC8NTbcNqv9O8XkOToK9xi0CvRZO3aNqpLzyFFfnFCgSr9T+uwOVnTN18SWpO0XOSlvYLTrrHmibAs0P/KXVJ0PQCWB3Gpzkvx4MKLpRpjcTNX+jsI= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3945.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(346002)(136003)(39860400002)(366004)(376002)(6506007)(5660300002)(66556008)(186003)(66446008)(76116006)(33656002)(316002)(26005)(110136005)(64756008)(66476007)(55016002)(83380400001)(52536014)(9686003)(54906003)(38100700002)(478600001)(8936002)(7696005)(8676002)(86362001)(2906002)(71200400001)(66946007)(4326008)(122000001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?3VtrgxPw7vFf423DBoQ03HH83yOIRk1F4BwmembylRzqc6mPODyjCeaXPlMv?= =?us-ascii?Q?2XibHvXVAbZ5/EV6tMYTapqkWLPMAiYD6KQ/lBNLYJVoFYhegCQoUodYmDS7?= =?us-ascii?Q?SO4v5CUZY1wb/YghF2AQEMzNnzFxr87/zujfr6nEiOhzeylsXBBWtdw8XlUq?= =?us-ascii?Q?fgvOvouc0RO8yiZ/4gw+Kd5pN+2ff9nQMJvaqCJlez/InjD62233x9PQuSnM?= =?us-ascii?Q?O/MZV7iRZGk9PApqJPheADTNBiCWyBzKGmX6QsIcX7OxpvGDiuk3HUxPYIZM?= =?us-ascii?Q?AHjpXA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1253LEx9E7smU/l?= =?us-ascii?Q?DWJ4WNMs1hqUd5nwLF8hfqhlcaPV7jaICV02IH23VV8feI6d/CTlJJpee9SJ?= =?us-ascii?Q?N8Po06YK5IvPohi4sUFMYEqhP6qZI2KrXbewn+zCvGcNzYMKS7jZRR1VE5pM?= =?us-ascii?Q?0jo=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3945.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: adb49982-16ec-4d15-86fc-08d8fead0f11 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Apr 2021 18:50:50.6500 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uB9v5xR782VaCa5OL5m1sFXroJ3z6v6iK0UmZvd/hsAi6OM0SbTUqnGQ3kHDu9sjqfmQdO8YzmI9LbuFPtyofA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4187 Subject: Re: [dpdk-dev] [PATCH v3 5/6] app/testpmd: add rte_mem_lockall in librte_eal X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: [dpdk-dev] [PATCH v3 5/6] app/testpmd: add rte_mem_lockall in > librte_eal >=20 > External email: Use caution opening links or attachments >=20 >=20 > In order to replace POSIX mman APIs in testpmd, add rte_mem_lockall. > - On Unix, it is a wrapper of mlockall > - On Windows, it is just a stub >=20 > Signed-off-by: Jie Zhou > Signed-off-by: Jie Zhou > --- > lib/librte_eal/include/rte_eal_paging.h | 20 ++++++++++++++++++++ > lib/librte_eal/unix/eal_unix_memory.c | 13 +++++++++++++ > lib/librte_eal/version.map | 1 + > lib/librte_eal/windows/eal_memory.c | 10 ++++++++++ > 4 files changed, 44 insertions(+) >=20 > diff --git a/lib/librte_eal/include/rte_eal_paging.h > b/lib/librte_eal/include/rte_eal_paging.h > index ed98e70e9..959c2e135 100644 > --- a/lib/librte_eal/include/rte_eal_paging.h > +++ b/lib/librte_eal/include/rte_eal_paging.h > @@ -37,6 +37,14 @@ enum rte_map_flags { > RTE_MAP_FORCE_ADDRESS =3D 1 << 3 > }; >=20 > +/** Flags for memory lockall. */ > +enum rte_mem_lockall_flags { > + /** Lock all pages currently mapped into process's address space.= */ > + RTE_MCL_CURRENT =3D 1 << 0, > + /** Lock all pages mapped into process's address space in the fut= ure.*/ > + RTE_MCL_FUTURE =3D 1 << 1 > +}; > + > /** > * Map a portion of an opened file or the page file into memory. > * > @@ -96,3 +104,15 @@ rte_mem_page_size(void); __rte_internal int > rte_mem_lock(const void *virt, size_t size); > + > +/** > + * locks all pages mapped into the address space of the calling process. > + * > + * @param flags > + * Memory lockall flags, a combination of rte_mem_lockall_flags. > + * @return > + * 0 on success, negative on error. > + */ > +__rte_internal > +int > +rte_mem_lockall(int flags); > diff --git a/lib/librte_eal/unix/eal_unix_memory.c > b/lib/librte_eal/unix/eal_unix_memory.c > index ec7156df9..90e0c547a 100644 > --- a/lib/librte_eal/unix/eal_unix_memory.c > +++ b/lib/librte_eal/unix/eal_unix_memory.c > @@ -150,3 +150,16 @@ rte_mem_lock(const void *virt, size_t size) > rte_errno =3D errno; > return ret; > } > + > +int > +rte_mem_lockall(int flags) > +{ > + int mlockall_flags =3D 0; > + > + if (flags & RTE_MCL_CURRENT) > + mlockall_flags |=3D MCL_CURRENT; > + if (flags & RTE_MCL_FUTURE) > + mlockall_flags |=3D MCL_FUTURE; > + > + return mlockall(mlockall_flags); } > diff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map inde= x > e7217ae28..8dd8333e5 100644 > --- a/lib/librte_eal/version.map > +++ b/lib/librte_eal/version.map > @@ -431,4 +431,5 @@ INTERNAL { > rte_mem_map; > rte_mem_page_size; > rte_mem_unmap; > + rte_mem_lockall; Please keep alphabetical order. > }; > diff --git a/lib/librte_eal/windows/eal_memory.c > b/lib/librte_eal/windows/eal_memory.c > index 2cf5a5e64..4fe7e59a1 100644 > --- a/lib/librte_eal/windows/eal_memory.c > +++ b/lib/librte_eal/windows/eal_memory.c > @@ -715,3 +715,13 @@ rte_eal_hugepage_attach(void) > EAL_LOG_NOT_IMPLEMENTED(); > return -1; > } > + > +int > +rte_mem_lockall(int flags) > +{ > + RTE_SET_USED(flags); > + > + EAL_LOG_NOT_IMPLEMENTED(); > + > + return -1; > +} > -- > 2.30.0.vfs.0.2