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 DF07BA0526; Tue, 21 Jul 2020 10:39:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C1CF21BFFB; Tue, 21 Jul 2020 10:39:07 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2085.outbound.protection.outlook.com [40.107.22.85]) by dpdk.org (Postfix) with ESMTP id C3D301BFD4 for ; Tue, 21 Jul 2020 10:39:06 +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=pcBBHV3THjAjptWAvApusrar6p7MHSq8xoGqbYdpeqk=; b=xxChvMj3seljrcagHEX/GP4bER+2uomy6KDmaUam79EoiLkqh/VdA99gDDMl2J1FOKtfGHFITyE95zoRI3dK0O7eR0TnfBSfLSlKK1/XVwGkU0X06BLf8ZubZ2lqryDTJLBoSgv10XoK5Dis+AqHR2hEDVgrASasMvNyNEYrOpk= Received: from AM6PR10CA0031.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::44) by HE1PR0801MB1913.eurprd08.prod.outlook.com (2603:10a6:3:51::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.25; Tue, 21 Jul 2020 08:39:05 +0000 Received: from AM5EUR03FT019.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:89:cafe::a3) by AM6PR10CA0031.outlook.office365.com (2603:10a6:209:89::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend Transport; Tue, 21 Jul 2020 08:39:05 +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 AM5EUR03FT019.mail.protection.outlook.com (10.152.16.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18 via Frontend Transport; Tue, 21 Jul 2020 08:39:04 +0000 Received: ("Tessian outbound c4059ed8d7bf:v62"); Tue, 21 Jul 2020 08:39:04 +0000 X-CR-MTA-TID: 64aa7808 Received: from 0aa4e01f0756.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 48750454-C682-4C95-B184-F087DD2255AD.1; Tue, 21 Jul 2020 08:38:59 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0aa4e01f0756.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 21 Jul 2020 08:38:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDDy+dPS1vVsC8USyRLUgu+tafUXjm+XOBT659e+53FaPxjYwc+/2x2uajU+4D5LYE8hSI9AixRtbormStgAqyQ/3NOLKhQEuF/itTv+iZYXrAdvd595FU3PC1iCirh6w1ImzALmCRHfxXiRPEFtB7mgs4Vwdk+owp/jO9jweZiToiJKAO04mFwy9YG62YvVJdQeYgAPy90xfTKMPRqsHCh1rRScoBH2M2TIunrWFxrikgPNC4OVn8Fm+ChrkFpIKAlLFmUIc+uH26UBsQ99I3FVnJybb+wb3fgEce7hWHPJaBNJ5SseZuC8LUWNSQbGsZnGqWy1fhvsMZNay9Y95A== 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=pcBBHV3THjAjptWAvApusrar6p7MHSq8xoGqbYdpeqk=; b=MOkwRKYIJhn4HgpjX7crAn1ZC7o17Xz3p57+hPGghGP7HWsF34mRPl67T7zwmwg6TyC2swt3u5d+Zgt3txtPrr5Hhb6bq10FlNdAq1hw4UKUkBZx4yAArf1lcNDVmBG+tQv+rP5aNK7TiIXLVUwYrcrZCreVO3CltH8hYMYqcxP9YnJDy2tEcrWUU6MdtJLW3BlXN4k/u2wQ0J4GRghG58prQXpf1ucO/WgaCKqQzcvfAci/p4kXLGv7Xancwyr1ai9suODtLG3YeIKEAjvhztxe5AW7xmSAy9sU4s2W8OOpHovQa04s8V51zqKaoKtfbjJuQnxkIKPYgOiHFbPmgQ== 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=pcBBHV3THjAjptWAvApusrar6p7MHSq8xoGqbYdpeqk=; b=xxChvMj3seljrcagHEX/GP4bER+2uomy6KDmaUam79EoiLkqh/VdA99gDDMl2J1FOKtfGHFITyE95zoRI3dK0O7eR0TnfBSfLSlKK1/XVwGkU0X06BLf8ZubZ2lqryDTJLBoSgv10XoK5Dis+AqHR2hEDVgrASasMvNyNEYrOpk= Received: from VE1PR08MB4640.eurprd08.prod.outlook.com (2603:10a6:802:b2::11) by VI1PR08MB3600.eurprd08.prod.outlook.com (2603:10a6:803:85::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.24; Tue, 21 Jul 2020 08:38:58 +0000 Received: from VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::28a3:3a4e:65ca:5707]) by VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::28a3:3a4e:65ca:5707%3]) with mapi id 15.20.3195.025; Tue, 21 Jul 2020 08:38:58 +0000 From: Phil Yang To: Harry van Haaren , "dev@dpdk.org" CC: "david.marchand@redhat.com" , "igor.romanov@oktetlabs.ru" , Honnappa Nagarahalli , "ferruh.yigit@intel.com" , nd , "aconole@redhat.com" , "l.wojciechow@partner.samsung.com" , nd Thread-Topic: [dpdk-dev] [PATCH v2 2/2] test/service: fix race condition on stopping lcore Thread-Index: AQHWXqNdHf5ki8kY806Pod2PDb8vmqkRqYZg Date: Tue, 21 Jul 2020 08:38:58 +0000 Message-ID: References: <20200720120938.34660-1-harry.van.haaren@intel.com> <20200720143829.46280-1-harry.van.haaren@intel.com> <20200720143829.46280-2-harry.van.haaren@intel.com> In-Reply-To: <20200720143829.46280-2-harry.van.haaren@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 4e2a5c22-f005-4258-8728-c4e4e9d9e7c3.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: [203.126.0.113] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ad825243-efcd-470a-3262-08d82d5186d3 x-ms-traffictypediagnostic: VI1PR08MB3600:|HE1PR0801MB1913: 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: n5zhlFkdewtD9QZAw0/ktZo/SeuWvd/3l9NHTYNOYlbt52n9gmRQH8aGQ5JFR0Jm/iZCN2SakgRLYk47VqTr9VHwHIUf7nZIJiXzJ3jn3xA/RnkY5CErITgAuc0dYivBtEHkysY9iftVgBNPSPG8V290Z2nTphoeXky0QMN0qjYLGETffSBcPrpfNe+LDbgezLDPESgxkICqCOlq5BdlQoIJwKjEy2ur6/kY85bejkFt6LjR/W02MoSMWKfMA2503ps73GzxfkqoLffbS9mPVVsW8rXYN8ANiAzrraJisFoxzguuaQS2/go0g5DOD7ym X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4640.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(376002)(346002)(366004)(396003)(86362001)(316002)(5660300002)(2906002)(33656002)(76116006)(66556008)(66446008)(26005)(110136005)(66476007)(64756008)(186003)(478600001)(52536014)(54906003)(6506007)(4326008)(7696005)(71200400001)(83380400001)(55016002)(9686003)(8936002)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: fVP+dr+9NiaFnqxzrL+9GMC6jZqbKjpzoX1pBTlyq51jneZg4XdI9Owdp+JQkabYYWRL/9+oBdrZzBwqQ3WarK6O1K4bBmcrChbdmm+JMj7TtgfjMOqAI9AX+kJ/BmqE6Wm5+2LMj+X81Ik0dm9ASN4V9NcPUWpX2AAnr5ugstXww5LjbNoCrXvWgvnpjiLqEOC4fUJIvVI9ao8awJPvyQ5pekSuXLy4cQS2b2pZiiFnLhnr4BoldkvqHVC3mGnq0hJW1sy9fkfXfPB9cR5iiKO7sTkO4eerzbkjQ7lVciBHwMRSMqx2R2DwLkDaRPXpYJVoMo7M9JPr8Y6XS4DcWPUrQdtrOwZiwXwd1Fvzo5l199SS/HlOwIezx2J9jANJwrXiSi+YwqVcyKLzHMwvZ7d4mlEak8O/eZfVbMJaiVGLXuNd+lBNVo9LCt/8tGcP/0yLAefGlZXkiev1k5WnTjSyr37XSQ/XivOi2Crgrdw= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3600 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: AM5EUR03FT019.eop-EUR03.prod.protection.outlook.com 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)(39860400002)(376002)(136003)(396003)(346002)(46966005)(52536014)(2906002)(47076004)(82740400003)(4326008)(110136005)(33656002)(26005)(36906005)(6506007)(316002)(7696005)(186003)(54906003)(82310400002)(356005)(55016002)(9686003)(83380400001)(70586007)(81166007)(8936002)(5660300002)(86362001)(70206006)(336012)(478600001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ebdcb2b-dba1-4139-875c-08d82d5182e7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LwxOJwkrjBzFFvvyKZkF4z9wuP/h1To7BJym3eB6PX1+pawexRZNDpE5NnCHd8OGurg8MJJjYafV1gmZ4rMoY1K+UTDEQI5XmAyZ5eKv2+oZCF1tjdQRXm3qNIqUPX6fVGjLo6FId8/NJJQZkA+8qilQ9hfDzjgxGjJsk/SIJ1CVI38fRRSOdVB24vzTYtW+gZFDI2oQePR1WmA5Wq4a/9bQCrJGljS6MeNPfVdlG4PipWp1SwEWBhenp8VTf7jUoQPvui+kAhYmWWR5IkzqHm0SF7SFsCN0+pK+dOYylBZNt0YoNWmKriOH6rCQZJVYWxJWPbp6wZcrog+rUPsuJGXCb8Lt4mCsSmJFFb8FWkPktkOiSWqGIjinkukJ9jXNAAIUEULdcQALknsQe34J6Q== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2020 08:39:04.9644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad825243-efcd-470a-3262-08d82d5186d3 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: AM5EUR03FT019.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1913 Subject: Re: [dpdk-dev] [PATCH v2 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: [dpdk-dev] [PATCH v2 2/2] test/service: fix race condition on > stopping lcore >=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 cause 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 statistics 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 Minor nit, otherwise it looks good to me. Reviewed-by: Phil Yang >=20 > --- >=20 > Thanks for discussion on v1, this v2 fixup for the CI > including previous feedback on ML. > --- > app/test/test_service_cores.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.= c > index ef1d8fcb9..a45762915 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,24 @@ 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"); > + > + int i =3D 0; > + while (rte_service_lcore_active(slcore_id) =3D=3D 1) { > + rte_delay_ms(1); Just as it does in other functions, use the macro instead of the magic numb= er would be better. rte_delay_ms(SERVICE_DELAY);=20 > + i++; > + if (i > 100) > + break; > + } > + 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