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 A4F2EA054F; Wed, 17 Mar 2021 00:49:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F19040689; Wed, 17 Mar 2021 00:49:00 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2065.outbound.protection.outlook.com [40.107.236.65]) by mails.dpdk.org (Postfix) with ESMTP id 40BF340040 for ; Wed, 17 Mar 2021 00:48:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XtIY/3KVpIcRXKgcnERqcGGjW5N2L3XtacW8o5bIiiqp034CJW7YLAiaAH/mI/n3EwtUWVWVbs7AQ0lsOtUAPob6iQ+nAhYY3L2m1Pi8Kpe+BeS1fQYTiYbY44wzkzgzUTImpOJWvpyvAOKMAoaoetLEy4ss4Cerd6K+1bQj4rrLPBdERIVk0vkGMyQIvl2owirt1a/iWaCFYuhXC2Bh5wSmHq4To0Cq8cHSmTErzDZzaxHd6Ha1TNf/wxpvlokkAucqr9AVrkCsD59inntjQIOGol2B4zGyoLv90qK6vAFXynOZyJa4/anloetjVaNZm/nnwf9M9z7IzUZGw/lY9A== 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=mx+dRxus7EYkWlnjGWzjILX2UUPByiPEmUjV8EVhJ4A=; b=Qe8S23rl5OKh6OP9kwQpXohPqjwog+raTEDMlbceP+JkpR0G106NTlWSpC8g6XsQYtrNTTSg1E8lQzxMURAhN36K5rWf/+3Ftw8VwxKTLK0CH3bTA0knhl+ccjlCrBphEHl8zr6mpx9j0uv/26qPapCVe4Yu85K6B09ukybfzhuoT1sV+STBzHenan2/mT5AhzcQSJ4IUYkEFSBmKOFGlL+8gxfXFHrbvJHcj1SMXIEa+0Me6EhbpB4ZwvA1Cb9IZYB/gf7YpaF1fGMFdc82eAmNTqiJR2LCojXVz9iJHGaQNLMbc77KhicemD/hsthwwz1GKK2XCHp/KgHGGtIHVQ== 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=mx+dRxus7EYkWlnjGWzjILX2UUPByiPEmUjV8EVhJ4A=; b=I4rb2CEw/Q1GH7Ma7xxrHc1KNYtsRMpTmTKoN2fBp7ZUDOBpzox3IwG6YqDV0lAsl84yLI/C/sTv4F5H+cuvokDb0JPowyo8DapP9OZHJzIu7btwcSLI8tHXF3YST6C6yhHkZ7Z7PLA+MmuhHFuq2pC6Ism4QPO9LJsEQmELspPzqzQnsJRhu9UVl6PAByxjn5l/vkKgt8xTLXqyWRpIl14MTXJLxSab0MiHIb6aCzW82CeNpUn1/40bE+NFP4ml3eQ+xRIQH9LQeEhBkZARhf7RZ14zvXx3NOxoLCF5OdeeKhQIf2/a6T2dciZDl2JyO6GF+JxR7CYb53m+DrTeTA== Received: from BL0PR12MB2577.namprd12.prod.outlook.com (2603:10b6:207:42::20) by MN2PR12MB4535.namprd12.prod.outlook.com (2603:10b6:208:267::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Tue, 16 Mar 2021 23:48:57 +0000 Received: from BL0PR12MB2577.namprd12.prod.outlook.com ([fe80::3c43:105f:fc60:7786]) by BL0PR12MB2577.namprd12.prod.outlook.com ([fe80::3c43:105f:fc60:7786%6]) with mapi id 15.20.3933.032; Tue, 16 Mar 2021 23:48:57 +0000 From: Suanming Mou To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [PATCH 1/2] ethdev: make flow API primary/secondary process safe Thread-Index: AQHXGdFADj5ZuD6t+k2uF7tFjJdtR6qHRsYQ Date: Tue, 16 Mar 2021 23:48:57 +0000 Message-ID: References: <20210315192722.35490-1-stephen@networkplumber.org> <20210315192722.35490-2-stephen@networkplumber.org> In-Reply-To: <20210315192722.35490-2-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [60.190.230.234] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 02bb6c3a-4604-4b0b-a600-08d8e8d61094 x-ms-traffictypediagnostic: MN2PR12MB4535: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:159; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TCjGcYdAkDlgqrKMJ0/wYUXqUZysD6nvxdPUns6GqgeIbnr8IhOwejIzxGwWc86w2FPCI4rlBVkiq+zXqZ2EXQSzf6uMbCTcHb3879BG8PuDDHYRlojMrP3i0j6xKOwGd36KW9WOMXF3eGuG9zSlr/yFp3ZPMhqzPetQOHj95XcC3hFfEQmGXhGc2Qlc+bHWxmcOdo1NHvOrWgmODcpWr1sWnRnStcMBoAkDIrZlFy51GqMRumP9cd05d8iqA9dETcRfLITU5z5C2czV1e05lBaTLkPP6QVtVcho+S1r1TlWzu8DTbEhZkbpC4coyQWVmFOKf9p5o+9HSk+UdtH7pvf1Ry26HINoeahkoEbAB+hWsWKt/qsD4z5GRKRxI+AyDbiuafbmbMwaN/i9hnAbn9aCKCIz60jnu6BYZdGNvi0LysxOmDNTdrvXiU/X0k3fou7dEMBoC+umHQF0USDUwt9Y9M01Ym9PywT2ETKK5lWA7GKVir+TcUC1A+boUWp5SKIpN0Yy2InE1cGEvU2UjHG8C8uvbWxu1QqoU06+SKvQLERTFwrGymofmg5REMAI x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR12MB2577.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(83380400001)(64756008)(186003)(55016002)(66556008)(76116006)(66446008)(8936002)(53546011)(66476007)(33656002)(86362001)(478600001)(5660300002)(2906002)(316002)(110136005)(26005)(71200400001)(52536014)(7696005)(9686003)(8676002)(6506007)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?8ugGtZ2vIgEyCHJFixTyK23ywpB4vu7DXwZnnOgo87R6DIYF7V4jVT4xisxA?= =?us-ascii?Q?CUn0ZDd6fwQagKqrvQDEnQ1utw3ekCoiQwZ15QZlX4Ud7Mtj4K7HBWUUDoa1?= =?us-ascii?Q?tDAmvdXrVqUVI868HaDWpN2DpVNuwmoG0paKrbolI8huC+2wFg1jIgHLR55l?= =?us-ascii?Q?ri2s+MMFPWy+rwHwluLSnfWPtMWLic+t7WZaB56BE4VAj48DCb35vlTp2bfc?= =?us-ascii?Q?cQw8Mo5l2u81wMHPZsdzQyobOj1P+aNk4YjFK8moKzbBew0Lb7j9GO1bo1qc?= =?us-ascii?Q?nGQe/88EPqU1UK5td9l9U7hjkNq5FsMwfvQJxti69zSWVX55sPAXiHLLUvqO?= =?us-ascii?Q?tIH/szvq425/Yk2OstEzBuei9psnalbuzCqQ3tOj7xGFRZVo60YPRlHUN2B8?= =?us-ascii?Q?rjD7SgwLFuQkrlb9ZebKwFZoNqA91hCidapyy5FcBVjWS6dMnBQzrr4TgHDk?= =?us-ascii?Q?Yi/MUYpPS5L9mifEE51wiEBIqOSd8ZwoduZVwhDa7OifDyTwuJ/hCec1daoA?= =?us-ascii?Q?DsLtrVcrcnZ6IYVLDHwIk8N5Is4uoDFeNDP7hqU/R2daFetht3RCqcsYa0Zd?= =?us-ascii?Q?pcmneadtqCr1mrAHbTUeDTNBVk7h2XsGwU4z+f//Ol7d+p61VSLhff4AIk5i?= =?us-ascii?Q?shLgO4QZ1ZcZFQZa44ZrWGm+fnMro9zY13vxv/N13hgDfmyd6V5XmovQATPe?= =?us-ascii?Q?0jM8z63VHq/Jm9Huu1ZSGs19WsozpsfpOx4K83VX2/ZmgrAeclqFr5nNgrFA?= =?us-ascii?Q?UMAZpGsVmCvJ+cZsR3QgRtRk9hY4itGWjAj33chhTab8oMwNUuv7BUmOJJXG?= =?us-ascii?Q?u8vMO21iTS03R2hpKgCdXuvynBBptOWRkhG/SOXjx4TWKFNs/0C7xP0VNZHX?= =?us-ascii?Q?a2YCRvR7Qi3i0dF/ZhAdAuc+X0j6zuYgCFvrcQ2Y47RjX/QtS0Z0IT2j1m8Q?= =?us-ascii?Q?KCLkr8sQ1mYvbpUmMWebzLgE3PiMMK67/HlENKrfJJ2JXdJmPPo9DHLQQbfu?= =?us-ascii?Q?IGZQJIsCqsYs+lCktkuuNb3LfXLO4hUikbvKB5M17fcIxuhQvNDw259+iONU?= =?us-ascii?Q?QTUJzA6wtKsO0i2vSMDDzG8PvXIyGWj7Tz9byJaEDmXn0LWCiibG5M57hlWP?= =?us-ascii?Q?u4cfeB8bdGKgvZm/fHvBgenm3p7BOmd3GD+ElRGT9+XWUdVOe9SwrzFB91Gt?= =?us-ascii?Q?wnx9GLuJlf4DQxS0Z5O1FIiTNm27gp5SJZz+tUbwNyN7xXCaAPLZIaJEq9dx?= =?us-ascii?Q?CHhKRBoBpcHZdLf58XHg5TOL0BVetDUmsx7vlJwG9vjH2GnQRxFBqIqvmRjr?= =?us-ascii?Q?o5tD8pHMKdQQIQ1g4Ufwm0V1?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB2577.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02bb6c3a-4604-4b0b-a600-08d8e8d61094 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2021 23:48:57.0608 (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: ySJPaqqcI13Rm0KUBl+ukPd4dfi6ju/GsOltRKxn0QwfRzkX08WwPpGroZTcVpWLPz3WW0IRAcjkNtEkPe9y4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4535 Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: make flow API primary/secondary process safe 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" Hi Stephen, > -----Original Message----- > From: Stephen Hemminger > Sent: Tuesday, March 16, 2021 3:27 AM > To: dev@dpdk.org > Cc: Stephen Hemminger ; Suanming Mou > > Subject: [PATCH 1/2] ethdev: make flow API primary/secondary process safe >=20 > Posix mutex are not by default safe for protecting for usage from multipl= e > processes. The flow ops mutex could be used by both primary and secondary > processes. Process safe is something more widely scope. I assume it should be another = feature but not a bugfix for thread-safe? And the fag RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE we have added is just thread s= afe. >=20 > Bugzilla ID: 662 > Signed-off-by: Stephen Hemminger > Fixes: 80d1a9aff7f6 ("ethdev: make flow API thread safe") > Cc: suanmingm@nvidia.com > --- > lib/librte_ethdev/rte_ethdev.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c index > 6f514c388b4e..d1024df408a5 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -470,6 +470,7 @@ rte_eth_dev_allocate(const char *name) { > uint16_t port_id; > struct rte_eth_dev *eth_dev =3D NULL; > + pthread_mutexattr_t attr; > size_t name_len; >=20 > name_len =3D strnlen(name, RTE_ETH_NAME_MAX_LEN); @@ -506,7 > +507,10 @@ rte_eth_dev_allocate(const char *name) > strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name)); > eth_dev->data->port_id =3D port_id; > eth_dev->data->mtu =3D RTE_ETHER_MTU; > - pthread_mutex_init(ð_dev->data->flow_ops_mutex, NULL); > + > + pthread_mutexattr_init(&attr); > + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); >=20 > + pthread_mutex_init(ð_dev->data->flow_ops_mutex, &attr); >=20 > unlock: > rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); > -- > 2.30.2