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 6A6B0A04B8; Tue, 5 May 2020 16:48:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 444601D5E3; Tue, 5 May 2020 16:48:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3838F1D5CD; Tue, 5 May 2020 16:48:37 +0200 (CEST) IronPort-SDR: OXQiJdTkg0IoWd6Ghif3DsV1QUEXPo416CcWm7Ci/RwpLjkLzX9XGO1+VEECVqFE1Q5oj+Uaw5 zyM1CTP+1+kg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2020 07:48:35 -0700 IronPort-SDR: gywde62gqQrSqgsT++7YPCKAA4OeudG2T9gA/kW73TDOQF0hLvnowOFe/nGnkZzy2rJRCSxxs2 Sl2RuGT7Aw8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,355,1583222400"; d="scan'208";a="461065412" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 05 May 2020 07:48:35 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 5 May 2020 07:48:35 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 5 May 2020 07:48:34 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 5 May 2020 07:48:34 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 5 May 2020 07:48:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LmCv0PVx41EmysGiFDLdNdlZVhRCqq97DaBMla3vQyQDiKy/yNpq7s74XDzlHgCEEmM2REHsiZjDtEw172EnKvBGWPd/yS6zqDFdsndf9qELeITPkOXrwcNpLusUZ1L40JNhAGpmvvp56PciLf25IqVukWWu2LvkZgtKIFre1fG96gW+jdXpb5+5NKfISFSc0rUJlNxhqkQ1VfuvgSPHU1QDiEktUIDaPIvxSpr4FEE9Yt2kjxUfEv1j1NO2bpURKlcAJ8/O6CZWU4PhqvZfJLuXQK0TCQRZZkJ/I9z20V6MA/10wdAgsoSNGZsZTIihQaTELulUAwlGd+xevEhi4g== 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=l4yYHDyrBL/iQ3v/ziTrtFVh5JIq6Fq4TGuQQ7uRbHA=; b=PwUY86yXh1Pnh0sixvXTAXAurUpTqRRM2QjfPmfK+mdHh0pcuMOkNiSuyhhsaXRH1IV0xB+jIY/sP+KdarEgKodKWD4rFt3z7aPaFH3DLDhUfqVZyOkP4d9e23YWCSGAdAq3k/ZcKTIbao8qq+wKnyFfcZXJS2WgiM5pczmkkULrqAKq07ELrBPTXVQoWzd2f54mZmXrL/TDLo6znPrpZTvfNb6aV7y7W87QI8vuFnAMqJoapHqIJdkBZwaXMf+cuA93B7tcvT5N0TGITqPwgrPraVX1qzI5BrzFMkVwKWkagRpEezaep2l8jnpEwbFN167YVy3o2yZM0R4kGjUjEg== 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=l4yYHDyrBL/iQ3v/ziTrtFVh5JIq6Fq4TGuQQ7uRbHA=; b=pgV0EpOfV5TtFQA+12+ZjU1vFwplOrhZMxYpIRds3FWK6Zv9vUeUf8GBcqvy06I1yuyXSxMLEjDZNivDzpvy83BHY/pualoX/isLI5KFn1JjQeGReMGff4Zbnn6cOO4yAI/Y/HsNivx5gXtelgnthetV0KlclFDS78xyZx38Ie4= Received: from BYAPR11MB3143.namprd11.prod.outlook.com (2603:10b6:a03:92::32) by BYAPR11MB3432.namprd11.prod.outlook.com (2603:10b6:a03:8a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Tue, 5 May 2020 14:48:24 +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.2979.025; Tue, 5 May 2020 14:48:24 +0000 From: "Van Haaren, Harry" To: Honnappa Nagarahalli , "dev@dpdk.org" , "phil.yang@arm.com" CC: "thomas@monjalon.net" , "david.marchand@redhat.com" , "Ananyev, Konstantin" , "jerinj@marvell.com" , "hemant.agrawal@nxp.com" , "Eads, Gage" , "Richardson, Bruce" , "nd@arm.com" , "stable@dpdk.org" Thread-Topic: [PATCH v3 2/6] service: identify service running on another core correctly Thread-Index: AQHWIBUgo3aek+jr6UmicLBQc4Gc3KiZd9gw Date: Tue, 5 May 2020 14:48:24 +0000 Message-ID: References: <1587659482-27133-1-git-send-email-phil.yang@arm.com> <20200502000245.11071-1-honnappa.nagarahalli@arm.com> <20200502000245.11071-3-honnappa.nagarahalli@arm.com> In-Reply-To: <20200502000245.11071-3-honnappa.nagarahalli@arm.com> 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.162] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 434b20fd-39ff-4c92-33b7-08d7f1035d15 x-ms-traffictypediagnostic: BYAPR11MB3432: 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:568; x-forefront-prvs: 0394259C80 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hwKlGT5H7lmfyunmZGixr+bAlcVCf0G+QrIIiS6K1jaHo7cYAtDNXV/1PlTS2FKVzjsnEBtF3gt96mTAViPVVwEO6qKMx4aqtp1fQgcdMvO4SCyxOG+qqZL8JecEgIllUxipPhkKlMw07Ks/mW3gQLl0wy5DRMHZ6Rkr35DiZAOOpGK9nJ4whuC9frTWpgbk4J+rANsrk7QRuCD7J/RzVR/1EPVlEXZcLBOKJllJCOuv1tOP6V++gKCNf40OZCyVoaE/c4PsyhdM+JtmxraGxKLeIMEAfOOV9OtjFiVRMPkEBWYQIOqb0gmlbzILOrncYXKYeqrwaNCynzaxPPXfMZx55TZ5YwFYRIYsJG+QmyCf/iSgeL3Ncsfd+C083fMpz3kSVznHQkPqZIMQLVn+IJyKqre0Y4CBbOo1S66YGRUmbHE7JIHaMOvNeS7v+f9XFGUXR4HtuDBJuGUDasOjxa4xqRByOiovArPADZ32tcsHEASIRk0kiwCPOgY0QLnJrYxTAxcWtfh3Q3TotBcrKA== 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)(39860400002)(366004)(376002)(136003)(346002)(33430700001)(186003)(26005)(7696005)(55016002)(9686003)(53546011)(6506007)(86362001)(4326008)(33656002)(478600001)(8676002)(2906002)(76116006)(8936002)(33440700001)(71200400001)(66476007)(64756008)(66556008)(52536014)(66946007)(66446008)(5660300002)(54906003)(110136005)(316002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: ZZPk1JT5pHJTMC6hWtJFO2FMRTw/DRFNXSJP0i1NC8LqIe8I4IdkFyKCb3i1Qw5wlwMARvzYT6SCtdTsydLcRLWLzRACD6/eZu+eLrglhWlxmmWnXhLBKTsdp8mRnaEobqqkF5jbE14nUbrGQf4Yk7RDeHQrtfLjAY60lC3G65OI8Pkz8JA2Y3cR+AJ9KJgTJy/m5uJ5JGPElC8ShGH0ltVEux8keGSpib+vA2lggKp9de+a/bhYDUlFT5aCCks09MMAOK7q0CPqjS90XXG8PYP9E8/QZzDwJyZhh5snrJH+RcQu++NQLviZTQb/7yXof0uUAF09mWYCVLMD1oO7EwSsIaheLznyP/xFb8UuKmHMKwmAzfGtRH8/ke8DLfLeIsNSA/uV9FHcFxYxfi+H4rT9ps5eVgqo4KTA3swqxh9o1Y+6hRgceG1qKM5USbMgEFehKnBBe7SrveqltkStHQIOLXNdrUj6Oua3c+l8RNfM5cvsvCq8G57eGaIJ8yUPG1IySw4YDDg2IpTNU8QAKH3JSbd7aoiEaOHuuxA7kJZ2103M4PzK7yoxFCIOQsCFdkOtiY3EJc+82hsKa0n41XMrmIIVAVgmSraHwttxJ7J+EwwPlVM0v16h1tmpW8RHz5uLGcL9iiZJDkfMojICMuuSKLaCbdZrtMiRxF1jCmo9nkU/BDBc48QwnqdTyBCkr/zk7N2HefLKFUYYUrgTBMjYUKnjWTUdUaAWrm+wVg7185PdYfMdH5TlfIaQXuT7WrW9X1DIU6zKYzELj9axEmLe/wJzyN0mZNBhdxC0wMKiYFh5hQE3/XDlnUtPk1CE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 434b20fd-39ff-4c92-33b7-08d7f1035d15 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2020 14:48:24.4201 (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: peDY5hPJxUA4M7+knf/UB/u8hAaNLo+eFUAKp2dHHpN0Eqb3gULTzQvstv6omDW2Pw5duweRS4z4ZEDlyMKdoVl+Je76V+DCmFQ/fsbjEAo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3432 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 2/6] service: identify service running on another core correctly 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: Saturday, May 2, 2020 1:03 AM > To: dev@dpdk.org; phil.yang@arm.com; Van Haaren, Harry > > Cc: thomas@monjalon.net; david.marchand@redhat.com; Ananyev, Konstantin > ; jerinj@marvell.com; > hemant.agrawal@nxp.com; Eads, Gage ; Richardson, > Bruce ; honnappa.nagarahalli@arm.com; > nd@arm.com; stable@dpdk.org > Subject: [PATCH v3 2/6] service: identify service running on another core > correctly > > The logic to identify if the MT unsafe service is running on another > core can return -EBUSY spuriously. In such cases, running the service > becomes costlier than using atomic operations. Assume that the > application passes the right parameters and reduces the number of > instructions for all cases. >=20 > Cc: stable@dpdk.org > Fixes: 8d39d3e237c2 ("service: fix race in service on app lcore function"= ) Add "fix" to the title, suggestion: service: fix identification of service running on other lcore > Signed-off-by: Honnappa Nagarahalli > Reviewed-by: Phil Yang I believe there may be some optimizations we can apply after this patchset as the "num_mapped_cores" variable is no longer used in a significant way=20 for the atomic selection, however lets leave that optimization outside of 20.05 scope. With title (see above) & comment (see below) updated. Acked-by: Harry van Haaren > --- > @@ -412,24 +412,14 @@ rte_service_run_iter_on_app_lcore(uint32_t id, > uint32_t serialize_mt_unsafe) >=20 > SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL); >=20 > - /* Atomically add this core to the mapped cores first, then examine if > - * we can run the service. This avoids a race condition between > - * checking the value, and atomically adding to the mapped count. > + /* Increment num_mapped_cores to indicate that the service > + * is running on a core. > */ > - if (serialize_mt_unsafe) > - rte_atomic32_inc(&s->num_mapped_cores); > + rte_atomic32_inc(&s->num_mapped_cores); The comment for the added lines here are a little confusing to me, the "num_mapped_cores" does not indicate that the service "is running on a = core", it indicates the number of mapped lcores to that service. Suggestion below? /* Increment num_mapped_cores to reflect that this core is * now mapped capable of running the service. */ > - if (service_mt_safe(s) =3D=3D 0 && > - rte_atomic32_read(&s->num_mapped_cores) > 1) { > - if (serialize_mt_unsafe) > - rte_atomic32_dec(&s->num_mapped_cores); > - return -EBUSY; > - } > - > - int ret =3D service_run(id, cs, UINT64_MAX, s); > + int ret =3D service_run(id, cs, UINT64_MAX, s, serialize_mt_unsafe);