From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BA688A0C43;
	Tue, 19 Oct 2021 10:33:07 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 4BD5D40142;
	Tue, 19 Oct 2021 10:33:07 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id 5721B4003E
 for <dev@dpdk.org>; Tue, 19 Oct 2021 10:33:06 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J8S5CV032025; 
 Tue, 19 Oct 2021 01:33:03 -0700
Received: from nam11-co1-obe.outbound.protection.outlook.com
 (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168])
 by mx0b-0016f401.pphosted.com with ESMTP id 3bsfk4aqvc-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Tue, 19 Oct 2021 01:32:54 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Iu5jAw83aq/9ZTQJySyIn2y2EPlhQOEaBrjNXo5rITvU+JD4/lDNDILVxB4/6cc4HkdJ1b35LKW2gcGhoy7gwtXofjRV3Q1piqKYeJSSIAoJ4oBMKukOXyxSo5gLD8c02PNkKTLKGDJ0OuI0+CQKF3Wtlxnbqqo9969b0VgHNQvpMzyRMjcHCBTv/hPq9Hfnj82pTf8UvLFmDq0Bra/uMtLo53rlx6NxoXz4sSjxLYG1teFbojD8pbHnt3p04emcXRyz8FmmxY71g8kSfuEHV3lmHjxbKVBHaRc7Q3gZP+rbv8eoCZRiI/vdMDNS7twFfR17o7L7GqV6oV9mHiRVsw==
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=sVAFQi5JFodkw4mb0Q5YKhWmQHN1mEZbItCTxVEFoTM=;
 b=DyvMA6iuqtsXbAZ9YLAGE6CLGj3bmBKTqp/1F1Hxguz06jUW4a2IP0X5DAHuNUIoKwIVFb4ORP8lcG6Eiuaa0lq8QX9bRhG09xMXCrI54zOYF+8pxf13x+DqZHWG/4HSgZVSz7pgY6RQ+wd7pPRHCaBf/pXAL3tiIm4yUxPmKRksNU65P74G52+++d26Ehnn1AdbkwhDtusD+FayGP8pQ9YY+2rh0T+Al6tbaZUrL0ny5DTQ7FsHOGgKsR0PuRw6S4LyM/18MU9Xc3otKWN6Rb1ODSLoucGIjOlx1/ps12s6WVdD5p56QvaH0bWyK5napy1FmZLgbGIBzScR8C84UA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com;
 dkim=pass header.d=marvell.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=sVAFQi5JFodkw4mb0Q5YKhWmQHN1mEZbItCTxVEFoTM=;
 b=EUnSpCabHKCRrKurGJ9CJJgkjmeZawRZDV7Gh1rwLa5zr3FxbbexhXD1+8OM2h1d8n7ZbRXmDSz2AgoyGuRROvlRt/SSmpLob+ThWgZlJNPCDm7VFfavXfn7BzTxTEwYyLmO2NpYDkAmHCn/iURXQexF5RcRkghYsbauhQBMCQU=
Received: from BL1PR18MB4197.namprd18.prod.outlook.com (2603:10b6:208:309::16)
 by BL0PR18MB2259.namprd18.prod.outlook.com (2603:10b6:207:43::15)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct
 2021 08:32:52 +0000
