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 73F46A0A0F; Fri, 4 Jun 2021 20:04:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E65624068F; Fri, 4 Jun 2021 20:04:55 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 3417940147 for ; Fri, 4 Jun 2021 20:04:54 +0200 (CEST) IronPort-SDR: mQKKwPT9+9ovgwiSaUqprV9IycRPeWgjWvtaw/upfBMXU/myL73ImD6SrplHiSUi77QAsFdyXx aOev1TIaVpiw== X-IronPort-AV: E=McAfee;i="6200,9189,10005"; a="204155253" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="204155253" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 11:04:51 -0700 IronPort-SDR: vZ4Y3Ws8bBJNdpSP6JQo7nRWchu2dU+pokuczWeZaWek2FqqemtqrjR2Wk7k00w8fo57x/0/sr 5fyAb0xQrJxQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="412441882" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga007.fm.intel.com with ESMTP; 04 Jun 2021 11:04:51 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 4 Jun 2021 11:04:51 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 4 Jun 2021 11:04:51 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Fri, 4 Jun 2021 11:04:51 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Fri, 4 Jun 2021 11:04:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AmWhc00CucL7h44ZiVdchuoZkQhymUyRjL0YbY8AP6uIf2CVVbyGrz8xTgrhkAz7EbULCwrV+EoE94LEqIS/LlrVK9+Mhjh/pp0EkoS3t/zG/Eh3YZBPUSfIVgdeSAxvrwldbxZ7bdF1dDRvs6+TDN4nem6RkU2ticVXN2cAkV3e6uKrbfaORJj2LqwRDjEXVbnq8KyU4Ih4KjJBRWWND4huR6iNlrco21DHk8Jr8SoPGimeCeVuFH8REGHK23F7AVg3Y53hdMQuPpBsy079KdSBfdksReoxNPZtdg4kjPHIhrcD1cNUXSGQTsiYeoUaSncg4vfooOMFfRNM8krjyQ== 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=iV8HnVwjKwSOq2X+d6I2HfoF0f0qqMVvKjXEOfPvRO0=; b=mT+KVH/L/syA7X8sT9eDRWfTyj/J7jxZJ58xxHPit292rnRFL9/EJXKsct0rl4jHci+pf53pSf/QfXxWVN2s65rH9SmtSJgSuh3K8uo3Gj2M2nnIDM/B9MD4s3cil8shIYcoGljbgR/WwDBdvgoDyqkMkdSBcOCoUt4tOz8v/73yXaGq8+H+QidWaXJyIi0CbXv2SUu1IzgWGxKd50hiFvmGrhSHUtI5SOt323ydVMqfu4lskICmAYqMUL5uXuIgSYpQ9dtkd43OgP/N/lnOwdyPJI9vaBG/wm0ZYG0YIuj5aG3tJrxGRQdat8Qs6W0/k5fxFrf3GoqYvxqgSH+2SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iV8HnVwjKwSOq2X+d6I2HfoF0f0qqMVvKjXEOfPvRO0=; b=LfMpqAKBY+GmPfKEfMwFxa5+V83dZEqR1gMhgcpkw9u+bOjrff52S8YCAV/aeSz5AAiGXjiu4+iKBqhJ8PS7AlKpusu0HnUuzbkG+qGDn273uepd/rLW3Bk7FAqcBPf3Ym9iYlPjYlIcmqGqJvUIwdeuvh6yW8iKAVYA45eM8C0= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN0PR11MB5743.namprd11.prod.outlook.com (2603:10b6:408:165::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Fri, 4 Jun 2021 18:04:46 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::8807:6661:e425:102]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::8807:6661:e425:102%7]) with mapi id 15.20.4195.025; Fri, 4 Jun 2021 18:04:46 +0000 From: "Wang, Haiyue" To: Thomas Monjalon CC: "dev@dpdk.org" , Elena Agostini , "andrew.rybchenko@oktetlabs.ru" , "Yigit, Ferruh" , "jerinj@marvell.com" Thread-Topic: [dpdk-dev] [PATCH] gpudev: introduce memory API Thread-Index: AQHXV+8BBxLOVwnssEGBVBOBXmJb5asDsYIAgAAdKQCAAAozkIAADNIAgABA81A= Date: Fri, 4 Jun 2021 18:04:45 +0000 Message-ID: References: <20210602203531.2288645-1-thomas@monjalon.net> <1628314.htsJS64bL4@thomas> <1648109.dXcHqNedQ3@thomas> In-Reply-To: <1648109.dXcHqNedQ3@thomas> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.142.30] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fdf67e08-ba21-4644-d371-08d927833cac x-ms-traffictypediagnostic: BN0PR11MB5743: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KN8bH2rQN1NkTMYEEVBIEsyTE5nQUzTn6PUTxiywjjB3mIMwoQ/BWQBcKymON6J2NAzugTr7Q/5hHzYpBzMkscYMeB2QppsjLwQlebC/WrWBcr3wvGMJUHCzYEYXkHnTZMaGUVEegTmPZBgEa3M3dMH7F9nujOIa9P3/1p1/p0FohlXY5iB7LzTBAeeUerbbCDYdkVEm1FZyUZEaQ5PNif891P4mwqPABjrcEMI2b9zrwodcOPvXJlyA8/YwkS6msKsEeICGu6ozVmvETD/AeSLEPFfYUaTocldIiVnATPlf9iEckiIHaLUtEI3MHTlDVFtv55OHAVCGsC6x2xaSGmw9/H/lwsGgcPT+fbJimNjUTYtLd8ZOt+ZpyHZ/Yst9YlSRHjx41PreytSxE66kPoKJHnp6F04v+xshUNLqy2yqlBlq7vwhme/37ZKTHZJxRh6nqlnRg+F+I42hZ0g90/bsCHFmDVzrbD77LzTRbk1+xlAvYtVwjxe/qB/GkMTuttm/nZMMWkgFSN7qyuHKqT/dShevNjiyBS18x2V1ifGL8aWQwGlto9cTd8iWLE9/WJFoZFJYj00Swz7iOS4U3dVTN+C3xWrSbUJKO+7Xa7Q= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(396003)(346002)(376002)(39860400002)(366004)(55016002)(83380400001)(7696005)(478600001)(2906002)(5660300002)(86362001)(52536014)(66446008)(66476007)(66946007)(66556008)(8936002)(186003)(4326008)(9686003)(71200400001)(33656002)(53546011)(54906003)(8676002)(122000001)(6506007)(316002)(64756008)(6916009)(26005)(38100700002)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?+UR4TO763xKtJ+Ts7Si2ueptB3dQ3U79jUsX27OwruW266vMpKFzWqiyQtCi?= =?us-ascii?Q?u9hqeMApQd87mtnwcDMNbKK3ZpvD7LqZxphBBQU21WhW+CzEjS+xYN9mjGm6?= =?us-ascii?Q?un+DTYaQtJexOzKtBM6YPpC01MBmHe2jCy06gUC+vIsWoWIzUKsl96SPuLqB?= =?us-ascii?Q?nQxssCi1s9FnLqjy0XT7xdpa9htC5z5YZ3W+xoCFFSbgzsMuK3HpinSxOR4C?= =?us-ascii?Q?/p2/9JHoo9YrQ4W5a79i/09QVZBdJCNcJXtcG1A+r6BMOVGmGumSXwVXY5Pe?= =?us-ascii?Q?YP5pbScs9zV8OpE4K7J3Zd7SKLMt0EkiifyA0P5hm41B/VchMQ9IpYC61Nj1?= =?us-ascii?Q?XU0l1s/QzEBqsf/ZATKXpUUixufxR3EokTjE3a1Ji8R4MdJ4fIQOpBt5r+7Q?= =?us-ascii?Q?xBkXkfj+8M5bcXC8U3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M7MkiI/KJGCmDgiCdN9C4?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdf67e08-ba21-4644-d371-08d927833cac X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2021 18:04:46.0714 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GS3KSFGULc0vQNMpYvB/HA5T2pQnZIacTCKif0S3Td8Re00JlcjX6bERiFm/dqZEnr7Sgq5g3Vn9ckGuRPC0Kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR11MB5743 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] gpudev: introduce memory API 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" > -----Original Message----- > From: Thomas Monjalon > Sent: Friday, June 4, 2021 22:06 > To: Wang, Haiyue > Cc: dev@dpdk.org; Elena Agostini ; andrew.rybchenko= @oktetlabs.ru; Yigit, Ferruh > ; jerinj@marvell.com > Subject: Re: [dpdk-dev] [PATCH] gpudev: introduce memory API >=20 > 04/06/2021 15:25, Wang, Haiyue: > > From: Thomas Monjalon > > > Another question is about the function rte_gpu_free(). > > > How do we recognize that a memory chunk is from the CPU and GPU visib= le, > > > or just from GPU? > > > > > > > I didn't find the rte_gpu_free_visible definition, and the rte_gpu_free= 's > > comment just says: deallocate a chunk of memory allocated with rte_gpu_= malloc* > > > > Looks like the rte_gpu_free can handle this case ? >=20 > This is the proposal, yes. >=20 > > And from the definition "rte_gpu_free(uint16_t gpu_id, void *ptr)", the > > free needs to check whether this memory belong to the GPU or not, so it > > also can recognize the memory type, I think. >=20 > Yes that's the idea behind having a single free function. > We could have some metadata in front of the memory chunk. > My question is to confirm whether it is a good design or not, > and whether it should be driver specific or have a common struct in the l= ib. >=20 > Opinions? >=20 Make the GPU memory to be registered into the common lib API with the metad= ata like address, size etc, and also some GPU specific callbacks like to handle= how to make GPU memory visible to CPU ? And the memory register can be like the exist external memory function: int rte_extmem_register(void *va_addr, size_t len, rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz)