From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 01BE2A04B1; Thu, 24 Sep 2020 03:42:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6377D1DCB5; Thu, 24 Sep 2020 03:42:54 +0200 (CEST) Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by dpdk.org (Postfix) with ESMTP id 42A1F1DCAF for ; Thu, 24 Sep 2020 03:42:51 +0200 (CEST) Received: from HKMAIL104.nvidia.com (Not Verified[10.18.92.9]) by nat-hk.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 24 Sep 2020 09:42:50 +0800 Received: from HKMAIL104.nvidia.com (10.18.16.13) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 24 Sep 2020 01:42:42 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.170) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 24 Sep 2020 01:42:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKVnginqWDlr+YwWiLAr04MUS+W+6CylQcqWbuzu1uXCi02E3dfZsMQ5xk4XVeOT5vrzlixaBDMVy6JP1m0NPy1dYWPYN8jhURfq1laHeeMxFONkpg0Kebff19pIemjgIRAqh+iyg+6KMVjmWSOYW4dXw0Z706tkR/aOzCCaNwgueRiMRWvvH2fCwklIJJIlN6cuB2wkNYUsI1f1VL3FGuCn77fXj/ZMMgnJOnwnygOV3TGZUc2ttbQviEpm8cFRBmH/3MogJvJWzhyy4MENXiNO0R+qXgo6tbs9+u3odZOTB2YM6jF2F4A9OuBoEDJXOhTnwCnuKGnteMEJIMUPGA== 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=kWtjEd1JDJz/n64X6RvB/C6GqIywhDLiYXBvN17UeRk=; b=Aq/xt12Fckr/Y30kwm8JvBTHvBCuuxKQlgNd/JojzVXYSYiZ7Dohm+Ie25JgljtKgTRzd9x8o5e9Iur05Y5+PSDvZGxU4diL7fKLkgBZYf8KHr3ibanslHZdRvsEwvkkL4wUFSLM6u3m/lYyWiVeuxH0z5tXd8gWfpgV8p3pZzXwfdXiHwIPc1HH/GsBeZYzmD7dxzQd7aPoNNLvkzKmuDLtaQ/6rxpCCGZ/pQlfKRGSIgdW57aJLZ62GlMTnfNbdvBw/O6yG25mf1N+9Ht9N8fm61E1BFOBQRV+0yaKP5I0I842TkmCf6tG5sQkxlhTlKut5yzIWiWqmtRyXTkeQw== 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 Received: from MN2PR12MB3550.namprd12.prod.outlook.com (2603:10b6:208:108::22) by MN2PR12MB3230.namprd12.prod.outlook.com (2603:10b6:208:108::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14; Thu, 24 Sep 2020 01:42:38 +0000 Received: from MN2PR12MB3550.namprd12.prod.outlook.com ([fe80::b514:9492:7a05:75bf]) by MN2PR12MB3550.namprd12.prod.outlook.com ([fe80::b514:9492:7a05:75bf%4]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 01:42:37 +0000 From: Suanming Mou To: Stephen Hemminger , "NBU-Contact-Thomas Monjalon" CC: Ori Kam , Matan Azrad , "Shahaf Shuler" , Viacheslav Ovsiienko , Ferruh Yigit , "Andrew Rybchenko" , "dev@dpdk.org" , "joyce.kong@arm.com" , "phil.yang@arm.com" , "steve.capper@arm.com" , "honnappa.nagarahalli@arm.com" Thread-Topic: [dpdk-dev] [RFC] ethdev: make rte flow API thread safe Thread-Index: AQHWghj/PKRqPjtRmE+dlUFVZ4B+AalcdyOQgAJj6gCAAANJgIAAEHYAgACeeNCAF5MYEA== Date: Thu, 24 Sep 2020 01:42:37 +0000 Message-ID: References: <1599108782-230624-1-git-send-email-suanmingm@nvidia.com> <20200908075208.048bfa02@hermes.lan> <3402903.UWDKPdykxe@thomas> <20200908090248.7a78888a@hermes.lan> In-Reply-To: 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.176.163.47] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2573fcbf-6e69-4681-6e07-08d8602b1e13 x-ms-traffictypediagnostic: MN2PR12MB3230: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: c88SXC+80h1jGDlYWtvYRo//t9pAY/UPPXX9yfnSaKn99oLuZIi7BE3/wygj8A6T/G6+KgYxfXY7VKmIEFPb9RUOTZuO6xyirfwhqJQbyjvTlwnYaF9b9zkR1jjiF+3H4b1gzVzGOIADDMWneg60UIk2yE666/5QGUL4UmwbO8qMEgMKscSHgPYhPwEIpollCeat4k4FWbcl/2o2yDxy4kgTYMCXdCRHxZOUmdqKXnONm4ii6upKa63bvp0bs/hcKgH5yZGx0F4UUnFjMteYvQjEtwy7V+8qkWNEPO4NXtngHhcw5LhOukuz0nJ1egkiQ+dgEs7YP+WfJqdfLfIBUkOPl1UcMMbd4lW/1XzSCLvIRkNdUZvsQUOBtJIW6HWd x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR12MB3550.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(136003)(376002)(346002)(39860400002)(316002)(2906002)(33656002)(53546011)(76116006)(71200400001)(55016002)(478600001)(7696005)(4326008)(26005)(186003)(8676002)(6506007)(66946007)(8936002)(9686003)(110136005)(66476007)(5660300002)(83380400001)(66446008)(86362001)(66556008)(64756008)(54906003)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: PeNUM6mVBOo3CLx+zRdKD184Q5HT2J7xOkVpBZB9fjc90WVnT0/8xcaaTwc9VIMnKSjzzdlUBDwDTnrRqXXFEy0uDB3SDOYXU6AJq+rmrM0ZlmE4wRFVX6DD3soGa7WiqjmLzPkLprgS1vivTDCFeXSnjIFomIp/O0lVyglmzgoDh55d63QjXp+8O/4CTOJau1oxd8VpHIGTQpO9BurD0Cg8qkqOp486KMbv0PUNIeHGY1vN8G+oSZptlTVcIo3xOAg+9mD97kK5X9Z40LR+6DB2vcq+OUL12qggneo5aYhTz4WLWHX1d6ZF/EiB4yoor++1wlXGja0mwTWN7So2eiowFefOGg8A+RDMAItNeg2HUUVq8pc/Bod3pPgAOgymiHZq/0sXgN/Wiw4K4hF0H0BJGjAlZHAsEsK2s36SetKjBfkUzeaPsqiopTHW7XELvkaWxCXy5UIByMUtGAwtbojbqhvmFqUZFXB0ozwezOgvJEEFYEX/r8QFXugEPL47glh2uH5JkUzgsCxl2lY4tBqU2wvTYIPaoFNqSCDNVhS3gNLwolleA4l61nwi9dg+yAGfNAm0Hr6SF+vOavowT6skgd2B8X2ijo1hfzIPx9Y3wakH2WKfuPvDRmMXvUJUOw6NUJ9ASOjydCTgwjSQnw== 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: MN2PR12MB3550.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2573fcbf-6e69-4681-6e07-08d8602b1e13 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2020 01:42:37.5056 (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: 1Sp9VlIoRyxobAfkX9MF2MYMahLvTaNim9FK38EK2W6NyXzviuVF4kjOhLN7lKzkKlMVJCbd8CmQQ+Bk6bwiiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3230 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600911770; bh=kWtjEd1JDJz/n64X6RvB/C6GqIywhDLiYXBvN17UeRk=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ld-processed: x-microsoft-antispam-prvs:x-ms-exchange-transport-forked: x-ms-oob-tlc-oobclassifiers:x-ms-exchange-senderadcheck: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report:x-ms-exchange-antispam-messagedata: Content-Type:Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=f7iF6DDhrq9R/d2n9rZIbgC22Y5VRYOTRcE2bs81Tz3vmJdmMu9ZZg5p2W95Yt1FJ nAemxJhn54GRKw6m++YXJdlWAOZmQnY8NGWY8UHdzfYtkdZmtyicvuobcXMj0Yp+6x vopijb060CBaD8bBSrqJH6i1lrPLnmc4fwahmV/v21xiPLlPShuu4h8AXcXF+Qk0gJ M0Ccxvo6AZnSRzBm6VW3R/s34oec9j4EvdsK/cZBs1oBcr01sGtl1lbKV+/TpVTRSx idCQprMULY1I2pBJnvp8yfGcbVljMcTG11BXIlw6DYEWSCHk8XZ78j9EbuHnAu0fMc VEjziQuWUPZKQ== Subject: Re: [dpdk-dev] [RFC] ethdev: make rte flow API thread safe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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, > -----Original Message----- > From: Suanming Mou > Sent: Wednesday, September 9, 2020 10:26 AM > To: Stephen Hemminger ; NBU-Contact- > Thomas Monjalon > Cc: Ori Kam ; Matan Azrad ; > Shahaf Shuler ; Viacheslav Ovsiienko > ; Ferruh Yigit ; Andrew > Rybchenko ; dev@dpdk.org; > joyce.kong@arm.com; phil.yang@arm.com; steve.capper@arm.com; > honnappa.nagarahalli@arm.com > Subject: RE: [dpdk-dev] [RFC] ethdev: make rte flow API thread safe >=20 > > Would it be possible to push the choice of mutual exclusion down to > > the device driver? For fast HW devices they could use spinlock and for > > slow SW devices it would be pthread. >=20 > That's a good hint. But that will also introduce the vendor PMD to update= . I tried > to list some points here. > 1. For single thread case, pthread mutex acts similar as spinlock, spinlo= ck or > pthread mutex will not make difference here. > 2. For multiple threads lock contention, spinlock will introduce more CPU= usage. > DPDK applications currently use mutex later get rid of the outer mutex wi= ll suffer > higher CPU usage with the spinlock(fast hardware PMD). >=20 > And one more general question, can we find some DPDK applications now use > spinlock with the rte flow APIs? Since there's no other suggestions regarding lock chosen, maybe we can keep= the default mutex lock in rte flow functions. For the fast HW devices case as Stephen wrote, these fast HW device PMDs ca= n set the RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, and add the spinlock in t= he PMD to replace the mutex lock in rte flow functions. Similarly, if some PMDs prefer other types of lock, just set the RTE_ETH_DE= V_FLOW_OPS_THREAD_SAFE flag, and add the needed type of lock to PMD intern= al. The default mutex lock in rte flow functions will be replaced easily. How do you feel like this? Thanks, SuanmingMou