Received: from BL1PR18MB4197.namprd18.prod.outlook.com
 ([fe80::ec7c:9dd5:7b84:3bc4]) by BL1PR18MB4197.namprd18.prod.outlook.com
 ([fe80::ec7c:9dd5:7b84:3bc4%6]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021
 08:32:52 +0000
From: Harman Kalra <hkalra@marvell.com>
To: Stephen Hemminger <stephen@networkplumber.org>, Thomas Monjalon
 <thomas@monjalon.net>, "david.marchand@redhat.com"
 <david.marchand@redhat.com>, "dmitry.kozliuk@gmail.com"
 <dmitry.kozliuk@gmail.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, Ray Kinsella <mdr@ashroe.eu>
Thread-Topic: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement
 get set APIs
Thread-Index: AQHXxGKdt5yz0m35OkaI3v43YB1ftqvZXh4AgACCpWA=
Date: Tue, 19 Oct 2021 08:32:51 +0000
Message-ID: <BL1PR18MB41970024F2181D6A1ADB7E46C5BD9@BL1PR18MB4197.namprd18.prod.outlook.com>
References: <20210826145726.102081-1-hkalra@marvell.com>
 <20211018193707.123559-1-hkalra@marvell.com>
 <20211018193707.123559-3-hkalra@marvell.com>
 <20211018155654.0d3ffbed@hermes.local>
In-Reply-To: <20211018155654.0d3ffbed@hermes.local>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 3a92248c-a0d9-4396-fe2f-08d992db0a76
x-ms-traffictypediagnostic: BL0PR18MB2259:
x-microsoft-antispam-prvs: <BL0PR18MB225970985A88C07AAF1C603CC5BD9@BL0PR18MB2259.namprd18.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: sxqre+jb61oMAnxED7HKR9QOP2ArowQlR1gaiGXt8CQao0Wq2ui73qSQaeVG1eJ5qDnMkz/yWDzVAWVCCSYVZRwvA12sQ9Wt281aTE+I89F3Ib9FoU9IILLAqATMsXegh00gwJr0qguLdnzOHVIx32RXKoGfZH9qDwk1cHLKz779MlFgY9Aq+ZijYg7IdottIegkplaJMIln68YqcjgHOwmaJaFcYODR4wOFfv2KGHrU4GdsbKiom6p1yb2unjg9hGMUV+Pove1GRyp/eRBNoPsZsIMFXBDRNicpZwYzTiKc5TTUEey/6VxBeOufs5NlMAEDfpCFwq9Zdgg5P8fjI0HLtB/W+FUa7zcXoYDGjABQRHSFYRztoutSXWq9I5gpSPXWM6g+MFAVj4JgixEr8kkoUYiyMHV7UZhHkmL4JcQj7nBDDE0MNcPfjaMBNiUy4NgGvI1m9z4DiOAOr1qumOLk/tf8El0PjLTKPU+nUIxm5xsdhwhbf4Q7w/Q/RESKkyU2msD6pWpJeh3++nimsE1723Wg0r/iNg9Uw/LLgel+xNXZ4FHBkPbzETYe3Nbuf3Xl6UrFqInEJh0ruDIyFJUtqlk7WMdnarEfRIbIGPopWiRG6qLJ/0t3jIFCCKEvIrXcb4WT+v0J3Wa02u4BxzpqUwwbAtLO1r9kQJTSy0W6qnn10IwY9LvQ85mHuZ158FdYSJ1299kCu7To+6chwg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BL1PR18MB4197.namprd18.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(366004)(2906002)(86362001)(33656002)(316002)(52536014)(26005)(110136005)(4326008)(55016002)(9686003)(53546011)(6506007)(38070700005)(8676002)(66556008)(64756008)(71200400001)(83380400001)(66946007)(66476007)(508600001)(8936002)(66446008)(76116006)(54906003)(5660300002)(186003)(7696005)(122000001)(38100700002);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?p1UAE7l9/b+vekg6e5FXPggIhApOr1R2nSHfewHQ3yqLsyhipGLUnZs/sRcS?=
 =?us-ascii?Q?7kuBeSsKic50qgMRA4q+Lng9IInIs1ttibqwd9izasJdx9lKRaZ1SK587flj?=
 =?us-ascii?Q?/i2ZlsuFnBSWNS+AubbwPpzepxb4jlppJMVXZBSFrhtEY6ecjdGmvQpVB0fJ?=
 =?us-ascii?Q?YiYmqMheSNvdjMM7reiVlzA/QLnN4P/efHhXYaybS+rfyHBMJnQeEzbwI1KE?=
 =?us-ascii?Q?9/IzgDyw6q3d543qy24HVcxU/IFCMGJN77VYWL2nrFEcbuKtiS8j4Bxqpv1f?=
 =?us-ascii?Q?5KF4rn6D8vYjKwKv4UgLScImu9FEpEEmw3KGedFX9oYY7tkPLF/9qwuTS5V/?=
 =?us-ascii?Q?vJsux057O3VfjCy6sfHC0ymV0oeU0kC/H8e7iwjE6Enkd1P4UMvQQjDQRalI?=
 =?us-ascii?Q?7Pb1XmqRAR3JeQ0dw2uIvf7S9qcFT4yk6QNb408sJlVegdpMe9aI1qVERhOr?=
 =?us-ascii?Q?w9vQvo1cQl6P4foHLF/UJ6FJAsPr/dJ9/FyPREm5PSrBZ1TQzhJEh1tZI71X?=
 =?us-ascii?Q?6YWKACSZ2R2OPATiE8VwctpoTQKB1XpoPN6npkhJE4WM6Lgs6ZH8qkBylyOd?=
 =?us-ascii?Q?g+z50zfOraO7vRcDOmNRhIDQc5DOKscThUBO9jkxTNRuNEehSOEulnpHB/OK?=
 =?us-ascii?Q?FqwiswH7c28QJPwV7LbXIdTeNiZLj/2W//TQ7JpVzw6/XeWKI7qTHqVR3iti?=
 =?us-ascii?Q?OV/2iShdsUyD2bNj+PwpJvBcoQ/x1hZJul0N3DzPBf56Xerzm4TcfBd+yxfT?=
 =?us-ascii?Q?Yfm37BeD4O465NWpv0rIqoFeDw+l9qFWuZQHCyOFLJ2fQWHVd8GfEuuLNzHE?=
 =?us-ascii?Q?pu9fg4Ia7y6uDA2BSnrjW2NtPvvF8dYFv8iwmxJFotFUPVytYLGQYzbWomgl?=
 =?us-ascii?Q?0GMtNags8UKFSQLylN3SE6yqhJnPEpgG0zV97C9mWVN3LZ12iYQ487DeaLse?=
 =?us-ascii?Q?TCO+0vnrdivVhl2sBm6xQmqTFz/mrx5YTcwQ5LxY/88iHIm/0ZHOkx1KQU/V?=
 =?us-ascii?Q?lkBfyX6N8qWtsEXFPac4p/JXEpYlVXk+nGL1Dgj0F/sA48bVPvdSFpqoDCiG?=
 =?us-ascii?Q?52TDiHcjvCrrbSSQbxC53ImQpXKFh0X2wzvUigOyLuZZ26FZhDApXPU7M1V7?=
 =?us-ascii?Q?Mya7gAvKWKeqYOH9JXB3b4J9R3XcPlPW0iAPUjegOcMuxshvUna01m6hXPPO?=
 =?us-ascii?Q?o3hB8y6RjMnJSvySXPnZqWyzfX7HLiiCGE7KaF0/YmVXUaH+yrzZkEcV2YUU?=
 =?us-ascii?Q?GcQ2UGWujViV4/b6okH+lpo9OTPbIa+h+6Un2IMF4TwEGG3vpKrGa5laZOPy?=
 =?us-ascii?Q?Utv55VctSlmONu4KYwA5FhGY?=
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: marvell.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BL1PR18MB4197.namprd18.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 3a92248c-a0d9-4396-fe2f-08d992db0a76
X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2021 08:32:51.9126 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: LCijwBhqWcYg3jkFlBcK8fyCsCybsIE64GUti0yNKPmy6RE+xX4eDYCcHzQyspbIGQGz8CFeaaIP40MsSoERsg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR18MB2259
X-Proofpoint-ORIG-GUID: 0CFCfAzYgs-6DFv7UGGmSlZtEIXSlhOy
X-Proofpoint-GUID: 0CFCfAzYgs-6DFv7UGGmSlZtEIXSlhOy
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475
 definitions=2021-10-18_07,2021-10-18_01,2020-04-07_01
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement
 get set APIs
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>


> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Tuesday, October 19, 2021 4:27 AM
> To: Harman Kalra <hkalra@marvell.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Ray Kinsella
> <mdr@ashroe.eu>; david.marchand@redhat.com;
> dmitry.kozliuk@gmail.com
> Subject: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement ge=
t
> set APIs
>=20
> External Email
>=20
> ----------------------------------------------------------------------
> On Tue, 19 Oct 2021 01:07:02 +0530
> Harman Kalra <hkalra@marvell.com> wrote:
>=20
> > +	/* Detect if DPDK malloc APIs are ready to be used. */
> > +	mem_allocator =3D rte_malloc_is_ready();
> > +	if (mem_allocator)
> > +		intr_handle =3D rte_zmalloc(NULL, sizeof(struct
> rte_intr_handle),
> > +					  0);
> > +	else
> > +		intr_handle =3D calloc(1, sizeof(struct rte_intr_handle));
>=20
> This is problematic way to do this.
> The reason to use rte_malloc vs malloc should be determined by usage.
>=20
> If the pointer will be shared between primary/secondary process then it h=
as
> to be in hugepages (ie rte_malloc). If it is not shared then then use reg=
ular
> malloc.
>=20
> But what you have done is created a method which will be a latent bug for
> anyone using primary/secondary process.
>=20
> Either:
>     intr_handle is not allowed to be used in secondary.
>       Then always use malloc().
> Or.
>     intr_handle can be used by both primary and secondary.
>     Then always use rte_malloc().
>     Any code path that allocates intr_handle before pool is
>     ready is broken.

Hi Stephan,

Till V2, I implemented this API in a way where user of the API can choose
If he wants intr handle to be allocated using malloc or rte_malloc by passi=
ng
a flag arg to the rte_intr_instanc_alloc API. User of the API will best kno=
w if
the intr handle is to be shared with secondary or not.

But after some discussions and suggestions from the community we decided
to drop that flag argument and auto detect on whether rte_malloc APIs are
ready to be used and thereafter make all further allocations via rte_malloc=
.
Currently alarm subsystem (or any driver doing allocation in constructor) g=
ets
interrupt instance allocated using glibc malloc that too because rte_malloc=
*
is not ready by rte_eal_alarm_init(), while all further consumers gets inst=
ance
allocated via rte_malloc.
 I think this should not cause any issue in primary/secondary model as all =
interrupt
instance pointer will be shared. Infact to avoid any surprises of primary/s=
econdary
not working we thought of making all allocations via rte_malloc.=20

David, Thomas, Dmitry, please add if I missed anything.

Can we please conclude on this series APIs as API freeze deadline (rc1) is =
very near.

Thanks
Harman