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 DCD32A0C41; Thu, 18 Nov 2021 17:22:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A54A740696; Thu, 18 Nov 2021 17:22:52 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) by mails.dpdk.org (Postfix) with ESMTP id 1775540687 for ; Thu, 18 Nov 2021 17:22:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UGquLlvWlqMBxtdk29X3QNhJRDXw5apZhZ4p+ZZDh5KwdheRkNWv1yw8w1IP6v+3IFOVsbZ3z+Gki6BrHUUsPR9wTtxj8X6eLJ8VALNPT343M8g5tykjvThj+JLbirjO5P6YbrhCKD9q7JsdeVraHEmUpULOsAZPM3yjHfoInEz6P6jHIK0EUUGyntAityVcAwdi8xDkaGnuX34Fcs88uRwuhPITySZjCtAhJAVOvQHi3Y6dniHsuOFDKwRS3fasiOcE36q5SPXgwJkC03w295fvsxKJOrOI4yXT5ACnTUTIsShuiro1RYwJGJHaBAVXenifpqYZUm1aOKVm8fo/QQ== 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=M81Dnqx3cKP0SMkZx6HqIRmkMoG5mE2TLAwg9+K17NI=; b=EQPX5P23MtKZbajgODBnt+hKxxKDLnE/3clZS3WWFk6VoJDFPkunG9V2ZgwI4jLoCDEPDaa0tFxvutq6ET4KMG0IwdvAgwtL9Dquxdf/+vf3cPzE96QlmBlIobY5iA0ezJYaiCifW97jQuIOw5YDBlRkUusig6X8dUs4l35+x8Rb++hT5S36ds7WybqQsaCmLSJoD1fvoTyki9CVgK7BY/3oHEqhWO3OHjqt2+nadTu/+y/YgFqXHwRpV0gR0G4rjqDpBpQ8nqvRaQRKormQWVAfkmkuVXlgfY5bZFlEiDB+RR+C/+/VfCPRt7FcNnO3SUSzXtpXVqUpmPYeHk/Z0w== 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=M81Dnqx3cKP0SMkZx6HqIRmkMoG5mE2TLAwg9+K17NI=; b=boeSqHFvapimcufnObdTh2NZ8bd0p8oPrlAijsf8tOWhE/jOmquivCouu9mj4kjFKz5P8QW3A4Emea6zofni3mN6sfJuQuiNAy2vwGlR/mCskzuzS7GJINTBncB8zVElnh/epDOahFJJJqShH2MJXGeWcd6gGKq2cc0EnDqwOEeAt1miEVvK9ZD7xl5Vpw7y5/rDAiDRkmnzml9SijwfB1Etv0joB5Ax0i0zd9soywq3rkz1svXL95N8KOvFUmsUP1Z8q0WCxHJAJoS0c+NeF4YcoZztNrX9ZVFSkJfHwK5WBpXU6DDqdZUDWuOLzv0TqViSDseOp6sXJ4qhQ8sq0Q== Received: from BY5PR12MB4100.namprd12.prod.outlook.com (2603:10b6:a03:200::13) by BYAPR12MB3448.namprd12.prod.outlook.com (2603:10b6:a03:ad::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Thu, 18 Nov 2021 16:22:47 +0000 Received: from BY5PR12MB4100.namprd12.prod.outlook.com ([fe80::30dd:7ef1:de7a:b4df]) by BY5PR12MB4100.namprd12.prod.outlook.com ([fe80::30dd:7ef1:de7a:b4df%3]) with mapi id 15.20.4713.021; Thu, 18 Nov 2021 16:22:47 +0000 From: Elena Agostini To: Stephen Hemminger CC: "dev@dpdk.org" Subject: Re: [PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister Thread-Topic: [PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister Thread-Index: AQHX3G3rNe7JHY56eUaLchd7tkU8CqwJd6yAgAAASD4= Date: Thu, 18 Nov 2021 16:22:47 +0000 Message-ID: References: <20211118192802.23955-1-eagostini@nvidia.com> <20211118082057.55cbfc28@hermes.local> In-Reply-To: <20211118082057.55cbfc28@hermes.local> Accept-Language: en-US Content-Language: en-US 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: b2c75da2-01a6-4b29-b73e-08d9aaafa882 x-ms-traffictypediagnostic: BYAPR12MB3448: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TINUFv5bwvG4tvIOScbjlCEwqw2nKQvO4xlOddhPoi69wnKJV9bhjvOc4U9NwtDZdFCWk70lmn32yYJ9vTOY2mg4PAZeuD1hCc/1KhAc3P4LAsuciOrtAmEAORqk9NCgOukr/NOzLKw45L+jPrJWIVXYwKtz4K2SlFJovO0y831bTrXS0t+VV+VEuenl5KhpbR8SJJ2O2gxXeLVmVt2Nj574DxTi4eUa4eVEl2ThJiXQ23q37OGyBIoXWTbGqe4KH1OyzidYBpZJ9++sqiOlxNbsgL81n9pGEfWKU/Oy5pUivOES5PKKA6z0n92ItcZvfvdlj7F4qK0BE2F7NlYi0opqDO0oCDE6fuXfcW+hKFDHlOhv+2j/SGvgXEQkkypgTGbUsO3X8mrILqcCDsH9Cm2f9vtChtJNr1qRO2h1cw3bh4P8h6lFVpJnegdtMdxuQJ+3dC2gidaqgjUDPH+TAVLo2e6aJNEk/uG8ceTFcTUwZIDowkK50bHjZ1pM6LRzgwnNJLpHWeqS7xb+AZW5LOhrWeUb1hCPO4kwnyZN0AmWi6cRDp8k7wPRDB3/xD+vGnKRBLhx6dV1YiG/4liJirIG2j4/etb5xq05K+DZbHpSum6IirffI7KdCBY5LYEbIST8krPHPE/eUnZl31V2jTm8SAfHgMnmS0ATmWPCtEzlOgKZOQC1jkVYZrtS5ulchlSh3SKVtrtHaEObG4LGMDj7QLI3epmZN2vKY1kxUFy+jAaucF+edENSSk6YGiRa1r8UWUByA6RDQrMOtEL8QSpATXOpkfcO2alFnE448rpNtRx1/4vLztECh5kaYnho x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4100.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38070700005)(6506007)(122000001)(66946007)(86362001)(91956017)(66446008)(66476007)(66556008)(166002)(64756008)(4326008)(76116006)(9686003)(5660300002)(52536014)(33656002)(7696005)(26005)(71200400001)(8936002)(966005)(6916009)(316002)(53546011)(2906002)(186003)(55016002)(508600001)(8676002)(4533004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?GsPDa9UOb+OGYE8M5KVsLRSJn8k1no3FgUnaBU3kxHdj5675qd0/JTKJmXS4?= =?us-ascii?Q?0o62VegfV34BlL+XxdUAk8iNtlnFXT31LQTzy4iVvmNNkBNpfnoZdD+d1Jcw?= =?us-ascii?Q?58q/f0uUhKXhvh9grEgBBjQwAJnvSJvjIK3ug4IKP38chaIuwuQnUeWAXfIC?= =?us-ascii?Q?tVE94H2T2G2O+lrUNTezS0ULy/fA7N8Y2Z659NY1vcWcqCVwZryBiB2AmFW4?= =?us-ascii?Q?uLLYbP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?= =?us-ascii?Q?gCRHxUB4xYjHZ71RKxG4d5YO9GiVybUlZ1JBV5KmAdTVT9NTJ6YNS034HwOD?= =?us-ascii?Q?69TRwVgbOnWEUhYsg9K+ZZR2qTlQhoJnj0FFeVcEyyuwSOoQ2zqHToBkvnNg?= =?us-ascii?Q?A8o/hw4QzhuCfkK4C7e9OTCYreLgHlL+5xyyPte9ZCnRAkf+pnNz7cAi94d6?= =?us-ascii?Q?zPAl50QhSYwboSm4swlfeUhj+Z4FHwVi3ravoMxRglSNwc4RADKbmczxDPlT?= =?us-ascii?Q?HeKiu8gAcwMq7g8HJg4AhJwuDFqiNa6I7LSPsB32tuLkK9GCdZYIzWIiVhJT?= =?us-ascii?Q?GywVSC/nM05FqpDkFlaOhqTUtZayzXJpMLdOiNtyIe77oUfqwgKpTiM+M3o1?= =?us-ascii?Q?mrc30EBivXk0THaimtTPd+VoWyNyumZ0BPXbJB2vtlS0nZtabtW+SDyu9kK+?= =?us-ascii?Q?I94aFQ/nlvlID+uUoFqJc9gusW7ikPcIjUyTjhfohIfbJngZoh4vOWoBwJYi?= =?us-ascii?Q?53LwViZQ8wNPEok6anp9M1JRJEamJMIhAoJqeihVf7x6?= Content-Type: multipart/alternative; boundary="_000_BY5PR12MB4100BFAAC5DE1C0C156AC03ACD9B9BY5PR12MB4100namp_" MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4100.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2c75da2-01a6-4b29-b73e-08d9aaafa882 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2021 16:22:47.2106 (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: JPUHv0pKrJGmO+GYB23sxM2csX2XyvpX2Z74uoU789avN1rLJ+agLJkhS8baq//nYR38k8D8G+B1YKe4YyCupA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3448 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_BY5PR12MB4100BFAAC5DE1C0C156AC03ACD9B9BY5PR12MB4100namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > From: Stephen Hemminger > Date: Thursday, 18 November 2021 at 17:21 > To: Elena Agostini > Cc: dev@dpdk.org > Subject: Re: [PATCH v1] gpudev: return EINVAL if invalid input pointer fo= r free and unregister > External email: Use caution opening links or attachments> > > On Thu, 18 Nov 2021 19:28:02 +0000 > wrote:> > > diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c > > index 2b174d8bd5..97575ed979 100644 > > --- a/lib/gpudev/gpudev.c > > +++ b/lib/gpudev/gpudev.c > > @@ -576,6 +576,11 @@ rte_gpu_mem_free(int16_t dev_id, void *ptr) > > return -rte_errno; > > } > > > > + if (ptr =3D=3D NULL) { > > + rte_errno =3D EINVAL; > > + return -rte_errno; > > + } > > +> > The convention for free(), and rte_free() is that calling free > with a NULL pointer is a nop. Why not follow those?> > This would keep programmers from having to view GPU as a > special case. Please look at v2 here https://patches.dpdk.org/project/dpdk/patch/20211118= 203354.25355-1-eagostini@nvidia.com/ --_000_BY5PR12MB4100BFAAC5DE1C0C156AC03ACD9B9BY5PR12MB4100namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

> From: Stephen = Hemminger <stephen@networkplumber.org>

> Date: Thursday= , 18 November 2021 at 17:21

> To: Elena Agos= tini <eagostini@nvidia.com>

> Cc: dev@dpdk.o= rg <dev@dpdk.org>

> Subject: Re: [= PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unreg= ister

> External email= : Use caution opening links or attachments>

>

> On Thu, 18 Nov= 2021 19:28:02 +0000

> <eagostini@= nvidia.com> wrote:>

> > diff --gi= t a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c

> > index 2b1= 74d8bd5..97575ed979 100644

> > --- a/lib= /gpudev/gpudev.c

> > +++ b/lib= /gpudev/gpudev.c

> > @@ -576,6= +576,11 @@ rte_gpu_mem_free(int16_t dev_id, void *ptr)

> > &nbs= p;             = return -rte_errno;

> > &nbs= p;     }

> >

> > + &n= bsp;   if (ptr =3D=3D NULL) {

> > + &n= bsp;           rte_errno = =3D EINVAL;

> > + &n= bsp;           return -rt= e_errno;

> > + &n= bsp;   }

> > +>

> The convention= for free(), and rte_free() is that calling free

> with a NULL po= inter is a nop. Why not follow those?>

> This would kee= p programmers from having to view GPU as a

> special case.<= o:p>

 

Plea= se look at v2 here https://patches.dpdk.org/project/dpdk/patch/20211118203354.25355-1-eagostin= i@nvidia.com/

--_000_BY5PR12MB4100BFAAC5DE1C0C156AC03ACD9B9BY5PR12MB4100namp_--