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 AB88BA04B1; Fri, 1 May 2020 19:51:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0470A1DA43; Fri, 1 May 2020 19:51:48 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 5EC921DA1E; Fri, 1 May 2020 19:51:45 +0200 (CEST) IronPort-SDR: Op9lteaDQiX1/QttY9DMbPsfzSQTP+oCprQGTfnRKzlAYyDv7pft6S/rJyd3S6U3xqBtxkygAO HPVG0K3M8EMg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 10:51:44 -0700 IronPort-SDR: eQW3eaIgy7RrTIiBOCkdwSwEyAN6R8jz3JKEW1rXaf3VNIgvCvJLZenAVhgHtR+4q3pa5A3Wvf 0dZngWbVy3Tg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,340,1583222400"; d="scan'208";a="337674460" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by orsmga001.jf.intel.com with ESMTP; 01 May 2020 10:51:44 -0700 Received: from orsmsx161.amr.corp.intel.com (10.22.240.84) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 1 May 2020 10:51:43 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX161.amr.corp.intel.com (10.22.240.84) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 1 May 2020 10:51:43 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 1 May 2020 10:51:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XTyG+DqiLHMvg+9RcA7zv6OxBKlAjt03emmvr1lha/R4ZzjSc8Sxu0Ufw9AeGYb7xm8DjRmv5iECTpOfxwX2NfikJEEB8aQkHGyy+3K3dQxFVZnyVlMXeFSM9tiRbEka17jy9KQfnCJztZXPYotYrvxbRYvLJL6b8pbouj/cCVR9WsayQoFR7OupmkrBhiFrey92B7dXq+s5klKAfV4givE6svgz+am+D2ZuX5+wUs0T3Lg2cey2ui7MQMkuGJs76ztX0pTM3UAjqRBFgsCIgkIKhWFjgssU2fPO+8A2mxOykc6ilTKymOq6a17fgmRs6zK6IMrba+IL8sqkJ+x8ZQ== 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=F/4wVbF8+Nq3AzCfSSHCbIxABnJVeoiB6l33xCo8WkQ=; b=UPhsQ7Dd+L4EL5lNmnZUTzmX7iO05P/Lh9HoktvP3jSaSq19IFdvOuO0qT1D2dkGD6I2ubk6mbWd9PTTvTgzCpkssVXYxAfDmgR8lAnUjFNN7hAUnWUPcg3u1Btf1vo9zl2WEQ5oLK1pBJfKRm4WIcel+as0QVaAVCORmbTQknkyafTjv1DbT5VJXFFdfj1vPlTY7QEqsRm4mvYems3btAh8SkXrXHZMmb2nrdvskBe/cLUjyIUduCtFKtR/o0NL3XF2SxuJjtpEhhMlT3yiR0DZJLO2rLJJLnwrLO+MSGyfCNP/WCY3I/+3SiAFTsNvF6sw2hOM+33NBA32IfBnnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F/4wVbF8+Nq3AzCfSSHCbIxABnJVeoiB6l33xCo8WkQ=; b=NDyrRAsqeE3AZCYty09IbGFykqMH2q30/ssEzZPRHS7hnWR5nneVfEX11Q0gRyu+F/dreC96swscqihoTPeyZVg2eRmy3EkUyj0rneStVl3WxmKAepoyLzzoiAnez2RonnmvP4G+KQC7/IhSbzZfDqCo98A0Jr5QCfqLBYJcC/g= Received: from BYAPR11MB3143.namprd11.prod.outlook.com (2603:10b6:a03:92::32) by BYAPR11MB2855.namprd11.prod.outlook.com (2603:10b6:a02:ca::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.21; Fri, 1 May 2020 17:51:42 +0000 Received: from BYAPR11MB3143.namprd11.prod.outlook.com ([fe80::5917:9757:49b0:3c49]) by BYAPR11MB3143.namprd11.prod.outlook.com ([fe80::5917:9757:49b0:3c49%5]) with mapi id 15.20.2937.023; Fri, 1 May 2020 17:51:42 +0000 From: "Van Haaren, Harry" To: Honnappa Nagarahalli , Phil Yang , "dev@dpdk.org" CC: "thomas@monjalon.net" , "david.marchand@redhat.com" , "Ananyev, Konstantin" , "jerinj@marvell.com" , "hemant.agrawal@nxp.com" , Gavin Hu , nd , "stable@dpdk.org" , "Eads, Gage" , "Richardson, Bruce" , nd , nd Thread-Topic: [PATCH v2 1/6] service: fix race condition for MT unsafe service Thread-Index: AQHWGYzR0pQ9nE/SWEGnc1eZ3IqbiqiQVgOQgABnoYCAApK+kIAADdMAgAAwF+A= Date: Fri, 1 May 2020 17:51:42 +0000 Message-ID: References: <1584407863-774-8-git-send-email-phil.yang@arm.com> <1587659482-27133-1-git-send-email-phil.yang@arm.com> <1587659482-27133-2-git-send-email-phil.yang@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.151.170] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8128ebde-1e4c-432a-978c-08d7edf84e91 x-ms-traffictypediagnostic: BYAPR11MB2855: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0390DB4BDA x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0WVVA7mjinJ+vtXdb/v754wvoVgy6OFEcYbVuDg/jT6N6PQR/b7y6zvVQberN6faELH0UDtBaecuW+UsPS6l5rsTk3gu0MLoYi6G07HwZOqoRD5BceGhAynNEVpUsdUEvXsONpj5cdeJXjlh03JXuxv4GR51u6pXUwnUWJaZyypCyLMC0Ar0JLAF6BINFn5rlw+88ziUXFgmurScX58t8+gnShTbDpVexodisCJ0Oogsj9rHD1zGEz132gQQ+RQT9fZ06mdxsc0kcycJqxjo4PyiBQgLKcsx/RyvqFxLYG/7YQ4J2vS6SzV24702t86FAjiHLNQmAtGPuB43ELdjKS8czAQY+0rAX7gzy1zumeUvpnWiy4iZUEHqZaZGgHHYXvtuyUkAugBXoPfDlysgu+G16aDtUfQfpG4Qwv6PB7A1cL3kacGKp5jgV0TzTm/eixDGNSWcSh6/RQpNx7Xki2Y/37tEflQFix4xkv1uWP8EmcHivM86dLZFXj9ySiSAj6dZU+wHmUNa5MGyEkWAwQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3143.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(346002)(39860400002)(136003)(366004)(478600001)(86362001)(52536014)(966005)(33656002)(54906003)(7416002)(5660300002)(316002)(55016002)(4326008)(9686003)(110136005)(71200400001)(66476007)(76116006)(66556008)(64756008)(66446008)(66946007)(2906002)(186003)(8676002)(7696005)(8936002)(6506007)(53546011)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: OX0UXvX3q+zXvBYazRtve4yC6NSRJZSNTUqoFlb1vjxw+qAsJrsziHcvOKXCjgnBhd0H/UhIUEqy4394OogeOlQ9T/qNWvViCPecA1rJPbjmYpmXNn/M8pp3/NE8TvcE20zI3bHZDnXXayfBhciVDkYQvjBq9q1LVrj19dC+IgZIYTE3mZb/F6Dbcl5GPEwnxy1RCEpt6/f54jkZ3a0Nkwvw881POVknj+muEHUd3NMwJ1zoPwy0ANKdBHp67vAOsXN29MNpO0NF11MZiSVQfwTUMDtgAGnkQIEiDy4gcG93xNo5t+Y/Tkl0t+XRaSGri6sRMsEb8R0GrZYsnNtOfZUD2JcUnHZ8y6o1oo299ZkPL7bdZXcihRx/Q0XwircKHwHbMkBEKNqq5ruVzCrgRwfQOLIgvek+pbSaaM/esAZh3ExorVUmIvH2+NUb6iuZCPBkssR6KUaDF1FOM+s+X2aYZGezGZvpm2zcaPMV2PgL9e0FXSY6fY4iNVx3QSLnn+MJZJmrcdSuj2GSSol6W7XLQTe5wrWeLOJBuvy3gM6b7BVgXupjayY3I5WGS+KG7srBfPp8EA7i+bCFsGJelxxzlCeJyqGBErgo+rfdgkimUcgKcLdFFGtdsh4dN99e2+7NrZRVUc0Na5rA1d6zztvkk6lpBEhIF5gu5u1rercGRSwmvUi9IWBMT/JheLqW+qd0FxtNv41/gGtwbExu8vRlUfFb3agzTAZaBm+6ovq8hyhENsYjemnbDGs0zC4Rcm41tPh4FDaLLX7X5IR8FBLw/O7eWhbbwvwcpSGFwoJqTiEwn2p9F2eBCpVf3s0B Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8128ebde-1e4c-432a-978c-08d7edf84e91 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 May 2020 17:51:42.1061 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AW2UJaYa/ZYhmQezgxQt6mAopk6c1PgnEZ2SYrJxP+IqTZb4CcWZ9g9tWhhemhTUjdK524AiAuMOdZXjNsp8K0mk8ApUbzwpxCIf826SFPk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2855 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 1/6] service: fix race condition for MT unsafe service 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: Honnappa Nagarahalli > Sent: Friday, May 1, 2020 3:56 PM > To: Van Haaren, Harry ; Phil Yang > ; dev@dpdk.org > Cc: thomas@monjalon.net; david.marchand@redhat.com; Ananyev, Konstantin > ; jerinj@marvell.com; > hemant.agrawal@nxp.com; Gavin Hu ; nd > ; stable@dpdk.org; Eads, Gage ; > Richardson, Bruce ; nd ; > Honnappa Nagarahalli ; nd > Subject: RE: [PATCH v2 1/6] service: fix race condition for MT unsafe ser= vice >=20 > > > > > > > > > Subject: [PATCH v2 1/6] service: fix race condition for MT unsafe > > > > > service > > > > > > > > > > From: Honnappa Nagarahalli > > > > > > > > > > The MT unsafe service might get configured to run on another core > > > > > while the service is running currently. This might result in the > > > > > MT unsafe service running on multiple cores simultaneously. Use > > > > > 'execute_lock' always when the service is MT unsafe. > > > > > > > > > > Fixes: e9139a32f6e8 ("service: add function to run on app lcore") > > > > > Cc: stable@dpdk.org > > > > > > > > > > Signed-off-by: Honnappa Nagarahalli > > > > > Reviewed-by: Phil Yang > > > > > --- > > > > > > > > Thanks for spinning a new revision - based on ML discussion > > > > previously, it seems like the "use service-run-count" to avoid this > > > > race would be a complex solution. > > > > > > > > Suggesting the following; > > > > 1) Take the approach as per this patch, to always take the atomic, > > > > fixing the race condition. > > > Ok > > > > I've micro-benchmarked this code change inside the service cores autote= st, > > and it introduces around 35 cycles of overhead per service call. This = is not > > ideal, but given it's a bugfix, and by far the simplest method to fix t= his race- > > condition. Having discussed and investigated multiple other solutions, = I > > believe this is the right solution. > > Thanks Honnappa and Phil for identifying and driving a solution. > You are welcome. Thank you for your timely responses. Perhaps not so timely after all ... I'll review C11 patches Tuesday morning= , it's a long weekend in Ireland! > > I suggest to post the benchmarking unit-test addition patch, and integr= ate > > that > > *before* the series under review here gets merged? This makes > > benchmarking of the "before bugfix" performance in future easier should= it be > > required. > I do not see any issues, would be happy to review. Thanks for volunteering, you're on CC when sent, for convenience: http://patches.dpdk.org/patch/69651/ > I think we still have time to catch up with RC2 (May 8th). Agree, merge into RC2 would be great. > You had also mentioned about calling out that, the control plane APIs are= not > MT safe. Should I add that to this patch? Yes, that'd be great. Cheers, -Harry