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 91851A0526; Wed, 22 Jul 2020 23:40:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 645151BFD4; Wed, 22 Jul 2020 23:40:55 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50082.outbound.protection.outlook.com [40.107.5.82]) by dpdk.org (Postfix) with ESMTP id EA1CA1BFBB for ; Wed, 22 Jul 2020 23:40:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HdDoozArlyAluYD0TjGXZRUynuknaju52QQYC3yQ74A=; b=nEFlVSNWXEz9OxlRI+M9yJSRwM98fA2TEqQC/2V8NmYPUB0HbI2HdaK+6X0GytzIu4ZlkRALyf7KIalSMNpRh1Qko3MQOjd9SR84hBepXM/ZdFjijqikWZH+YZasVKbBM1XOTgZHeYpSVlzCCd6qNnY3FV9GgEBh4/rZ5zM2lH8= Received: from MR2P264CA0011.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::23) by AM0PR08MB3380.eurprd08.prod.outlook.com (2603:10a6:208:e4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Wed, 22 Jul 2020 21:40:45 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:1:cafe::b8) by MR2P264CA0011.outlook.office365.com (2603:10a6:500:1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20 via Frontend Transport; Wed, 22 Jul 2020 21:40:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Wed, 22 Jul 2020 21:40:45 +0000 Received: ("Tessian outbound c83312565ef4:v62"); Wed, 22 Jul 2020 21:40:44 +0000 X-CR-MTA-TID: 64aa7808 Received: from fb7c59bc0ac7.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F7495555-A1DF-4C3C-AE7B-5147B70BF6C5.1; Wed, 22 Jul 2020 21:40:39 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fb7c59bc0ac7.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 22 Jul 2020 21:40:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cDLsleWesW0UWbmG5Rfr2J230Sh5BOZ8NkmESCzcozdK25YgdGqGiZ5z1zEa2xZfcHTucNovvNPEqXjgtM4SuG5FLHQXfPKR9dTNI8tMyHVfK9hhwymNb4N9A3FmIJUTU6n5v/xYu13Ng4lRSXLKXqsWnF7Hsb1MnB9b0muvF+7GaSoJu+SiczHVo6qQY0kkK15MMwMIQuweb8OeXMAUCklRddKbYgQ8XIFkNunDnsK49pbwwlN4HqRa0wcgQGmosAx04gu08Mn7feGhAdturQ42CsvSubVde7x5Fuk5jWZ9epYTWByvQ06A8vtR+4/N9yrfvNqRh1Zm4TbIv8WMdw== 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=HdDoozArlyAluYD0TjGXZRUynuknaju52QQYC3yQ74A=; b=kAyTmpTmGBb5BISuhhiiHpUgzhQ5VlY8dsBKLF9zzxAGyiIJq/z6fmDSVKuISAUy+tqfa79g3/9tiukJA2wKguqcnWToOi3t1XQS7lXO6w0uAs2wioIVAK5cUyDgvryhTX08FYVN+XzTaXBecgi9fXZ+W0yOzMGhTjjX3z6ctJtveB3RiWcQSWaF2+ACmGIi9ryk3LObnDY/Cwzpyxz2xwTCwF+PSv+p7FPmb8uQNKgwzf3i0sJ8ewJ5c7OyxpyJMglBit13XympiC+jDGrKbMRjy97fdQS8Ngy/9uabCFBhAEJuOP5RQY2ops7J9j6y6TeoYH1fIu8fHBkLH1Tqzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HdDoozArlyAluYD0TjGXZRUynuknaju52QQYC3yQ74A=; b=nEFlVSNWXEz9OxlRI+M9yJSRwM98fA2TEqQC/2V8NmYPUB0HbI2HdaK+6X0GytzIu4ZlkRALyf7KIalSMNpRh1Qko3MQOjd9SR84hBepXM/ZdFjijqikWZH+YZasVKbBM1XOTgZHeYpSVlzCCd6qNnY3FV9GgEBh4/rZ5zM2lH8= Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com (2603:10a6:4:85::9) by DB8PR08MB4105.eurprd08.prod.outlook.com (2603:10a6:10:b0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Wed, 22 Jul 2020 21:40:37 +0000 Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d]) by DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d%10]) with mapi id 15.20.3195.028; Wed, 22 Jul 2020 21:40:37 +0000 From: Honnappa Nagarahalli To: Harry van Haaren , "dev@dpdk.org" CC: "david.marchand@redhat.com" , "igor.romanov@oktetlabs.ru" , "ferruh.yigit@intel.com" , nd , "aconole@redhat.com" , "l.wojciechow@partner.samsung.com" , Phil Yang , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v3 2/2] test/service: fix race condition on stopping lcore Thread-Index: AQHWYBP1XaoosJ90+0aDkiA52ipRyakUIQYw Date: Wed, 22 Jul 2020 21:40:37 +0000 Message-ID: References: <20200720143829.46280-1-harry.van.haaren@intel.com> <20200722103701.7244-1-harry.van.haaren@intel.com> <20200722103701.7244-2-harry.van.haaren@intel.com> In-Reply-To: <20200722103701.7244-2-harry.van.haaren@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 71b0131b-f1d0-4f41-a10c-9c6269578ccb.0 x-checkrecipientchecked: true Authentication-Results-Original: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fa2b0081-ba6d-404c-2c53-08d82e87e40f x-ms-traffictypediagnostic: DB8PR08MB4105:|AM0PR08MB3380: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: C8io1UtIoLoMTGzn3myC/Tc6RqyvWbjEMbKYDwBGD0QhTho9eX9bX8yFrXK6PYowhM7GO47E7nhYnsFasnnsG8Y0C9d1DquOjDzLFy1qwKRkPDlF8zI0RRuf/KCj/OLwBaEzZzqtl0e9eIWl6ewqcF3ZIcAvbZvOvI+CIDWmUvqtJLCR4QmZTMP22w+F/GhGB3oGccZzitJq9XmBTlWkV/VeY1tSEjlgGLKcIogdLiI85kXUHosI25qheSCnEDYohYhcnFYOv93KNnRNnvNhhlC5zlTdRcS7CVf/6EFtRHgq2GURa+rLHs3eV32m3uhiXKZqQGJowW2XXK0XNP5j2g== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0802MB2216.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(396003)(366004)(346002)(39860400002)(316002)(9686003)(86362001)(8936002)(6506007)(55016002)(7696005)(71200400001)(186003)(4326008)(66946007)(66556008)(64756008)(66446008)(110136005)(52536014)(5660300002)(76116006)(2906002)(54906003)(8676002)(26005)(478600001)(66476007)(33656002)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: vnCPdp8UoH/EkrsQPmsJGyyFLmAlIr4sJdE7AZ7TsYILsodZRBpLwbIWiPPaVJJ4Qgi0YMUhYwPvV17lccw3n5bUL4i2w7er+Sy2647FH2gEnm0kGE6e0vuw0ATSzK0Qs2IHnKIFpfCZgx22JOJ3KQfzYGuERNt8MXxvaBNDZuxlAlsEPyNOMEko5zgKTtTA5z9nU48b79fmZuEFe+4aAvAIKcy163thc4OdSIwWfODa7zFXOKNBwrt3+utND/lUMd/Wx1dQvSfsaSeZmHqiH4VQ0idUMGVz3is7re3JWz2UEtryCUl1u41T5mcu4Qi90PB/9LpMCJEDr3A/LKYTNpjW9Y3nv0ZJmKje4OezvdmlYJwQ8n1gEVCz5fBFArDNnIVfsS3ppR3Uz++iBlm5lzf8zl31OIo+l9EVAMTeF1zN26RXnH/Tj0en3KVDkE2URuQ/YTpg6I2pDpZfBRBJku0NqPZJNmK9U20vmfB/ZEF5NyxhYzqyK+ZYNrvr8Fhf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4105 Original-Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 01b6c1bf-e38e-4c2f-ce79-08d82e87df80 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: huEfaDtlj5j69Vgi38j4+6LEM66R1khb5LYG7BDh+t6XObx8mHHvc8LhcNPsPtUlGa87xQ6IldSYZ7X/j4oL5fDoMCcasuj350UC0QdxK6StrjvHbZGnC3MCzwlj0jh9oZoXMZM1RXN4SamqzDqqekOk7GGvtUdEMYUmEn4e2kdvMmw/b2zUCppgQrli7N08zkBPLQ3gAODnGRNbWgq0mnMZjFVXgTYCzhh6yMz0/i1yxmsabpB++yr2EIwUvpArpqm4jOaG/xzucazCcc0H9C10t8fNj+ddwIMyeB2PV2vsGCFpqCcx/6DnAj1lrAJK1OETkCl+r16JedDQV8teZKqG4NiVzx5GCjkh0AVLbqIyOolwJyJJC957zL6ewkGAmF9LbJzQwqUqcPN63uJWvw== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(396003)(376002)(136003)(346002)(39860400002)(46966005)(6506007)(186003)(36906005)(336012)(4326008)(316002)(26005)(8936002)(55016002)(9686003)(110136005)(33656002)(478600001)(2906002)(54906003)(86362001)(5660300002)(52536014)(70206006)(8676002)(70586007)(7696005)(82740400003)(47076004)(83380400001)(81166007)(82310400002)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2020 21:40:45.3078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa2b0081-ba6d-404c-2c53-08d82e87e40f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3380 Subject: Re: [dpdk-dev] [PATCH v3 2/2] test/service: fix race condition on stopping lcore 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" > Subject: [PATCH v3 2/2] test/service: fix race condition on stopping lcor= e >=20 > This commit fixes a potential race condition in the tests where the lcore > running a service would increment a counter that was already reset by the > test-suite thread. The resulting race-condition incremented value could c= ause > CI failures, as indicated by DPDK's CI. >=20 > This patch fixes the race-condition by making use of the added > rte_service_lcore_active() API, which indicates when a service-core is no > longer in the service-core polling loop. >=20 > The unit test makes use of the above function to detect when all statisti= cs > increments are done in the service-core thread, and then the unit test > continues finalizing and checking state. >=20 > Fixes: f28f3594ded2 ("service: add attribute API") >=20 > Reported-by: David Marchand > Signed-off-by: Harry van Haaren > Reviewed-by: Phil Yang Reviewed-by: Honnappa Nagarahalli >=20 > --- >=20 > v3: > - Refactor while() to for() to simplify (Harry) > - Use SERVICE_DELAY instead of magic const 1 (Phil) > - Add Phil's reviewed by tag from ML >=20 > v2: > Thanks for discussion on v1, this v2 fixup for the CI including previous > feedback on ML. > --- > app/test/test_service_cores.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.= c index > ef1d8fcb9..a6bc4487e 100644 > --- a/app/test/test_service_cores.c > +++ b/app/test/test_service_cores.c > @@ -362,6 +362,9 @@ service_lcore_attr_get(void) > "Service core add did not return zero"); > TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(id, slcore_id, 1), > "Enabling valid service and core failed"); > + /* Ensure service is not active before starting */ > + TEST_ASSERT_EQUAL(0, rte_service_lcore_active(slcore_id), > + "Not-active service core reported as active"); > TEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id), > "Starting service core failed"); >=20 > @@ -382,7 +385,22 @@ service_lcore_attr_get(void) > lcore_attr_id, &lcore_attr_value), > "Invalid lcore attr didn't return -EINVAL"); >=20 > - rte_service_lcore_stop(slcore_id); > + /* Ensure service is active */ > + TEST_ASSERT_EQUAL(1, rte_service_lcore_active(slcore_id), > + "Active service core reported as not-active"); > + > + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(id, slcore_id, 0), > + "Disabling valid service and core failed"); > + TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id), > + "Failed to stop service lcore"); > + > + /* Wait until service lcore not active, or for 100x SERVICE_DELAY */ > + for (int i =3D 0; i < 100 && rte_service_lcore_active(slcore_id) =3D=3D= 1; > + i++) > + rte_delay_ms(SERVICE_DELAY); > + > + TEST_ASSERT_EQUAL(0, rte_service_lcore_active(slcore_id), > + "Service lcore not stopped after waiting."); >=20 > TEST_ASSERT_EQUAL(0, rte_service_lcore_attr_reset_all(slcore_id), > "Valid lcore_attr_reset_all() didn't return success"); > -- > 2.17.1