From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 509EEC47096 for ; Thu, 3 Jun 2021 08:27:03 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 83EF96024A for ; Thu, 3 Jun 2021 08:27:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83EF96024A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=monjalon.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D87DB4069F; Thu, 3 Jun 2021 10:27:01 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id BFDE340689 for ; Thu, 3 Jun 2021 10:27:00 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 319A95C0099; Thu, 3 Jun 2021 04:27:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Jun 2021 04:27:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= k9/WhMpTocWAfTplkWUT5iawfVVaOw6Xk6UzoKaIqpA=; b=t+9qGOas+xXbh7Rq fJYwSmCpf1ujsNjm2oca7gvm1rikcmYIqyw0KPbh1lNrv+g9FcCXepXqXULk4pOM kdZg2Utr6y1xphu344dy1VZgARHvSEflgTUmqnaSmy1CqpHDVGW5wWhjQeaBGQsj VPtl5PB6g1rCFM7keGAgMrYbON/s+NuLK6lSiKjTVDap0gIU/csSiZQxFAn52mHQ sGs1rUmcubEqnqtOTlUMPRXEGFYPTKOppjk3t8JKvyh0fxElaEnK8YOr3A5J+qe9 dckLnaXWTkhptCFtmBLn3udmCSqlK6GSD2SUzKCzxEZEUhiE/XliSyWW8NLFpAXL cbe9Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=k9/WhMpTocWAfTplkWUT5iawfVVaOw6Xk6UzoKaIq pA=; b=EWz5ib9/WBFABmxiyxXzX12kpEfBKz8hkIKW/2aD1HRZTEi2wra2jG33v 3DBqumGVQpU5UyhGxp+ypNsMx12v4ObhU1F0MwOOsyAdVJYtHJR7uDDexCHUD7Mb uubRlxP5ipAq+K470eVQGdDGk67xBW4b4yqVMVt7OKuumOb6b1z2/hqybh4oXFE3 6qulTD6lEE+7Vgr8eUJNk2ovJVnfyiJ3jrQ0Togz1DZ8Lf0EX/BgGhARILWVICGf 12mhjh0h5er914SFXRXuOldqLWbz3PiJ7tZ8beCebNw2lFDaJ6rHMQCnT86f5jew N9UoLBTds9aqppiXUENjFvUnXyGOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdelledgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Jun 2021 04:26:58 -0400 (EDT) From: Thomas Monjalon To: Andrew Rybchenko Cc: dev@dpdk.org, Elena Agostini , david.marchand@redhat.com Date: Thu, 03 Jun 2021 10:26:57 +0200 Message-ID: <2734085.Iq8TftFMOa@thomas> In-Reply-To: <0f3bdf41-ce07-caa4-289a-b05f6727bf0d@oktetlabs.ru> References: <20210602203531.2288645-1-thomas@monjalon.net> <2561723.R1Na977jkj@thomas> <0f3bdf41-ce07-caa4-289a-b05f6727bf0d@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 03/06/2021 09:49, Andrew Rybchenko: > On 6/3/21 10:26 AM, Thomas Monjalon wrote: > > 03/06/2021 09:06, Andrew Rybchenko: > >> On 6/2/21 11:35 PM, Thomas Monjalon wrote: > >>> + * Allocate a chunk of memory on the GPU. > >> > >> Looking a below function it is required to clarify here if > >> the memory is visible or invisible to GPU (or both allowed). > > > > This function allocates on the GPU so it is visible by the GPU. > > I feel I misunderstand your question. > > Below function says rte_gpu_malloc_visible() and its > description highlights that allocated memory is visible to GPU. > My problem that I don't understand what's the difference > between these two functions. One function allocates in GPU mem, the other allows the GPU to use CPU mem. > >>> + */ > >>> +__rte_experimental > >>> +int rte_gpu_malloc(uint16_t gpu_id, size_t size, void **ptr); > >> > >> May be *malloc() should return a pointer and "negative" > >> values used to report various errnos? > > > > I don't understand what you mean by negative values if it is a pointer. > > We could return a pointer and use rte_errno. > > I was talking about something like (void *)(-ENOMEM), but it is > a bad idea. NULL + rte_errno is much better. > > However, may be I'd kept callback as is set rte_error in lib if > negative value is returned by the callback. This way we'll be > safe against lost rte_errno update in drivers. OK