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 EDA1DA04B1; Wed, 9 Sep 2020 03:26:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F26D72BAB; Wed, 9 Sep 2020 03:26:53 +0200 (CEST) Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by dpdk.org (Postfix) with ESMTP id 68AC6255 for ; Wed, 9 Sep 2020 03:26:51 +0200 (CEST) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 08 Sep 2020 18:25:59 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 08 Sep 2020 18:26:50 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 08 Sep 2020 18:26:50 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 9 Sep 2020 01:26:48 +0000 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 9 Sep 2020 01:26:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IkII3rKRc6neMgc48DQoxVRmFFQuxjG7gwz4OzQSNOaQlfSVOX5Xh5st1DF7MRosprFZGpH7lPJHE+F62F4XJoiW+rgdhK/XQsmvT4i4ecuaJg8d2YqyY1H6xJKk22iPrN4mPDA1Ujn6TzxJ73fM+gWfOR4/crH+9H2ePUKr7HuP89ozdoVMH6ACYnf7M7hOzpfJ2uwnnQDfF3gZuWLRwaRsVaKjV3LascgJr2xfwe4JFggVxVr7RtK5ax6/7zQO0kK+5/3KQaArvM6CvnOy5AKJ8bDb7yu7jee3rYzUcpnkABStmPxeU4DmRyv8rzVk4508x+Q3k6Mh+sh6+lUZNg== 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=sx0rrLnxxleX4lMWMbWL5+RRQ4SbAIDZgVtJAvzpPV8=; b=YmdPJET0Lnn1PKe+05GtLDLGvv5J2XFjUxBkXPj9lhefZtNtUPH0SOEhuG5Z9EwiF/8x2jCWH7EmG48wnD7JpMoAuvGsXj9McZU1CUW+rht9ZGvebXz8HZS+Ggwir36zF3epbEJtSIuBmSMEk44AnqS8ncjjHa3VqiPeX3x4HB0t7K6y9lZQtcPm+D4PLHts7GYV69XjVWcVjKsO69TBh8IOtNBPPG5JJ9nHmTK/Ui8aKvIYDxlKTDMZkVUtU4cVEZXCoK20OFT2ZFNT1W222aQmjJG6uhANukq1/qo3geKpFbrBH1AFs6BiZNIdkJm/e+ufeSGCpUMayRk6OMIJ6Q== 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 MN2PR12MB3277.namprd12.prod.outlook.com (2603:10b6:208:103::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Wed, 9 Sep 2020 01:26:47 +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.3348.019; Wed, 9 Sep 2020 01:26:47 +0000 From: Suanming Mou To: Stephen Hemminger CC: Ori Kam , John McNamara , Marko Kovacevic , Matan Azrad , Shahaf Shuler , "Viacheslav Ovsiienko" , NBU-Contact-Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [RFC] ethdev: make rte flow API thread safe Thread-Index: AQHWghj/PKRqPjtRmE+dlUFVZ4B+AalcdyOQgAJj6gCAAK/CQA== Date: Wed, 9 Sep 2020 01:26:47 +0000 Message-ID: References: <1599108782-230624-1-git-send-email-suanmingm@nvidia.com> <20200903103739.1d1b4b0e@hermes.lan> <20200908075208.048bfa02@hermes.lan> In-Reply-To: <20200908075208.048bfa02@hermes.lan> 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: ae4f48b3-111f-423e-9c6e-08d8545f6b59 x-ms-traffictypediagnostic: MN2PR12MB3277: 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: 3g7V6BqEwzviiQeFY6NVg6w4HJM82rIcF+koigE+CQEaS/8i1yvBapA8JaxhNdGPH0n0+BWLkcWebAC6s8yDmZ1NTy7pKm5fFB0lfDq1513MAvEDFAXguo0j/3mwTZFZtPLyLCGVWEk49MNTDdoxtUbh6VZAh+cnkx9ZBbp+2Jt6jhtDh+geR4R16WxRsAQITSCxfTFEs4XDAD3MBqyY4JC4RkcqFeWchXLsiHcPD7Ky1mhd0YoSUdS2PcF76vueDP/+38JxS8FWzk4TwmEukVJDZ9scyAY5wVJYLa7AjaD7MqO1svaOKhXkXfqhyCB7 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)(346002)(376002)(39860400002)(136003)(366004)(396003)(66446008)(8936002)(55016002)(8676002)(6916009)(33656002)(52536014)(54906003)(9686003)(66556008)(66946007)(66476007)(64756008)(71200400001)(316002)(478600001)(186003)(7696005)(4326008)(6506007)(83380400001)(5660300002)(2906002)(86362001)(76116006)(26005)(53546011); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: b8R5Ze+RpkWeUk6nrnOAxWyBldb/umjOK/57s7i7/HdljAMw3LhdoyGAV1dD5Mv0juNyR2LwOteRCPRN5Brm3BgTHNwLFN71bRaskX5XmP7otJCTnpH1fmWMnHQtUUrjtf8AvCMd8Ts+W+w0b1RFa7P5aFaYNVmLaCVtnMjd1Y2JbRD9pB2X9GeKAIi+lJhPseseqk8Uu9n+8yfmNlxBZrG4RRXGLa+gyqhn6of9xCZBczQfP0HJv5xQV18RQD4BHbLKPZX/oPP7ru1P2uHjVumlK9oV+MFHvBLeamiUtQyNvf9Hemr/323A3u5SnN9atbdT9/vUWB6wXBLGfXbDQ4yrBWdoOKv/rjxSLjpbgX8854B9Joy7Bgv2TSoR/u51iX9lcj0PWEYUtsYKcIUbmiAG0MzkIlikql3qMua2FiNFjDwvg51AEaD2Ior/QJqtZqQHuW1QXMOiLB1qwiAHoi74Kyz5WtMwTYda9xVIfZl280iA5Ny2qzrR0ZBrzeX+YvIcYgRQ3v1QJz9CmVlFiFiHCCbFZLTAc5/dPUV2+6NkBiPBSpTHkjwa1WXhSzyp8FZxrTE6znRlZJkUJzcjNuVey+5LwKzQ8GIRBvR0mVBrOuGc3JKPKr+qsrwjJmqaE6Dz3wKl91eEZ6Ljm8zcPQ== 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: ae4f48b3-111f-423e-9c6e-08d8545f6b59 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Sep 2020 01:26:47.0617 (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: EUWdQTBf5SZAfVfBikZHevdfxwgCNjX1a8k/UKnBO+sqH1bsghl/njYjyUxAx3U7U3Z/GTKGjhZl3WcPrVTxYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3277 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1599614760; bh=sx0rrLnxxleX4lMWMbWL5+RRQ4SbAIDZgVtJAvzpPV8=; h=X-PGP-Universal: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=SW4AzXRkxn/Oxo8Fldpw9eJlAUdNZDD9+n/1laF4rMWjZ0bf1MY53q4n/ZGgjT1wN qEk3jrjImX1ROQM35SMV3bIye531p1rNHRezDWJsxAMHnqFEEtkHdYUENZ93EHPyIO xrDGxW8nBw4kpcGNlTQIZJ4JHTYdtcYjPnmc6y/z4xVQT88WZ4NdLp2aaYJo+J+k/1 Gh7zGPa5F5/T66EZhISmzgzth26+Az0SJo6rfuppItsLmsIpAUPTanqF1/4UpZOZU4 9bFslZogvMaAebsU3gmPzjymkqWrlnUooU9kanYZnRGvaUknECgoTiVK+YxSMIWJO7 kfH0MRy/3z39Q== 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" > -----Original Message----- > From: Stephen Hemminger > Sent: Tuesday, September 8, 2020 10:52 PM > To: Suanming Mou > Cc: Ori Kam ; John McNamara > ; Marko Kovacevic ; > Matan Azrad ; Shahaf Shuler ; > Viacheslav Ovsiienko ; NBU-Contact-Thomas > Monjalon ; Ferruh Yigit ; > Andrew Rybchenko ; dev@dpdk.org > Subject: Re: [dpdk-dev] [RFC] ethdev: make rte flow API thread safe >=20 > On Mon, 7 Sep 2020 02:36:48 +0000 > Suanming Mou wrote: >=20 > > Hi, > > > > Sorry for my late reply due to the vacation. > > > > > What is the performance impact of this for currently working > > > applications that use a single thread to program flow rules. You > > > are adding a couple of system calls to what was formerly a totally us= ermode > operation. > > >=20 > Read the source for glibc and see what pthread_mutex does Yes, the pthread mutex lock will try CAS(Compare And Swap) with the atomic = value first, if not success, have the futex syscall. So it means in single thread case, no syscall will be introduced. And the t= esting code also shows pthread mutex have similar cycles with spin_lock. >=20 > > If I understand correctly, in the non-contended single thread case, pth= read > mutex lock should not go to the kernel space. > > I also wrote a small application with pthread mutex, and strace shows n= o > system call was introduced. > > > > Another simple testing code below is to check the cycles cost differenc= e in > every round between pthread mutex and spin_lock. > > >=20 > Micro benchmarks of locking is hard to see.