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 873B3A0A0F; Fri, 4 Jun 2021 15:25:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 048EA4068F; Fri, 4 Jun 2021 15:25:44 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 1779840147 for ; Fri, 4 Jun 2021 15:25:42 +0200 (CEST) IronPort-SDR: qz6wjd8EG1xQiRxgb9niUbBThV+tZ9ls2G73tHNcxNXNb0Ne61AtP0FsPuBqaow+Mx5ZsCh80N BoK+Py8Mjl1w== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268151981" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="268151981" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 06:25:40 -0700 IronPort-SDR: UyFYsJChuW7C24A0+FgPthVYkaX89/E5k15vViqf3J6wsfjC8kQ4izWqE+8fyz1YrcHDZil+7m ny2R71UZw1eA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="551161758" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga001.fm.intel.com with ESMTP; 04 Jun 2021 06:25:40 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) 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 06:25:40 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx609.amr.corp.intel.com (10.18.126.89) 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 06:25:39 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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 06:25:39 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.169) by edgegateway.intel.com (192.55.55.70) 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 06:25:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KZcnBoW+h1TQNdPkbB0xS3eIqsz4JYUKAlRnQ6uEGHBM+VASjHer5mjn/FNVijfUA0lKeK9qcx7NAuSBX/BMZkNjznuFIWWhiz/5ZZ4borS6srQDverDIzMOkRvjxfyYG9JZuOkgHnz1QH0Oj/jSrNGX7ULMIIoYpFcLk/pE3Q777kRiJ5w45bhNaGQY7RhR5pGwMoUuI2fuqQteEpNzk1heEu3UYcb+xtSKUPriEuOW/vdvsPHKATFNkJePb2sEvs4a3O18x0CFk2/gUff5NRVOu4UO2Bid30Nk8z9TVz2uzyUdlbEbllWBx3j1yWl4p1HOej+UDd5c+kaJAPdRtw== 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=EOxMdQa+HOithtRFff+wnuh4Pn5wfzc1jKwe/jtYKbs=; b=AlsHb3oJJATRpZUUBbhkukgjdf17pHBftTaEEx2TZ9eOkXHJV9ULfGNJV6firVmhCC09Od+ldchP39NA0y1D9FXvwb7DkXEPJgoDo/fSUD/8JqM6DEGQkQ/p3SB7qjmvt/oyfyLvtzVzrYeSyao9tlmiX4mYqfdqEbu36AFmybN3lW3OQIln/YFEY+hHp+SHPh08kGjDb53gxt5a0lCfeyKDMJ35xhKNQzVQ/upsyjHGAb9W4sBOB37iJRKHrVzoquDZxZ2897kdliz4V8LL4RfCoGzX0K4bYrKf51CvKWfRShSSxJg99xstpUZm0+RLaBIFrpQpCQgBsZhiDOaIjw== 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=EOxMdQa+HOithtRFff+wnuh4Pn5wfzc1jKwe/jtYKbs=; b=zzV4NVvKPYMXYHXoxlxpIaavosccd4w9UndjrRMEDVwt6DV4A3+a+NuhQgXMo5avqsIXPnqR8TWSPDNOOmrsvQK2CX5U4cKSZDz19CnsJYDs1qHJpqMsZIIfqYo092iOfDmForvqa+HPiC7H172D9dYGqs/xHfCb/ssUSVdetzU= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN6PR11MB1905.namprd11.prod.outlook.com (2603:10b6:404:ff::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21; Fri, 4 Jun 2021 13:25:31 +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 13:25:31 +0000 From: "Wang, Haiyue" To: Thomas Monjalon CC: "dev@dpdk.org" , Elena Agostini Thread-Topic: [dpdk-dev] [PATCH] gpudev: introduce memory API Thread-Index: AQHXV+8BBxLOVwnssEGBVBOBXmJb5asDsYIAgAAdKQCAAAozkA== Date: Fri, 4 Jun 2021 13:25:31 +0000 Message-ID: References: <20210602203531.2288645-1-thomas@monjalon.net> <1628314.htsJS64bL4@thomas> In-Reply-To: <1628314.htsJS64bL4@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: e1f3b726-a3d8-4a19-f9bc-08d9275c3a24 x-ms-traffictypediagnostic: BN6PR11MB1905: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: s5WuyiSXews57/CM4CGkGjUyrbu2fFZq8oigxVP7A3HcARfz3f4iPbhwE+ZocrCaVIYIfNfdonIwTElB881Ans92qu4ygeOnbcA//DGRaZOmfFCHUJfhXZN7rotVmhMif1yJQnaCzV2hryN60zABAyhgrtmvarKU5fdbn8ZNN/BC/m1mvQWMAyrUMMcKBPzMEMWqs5sWexbbqGCw3cwAj1PwwyMA1hiLSdy3AEh4aaLyi1+2GsfpQJPhsN0ky08cX4KLTzak8MwUOTTxxor+E/7t86PVGJko5M1BLess1kNL1Kgr91sPFUhlMWDda1Z2N7w5TwxWC/lHG1mtcbjtCX38hoMmuXicOsy49cDJy4DoGzy5kJLuCjykMH9rPP+XPBcm5XzIXcawcEqAWexjgQvxaosnNQ99/dy3LfPAKyoY839hcTeDp2V31cAzroPgK9MNL+o3YCnMpzI5oBpxK0vrtZKwT8LVf5FwVBH63R+h30k88/I0SqUI+pJvx3FyD/GGutcZS7K2K/jLv9FSgmVbL7s+J0XTBZQeRDY4rcXNYnqSh4qumt2CfoawP6WhbqFkydSMluQEMPviZ5u0H6lCIjyD3Ndspr3mixcm4DA= 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:(346002)(366004)(136003)(376002)(39860400002)(396003)(54906003)(66446008)(66556008)(52536014)(64756008)(66476007)(122000001)(4326008)(38100700002)(66946007)(7696005)(5660300002)(6506007)(186003)(316002)(53546011)(76116006)(478600001)(26005)(71200400001)(86362001)(6916009)(33656002)(83380400001)(9686003)(55016002)(8676002)(2906002)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?//lrnzPCNphBICShYGKeiXwHJ20Lvj6Vh/dvKJTiXX65ZrPcO59E1y+qQ73J?= =?us-ascii?Q?KZoG6HmTq/GSdlb7bFHsGy203w7z1p+gttLSjCCa5xUJgIt+Iv2d16v8Qjvu?= =?us-ascii?Q?2e8f/tunMiuesm69lyGkc9ojb1bZ3VQhUbDMpkgjfhU82Iet23OL/L+uKjUE?= =?us-ascii?Q?OMXXz/LJkIiPXGYL5t0dvPYVOhe0YUPrt9d9koBOh0Hz05x1vuRly4+EoXfw?= =?us-ascii?Q?N6JFtBnuYerWfG+Kr6wzXkerbHmhP6FYzVOPsk62XG6vZjCEABmxcRDuf2mM?= =?us-ascii?Q?lO3QZ8ej7MOg4WtAuJzr0o87uxKYgKrsi5wQJGdVlIUbjRbUFhKpfEtku2Xr?= =?us-ascii?Q?KF8wpmSeoNvn1QRT1GMhHqS33QXWXc73dPxTSLygP5El8IKwM64MjThly7K2?= =?us-ascii?Q?lZYrIW7FOmMwMHMqhA9ZFnM6B3OuCwJq7WBzlZ5MRhdBwE8+cLUhUM6p4aRM?= =?us-ascii?Q?ba1jv5oHlqqaMBQY7xqcgH6xnaDSeRu8wR5FZSzR4JHRjFpJV/HHcYKERXUV?= =?us-ascii?Q?FRv1LYt89CrnsgYM9nOc75OcSY5z+3gIIkfsE29JwammExiznxNOlCeErUIq?= =?us-ascii?Q?WBEakutg2uneDDKgxuCSJ7xlkBDbBEFQWeAETKvZ8bgkYYfl1LtgawoJ572q?= =?us-ascii?Q?IjQ+z8ZxikUhKajJQjC3Y/tn23pQDkrxPUu8s3993P37xpFD2yLin05NphSY?= =?us-ascii?Q?zEnYPwuoslwr5hM8d6yUQDR1YqFwdPFtR7JIozOozSv+dpntuMRX1X00vs+8?= =?us-ascii?Q?a/Rqg5uwEVqF1bFepSmCEXDOvQ4r3imDtTJluG+0uLQbyG2ukVehep2k78ek?= =?us-ascii?Q?0jv3o1Mczll2u8/+mN5GrCmaIluWrQoi9CK3hXAqiV49hHl0SPKtUT7QEpPH?= =?us-ascii?Q?WB6E/Pf6F9DEiafXreLvcJb6YZ2ztUeJxdWkneP8qni7DZSZZpxA4zDx6jvz?= =?us-ascii?Q?UXpiAKPBVtFa+94z0CIu/NojTcxz5Bre8CK4W/hJyhfFsLVmXj80ALA5n6AZ?= =?us-ascii?Q?zEemroK0MTBMOBHxcz1hQBFy5B/+GKT1JElbEflevZ1bqs11oPEX1tFTlt+3?= =?us-ascii?Q?k8BC03B7sAxye5DA3GQUkOZqNd/j7Q7eQTmLaMIY/NJEALVNqZga3pPZHYD6?= =?us-ascii?Q?sSUGmU3I5FFlXU3WX20dl7owDmTVaLX7iiZZWKUTVyFuS315zmLGbdP8Uv8I?= =?us-ascii?Q?U1jVWl6QC+wbfLNHEW5HSJW+ONG95Uuy6j0mDGMR7F26ikm/vqHd4QJcYzWR?= =?us-ascii?Q?xR5Eo8WRMJDi7zls0gmFTEdJ9zauA55sob2Ere8yqvDorNzKcI72PSfdCOx6?= =?us-ascii?Q?6Tef7Ifk9T0P+vHz1Xde36Vv?= x-ms-exchange-transport-forked: True 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: e1f3b726-a3d8-4a19-f9bc-08d9275c3a24 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2021 13:25:31.4252 (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: LNRRtIum7BMd9UY7Z88GRu5jdXre9Sf8Vf+Wp6hdd2BlM3xfkbwnyWBHpM80S6KaHMucg+fU3AA2vx6ufYrdGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1905 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 20:44 > To: Wang, Haiyue > Cc: dev@dpdk.org; Elena Agostini > Subject: Re: [dpdk-dev] [PATCH] gpudev: introduce memory API >=20 > 04/06/2021 13:07, Wang, Haiyue: > > > From: Elena Agostini > > > +typedef int (*gpu_malloc_t)(struct rte_gpu_dev *dev, size_t size, vo= id **ptr); > > > +typedef int (*gpu_free_t)(struct rte_gpu_dev *dev, void *ptr); > > > + > [...] > > > + /* FUNCTION: Allocate memory on the GPU. */ > > > + gpu_malloc_t gpu_malloc; > > > + /* FUNCTION: Allocate memory on the CPU visible from the GPU. */ > > > + gpu_malloc_t gpu_malloc_visible; > > > + /* FUNCTION: Free allocated memory on the GPU. */ > > > + gpu_free_t gpu_free; > > > > > > I'm wondering that we can define the malloc type as: > > > > typedef int (*gpu_malloc_t)(struct rte_gpu_dev *dev, size_t size, void = **ptr, > > unsigned int flags) > > > > #define RTE_GPU_MALLOC_F_CPU_VISIBLE 0x01u --> gpu_malloc_visible > > > > Then only one malloc function member is needed, paired with 'gpu_free'. > [...] > > > +int rte_gpu_malloc(uint16_t gpu_id, size_t size, void **ptr); > [...] > > > +int rte_gpu_malloc_visible(uint16_t gpu_id, size_t size, void **ptr)= ; > > > > Then 'rte_gpu_malloc_visible' is no needed, and the new call is: > > > > rte_gpu_malloc(uint16_t gpu_id, size_t size, void **ptr, RTE_GPU_MALLOC= _F_CPU_VISIBLE). > > > > Also, we can define more flags for feature extension. ;-) >=20 > Yes it is a good idea. >=20 > Another question is about the function rte_gpu_free(). > How do we recognize that a memory chunk is from the CPU and GPU visible, > or just from GPU? >=20 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_mall= oc* Looks like the rte_gpu_free can handle this case ? 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.