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 9DB7DA00C2; Thu, 10 Feb 2022 11:38:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2694640140; Thu, 10 Feb 2022 11:38:23 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by mails.dpdk.org (Postfix) with ESMTP id 7DF904013F for ; Thu, 10 Feb 2022 11:38:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dhg0D8uzw+pHJgkTO9Zi6Qq2t8/KmZOU3op83wj7+VTex3WzHpkGmprcle+GR3c/owJ1GSdDQO3xpTVBZUSTop+X/jXRfhuIpCapSuFHCJd4FhOi6DctwEXWEWuk+2/KrGqlq8RzJZHSApkFAv44LuuPHOSINJ0QZobx48BjA85s1j121nmUFPcsGNjF/ISnkgBEbf4r85Pf5LViQ1b1kn/6KZLDAZC3UNwBjslWX30Myghu7vdAUKb+w7VaVkz/rH4Z9efVEwikTyVT7oJAN9tKzRk7HanQ7yufFIgkx/Puo5zgRtNiCc9SKWqQFi9VtT5mQ3LO8BpSIjTyA9FTMg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CRwt7sqEz23EYJfOZwp8MYTWR78EUS8AyLvD8p9iOyQ=; b=b7/07uAJ2sBWJUYfPkySNczaIvc9gp7uBvHP8+H7/gIp9Q+3C4PnRQ4QWEI2ysMzL2Ft3AGl9PRAB6+BFjOG7zNesEcYYgabv68IbSoZ5u4P3tLAn28XGeNAbOBqouEjqwrc3VzhfD0n6NyXif+iGeSI+oRfZIiD4/SMfPB7aayD3/kuQDnIn8uWSvShqqEK3wNGHQr4u1XUywIZ+DM2aT/8Hq5Xw9XuaqBtYlkEnktkmqs/RgOxUvWoanK/heeFcxAwkvk8g3xD+8kvIXYcvtSacKBArAcimiUmOHdR4+3E2wm66JnZBwD5nBxrVAc4sWT7pHAIIrsAaXBRv9Gj0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=CRwt7sqEz23EYJfOZwp8MYTWR78EUS8AyLvD8p9iOyQ=; b=RESzT1x2DfgQ3vY6AAn83nMvTbwqGQZCtPnfm7fT6GgLK/sP0cjUyhkvD/LlGoBGZnPnbOhORnEhl1PEndjyMh2YooERBcmnDzJG8vVuZm2oncfLrllSuMKjHRC1BJfS/oI3kfSfPOPKFyh1hxYxDgXPbjqPonao/te8DWz0BAZ1K8bELINDzrffFEyZ6wK1rfAjlhwU065vD0UbrP3LmsKW0j8PoH8UoHMHI+M7iEESWfgf3ArlmHbJdCFhlQrtQsS77briYTu7SpxW2XiwzGeIptoz+OtDeU9FR4IQFR2GXxk5DDkBw0LP5i6PsCR2CNuk9k6KqhQAAaILV5OlEA== Received: from DM6PR12MB4107.namprd12.prod.outlook.com (2603:10b6:5:218::7) by DM6PR12MB5536.namprd12.prod.outlook.com (2603:10b6:5:1ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Thu, 10 Feb 2022 10:38:20 +0000 Received: from DM6PR12MB4107.namprd12.prod.outlook.com ([fe80::1458:b755:1761:4a11]) by DM6PR12MB4107.namprd12.prod.outlook.com ([fe80::1458:b755:1761:4a11%7]) with mapi id 15.20.4951.018; Thu, 10 Feb 2022 10:38:20 +0000 From: Elena Agostini To: "Wang, Haiyue" , "dev@dpdk.org" Subject: Re: [PATCH v4 1/2] gpudev: expose GPU memory to CPU Thread-Topic: [PATCH v4 1/2] gpudev: expose GPU memory to CPU Thread-Index: AQHYEuw6dvFyXyvnlkO5Pc2G0sdZ9ax2cAiAgBY9+rU= Date: Thu, 10 Feb 2022 10:38:19 +0000 Message-ID: References: <20220104023408.13379-1-eagostini@nvidia.com> <20220127034716.12497-1-eagostini@nvidia.com> In-Reply-To: Accept-Language: en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bd13ba89-4186-4c23-c6e4-08d9ec817496 x-ms-traffictypediagnostic: DM6PR12MB5536:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: O1or+uq/m7JDiK6v7FFO654GbKHYQ8vfdUwHeEHw3r2ZCgqdcmsV1edq4nDyQJLK5CM95TnYKEqjphsF2oicL8JcBMWWfnvWQHpW8WZANSJDH/wJyPse1GzijbmTvXP+uN9YciW65sHZKtQS57XeqFPInFlU0tLRk68V8dz3Buxs6iLaeJlndvtl96WGvK9Tp03fwqEqveYK9nIrtNjAh+W/54X9hpqPwDT+KyOuhIxGsNo64V1p3swsa0P+lQN2yJVqBKgOJBbVWMsq0YAVqwwd5wt2XqcdrcNwtgB+fGl3psii6nR86t0mgEit1rwHC4OqwQ8MpiQtK162Sznv9a2ZQ0kum5GScsPiEaRYiWXieOsQA/BfZ+dfn5nxXkPKmEQEOHLwgGi/gVhLOhSGsH583D25dvBDKa1yi1I2DK6hkeNnYxI6LTBNSyMAJFtDwVBg6+IvM+nnhLMg82m0tmVyM8AU1wSOFr3o0kRrexkp4X+xBx2jStrV1Sccv5sdedN9rO7FIMxzUZJmvcJZXnJy99PAhJxhr45X3OsVSOSEde4ZJQEuXENhWv++71gTgC2qt7g98IfisLQW/BZ2CBA5/nSdX6fMj75ketgXkEY8peCIVvbWhtdpXN8xHPaiU3D9VWbczsLCmBH2OnDvlXM4XOwqqEZf2SFk7lsxJT5gR1gsQrV0+cOknZiIBDRGKNZ98mKJK9l4/an+5nf7YA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4107.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(38070700005)(55016003)(33656002)(86362001)(122000001)(38100700002)(53546011)(66446008)(8936002)(8676002)(64756008)(7696005)(6506007)(9686003)(83380400001)(110136005)(316002)(508600001)(71200400001)(66946007)(76116006)(91956017)(5660300002)(52536014)(66556008)(66476007)(26005)(186003)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zvFwnchbtxPBjzLgXkcuubJaVOMHkShtWabQJMwrnrUkFs320253rxE8ZMde?= =?us-ascii?Q?1G98GuOARHNurKrqEUx0VPVmqdPil0m/5bSC1xO/mvAocdTKUYRWHkECB1Yi?= =?us-ascii?Q?rAEjYSR6Z7PtpQLjz6kgGgbc6IwNZhT7oA/uJ4w7+rLyhwUzLM9LhxOtF5+m?= =?us-ascii?Q?9/LeFM3mOz8TPXtaBqCR1fXOcxTYGS2P+BGV4CGGA2JibbsTRX7Vox/IyUZ/?= =?us-ascii?Q?ZqG1XTnSV51iWY3Wyu7CfJTZI2D9V5zECmoII+dFwweOOMKMKa/sS+mnwCKY?= =?us-ascii?Q?HfNx+tRDBZGbs09FrxWutvMh7tplNwT8XoprXP9QWhfXuXRMTxiVrBG1oo8O?= =?us-ascii?Q?K20VvrSF/lY7s7n9vI3B8q+8gl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-ascii?Q?wQQJ5Vtx7AjVrU23GXnUZhwLTzIxMsxx4A92cqoPAknJ1q4p0xY6zPYghOz3?= =?us-ascii?Q?V5Y9QcZXdhmuvT8IuzxcI9UXNt21sew7PLhkcvcfL3TjAAYj69AHIQ/YTSoO?= =?us-ascii?Q?oIazU2uV7X3O0CsZAoPU3FaHXABil1gfPm9fzBqjNeRge2dvdXRorAJsm/2C?= =?us-ascii?Q?xxuBHOzNs2AMtFkkwzL2LVBZ/Wv1x3EJeIpwQlxbwWbPbWDz4d/yqXhCkWz2?= =?us-ascii?Q?Oo9cflIed6QlEXAn20qbUof/TDaMg9TbBdopIMXJuUOaKuUUi9CLuPfwVhxG?= =?us-ascii?Q?+vScJuW9AMrRnMnHKEUYezyEYEZ77qSA0ikuQX3/OlpVp7Fj8cSuoO+mCcqf?= =?us-ascii?Q?YBa1wsvdAQxO85gJ9RH0zMzOzUFdr7RjewThBE4fXChZ?= Content-Type: multipart/alternative; boundary="_000_DM6PR12MB41074416E62D561EEE7E9C27CD2F9DM6PR12MB4107namp_" MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4107.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd13ba89-4186-4c23-c6e4-08d9ec817496 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Feb 2022 10:38:19.9673 (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: Tu66YUA0IZdY/MmMnmYOBrI64P9gwGqoomCqyVu6NSYodeCVnz+H2mz3ij4sF0jb44jioUlG9M6iEfyoxK/PKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5536 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 --_000_DM6PR12MB41074416E62D561EEE7E9C27CD2F9DM6PR12MB4107namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > From: Wang, Haiyue > Date: Thursday, 27 January 2022 at 07:56 > To: Elena Agostini , dev@dpdk.org > Subject: RE: [PATCH v4 1/2] gpudev: expose GPU memory to CPU > External email: Use caution opening links or attachments > > > > -----Original Message----- > > From: eagostini@nvidia.com > > Sent: Thursday, January 27, 2022 11:47 > > To: dev@dpdk.org > > Cc: Elena Agostini > > Subject: [PATCH v4 1/2] gpudev: expose GPU memory to CPU > > > > From: Elena Agostini > > > > Enable the possibility to expose a GPU memory area and make it > > accessible from the CPU. > > > > GPU memory has to be allocated via rte_gpu_mem_alloc(). > > > > This patch allows the gpudev library to map (and unmap), > > through the GPU driver, a chunk of GPU memory and to return > > a memory pointer usable by the CPU to access the GPU memory area. > > > > Signed-off-by: Elena Agostini > > --- > > doc/guides/prog_guide/gpudev.rst | 9 +++++ > > drivers/gpu/cuda/cuda.c | 2 ++ > > lib/gpudev/gpudev.c | 61 ++++++++++++++++++++++++++++++++ > > lib/gpudev/gpudev_driver.h | 6 ++++ > > lib/gpudev/rte_gpudev.h | 49 +++++++++++++++++++++++++ > > lib/gpudev/version.map | 2 ++ > > 6 files changed, 129 insertions(+) > > > > > > +__rte_experimental > > +void *rte_gpu_mem_cpu_map(int16_t dev_id, size_t size, void *ptr); > > How about add some direction words like "to/from" to make it straightforw= ard ? > > For this: rte_gpu_mem_map_to_cpu ? > > > +__rte_experimental > > +int rte_gpu_mem_cpu_unmap(int16_t dev_id, void *ptr); > > + > > And rte_gpu_mem_unmap_to_cpu ? > > > }; > > -- > > 2.17.1 Motivation behind the name is to be compliant with rte_*_dma_map/unmap() functions where the entity comes first (DMA) and the action later (map/unmap). I think your proposal is more readable but it's also too verbose for an API (map_to_cpu/unmap_from_cpu). --_000_DM6PR12MB41074416E62D561EEE7E9C27CD2F9DM6PR12MB4107namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

> From: Wang, Ha= iyue <haiyue.wang@intel.com>

> Date: Thursday= , 27 January 2022 at 07:56

> To: Elena Agos= tini <eagostini@nvidia.com>, dev@dpdk.org <dev@dpdk.org>

> Subject: RE: [= PATCH v4 1/2] gpudev: expose GPU memory to CPU

> External email= : Use caution opening links or attachments

>

>

> > -----Orig= inal Message-----

> > From: eag= ostini@nvidia.com <eagostini@nvidia.com>

> > Sent: Thu= rsday, January 27, 2022 11:47

> > To: dev@d= pdk.org

> > Cc: Elena= Agostini <eagostini@nvidia.com>

> > Subject: = [PATCH v4 1/2] gpudev: expose GPU memory to CPU

> >

> > From: Ele= na Agostini <eagostini@nvidia.com>

> >

> > Enable th= e possibility to expose a GPU memory area and make it

> > accessibl= e from the CPU.

> >

> > GPU memor= y has to be allocated via rte_gpu_mem_alloc().

> >

> > This patc= h allows the gpudev library to map (and unmap),

> > through t= he GPU driver, a chunk of GPU memory and to return

> > a memory = pointer usable by the CPU to access the GPU memory area.<= /p>

> >

> > Signed-of= f-by: Elena Agostini <eagostini@nvidia.com>

> > ---<= /o:p>

> >  doc= /guides/prog_guide/gpudev.rst |  9 +++++

> >  dri= vers/gpu/cuda/cuda.c          = |  2 ++

> >  lib= /gpudev/gpudev.c          = ;    | 61 ++++++++++++++++++++++++++++++++=

> >  lib= /gpudev/gpudev_driver.h       |  6 ++++<= o:p>

> >  lib= /gpudev/rte_gpudev.h          = | 49 +++++++++++++++++++++++++

> >  lib= /gpudev/version.map         &n= bsp; |  2 ++

> >  6 f= iles changed, 129 insertions(+)

> >

>

>

> > +__rte_ex= perimental

> > +void *rt= e_gpu_mem_cpu_map(int16_t dev_id, size_t size, void *ptr);

>

> How about add = some direction words like "to/from" to make it straightforward ?<= o:p>

>

> For this: rte_= gpu_mem_map_to_cpu ?

>

> > +__rte_ex= perimental

> > +int rte_= gpu_mem_cpu_unmap(int16_t dev_id, void *ptr);

> > +

>

> And rte_gpu_me= m_unmap_to_cpu ?

>

> >  };<= o:p>

> > --

> > 2.17.1

 

Motivation behind t= he name is to be compliant with

rte_*_dma_map/unmap= () functions where the entity comes first

(DMA) and the actio= n later (map/unmap).

 

I think your propos= al is more readable but it's also too

verbose for an API = (map_to_cpu/unmap_from_cpu).

--_000_DM6PR12MB41074416E62D561EEE7E9C27CD2F9DM6PR12MB4107namp_--