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 C0FD9A052A; Tue, 22 Dec 2020 13:42:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F0DEECA54; Tue, 22 Dec 2020 13:42:38 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 982C7CA3E for ; Tue, 22 Dec 2020 13:42:37 +0100 (CET) IronPort-SDR: UtYmbZJOXweJCx6LQJ2pQINeMCf33IWm+S/xZh3l0YVaQSVRyllipiN0yO7rp6A4RBdnUOMb80 zsZrqZjpUvIg== X-IronPort-AV: E=McAfee;i="6000,8403,9842"; a="163583261" X-IronPort-AV: E=Sophos;i="5.78,438,1599548400"; d="scan'208";a="163583261" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2020 04:42:29 -0800 IronPort-SDR: sra0W24M+IJ9LtkAcTw2MNmNbmn+iVnTf3Zf9eWf0ac/N6+YJWpCJF8vbIrCA1HPTG/elCCc8/ D2STrnDu7Ttg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,438,1599548400"; d="scan'208";a="373293314" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga008.jf.intel.com with ESMTP; 22 Dec 2020 04:42:28 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 22 Dec 2020 04:42:28 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 22 Dec 2020 04:42:28 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Dec 2020 04:42:28 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 22 Dec 2020 04:42:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VppWFblp3TezcvLwvelPhO0QTJXEbhilHc1epeby//dtwAb1fYa61IryAE1VaavD2QqmgUlLcJvduq6I5a2zd+qoYh2f9XzHESZN6nYvNZqje3OtKmqHnZhhSugPUI/7YC417cZAxwaewzEwKljGW3nijhUho8Gp/NdSncIN6aAg1N9bDibK0owDfeX2QVrA9LpgK3p4ZekUlux5oDlXq8Wm41ZCvuRZsmYRHiN3Oiu1o2eT+xhDMC7a3+UqFfOrzweY45VghsFRcm39OfV911osDKIxYyl2y011PnfRPSrruOPv/ilN/dbH1X6fU8MNn2f9bniB4vvpB0CcLwVOqg== 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=FhVKXpvvVd61ogUALL1Jfd2R26axm5wggxkyM+Q2qZY=; b=ebt+z16swJoYBw3UHrKR3J3dLWfQ0mSiMf6KpSXoESKofPR36gwWHGuH/750OEwHwowlwNTmnvwAlJvzmkFfObLQqUwKN0S3yZUjdhF9wvOrs3SqWt54YPJ8UoYAbkbjHN+FrVdmGqPJbFzWrb4KBvwQzuh9EaoBvcDILptETSQhB29xeKrDWILNUbanEX0zuYBPaOIolG/QiiAsXsTanbPt+eNVDzl3OPJZri5ol9sf/g9CyPlDMmH4WwloCD4C+f7QLkjOSvXDJhu3iA4caZCCmspSa/ayXJPV6KpIFjNCplloV6kiA2GSdXOQ1r9B2R1WIyjwWLZoJzv7I5q+PA== 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=FhVKXpvvVd61ogUALL1Jfd2R26axm5wggxkyM+Q2qZY=; b=gT7etOi0mchlGaGTqbXiPvD6gfiePXipKiuK048fz+peFbLho3fuabGArOOL60kB+iYTZQLvoWVQVYw+Ayk1zdyGmnapm6WXqr2m+9es6dvHnGko1FWhvdr4ycHz15eMGpBvSRiqVpkJHL8krrJcFyKq567GgL8BBcbAnPQ6now= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB2630.namprd11.prod.outlook.com (2603:10b6:a02:c2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Tue, 22 Dec 2020 12:42:26 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::e59d:1af1:8575:8435]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::e59d:1af1:8575:8435%6]) with mapi id 15.20.3700.026; Tue, 22 Dec 2020 12:42:26 +0000 From: "Ananyev, Konstantin" To: Feifei Wang , Honnappa Nagarahalli CC: "dev@dpdk.org" , "nd@arm.com" , "Honnappa.Nagarahalli@arm.com" , "ruifeng.wang@arm.com" Thread-Topic: [PATCH v1 1/2] app/test: remove unnecessary barriers for ring stress test Thread-Index: AQHW2CwQ96/sxptInkmsLdK5Uf3RAKoDBLrQ Date: Tue, 22 Dec 2020 12:42:26 +0000 Message-ID: References: <20201222063054.44429-1-feifei.wang2@arm.com> <20201222063054.44429-2-feifei.wang2@arm.com> In-Reply-To: <20201222063054.44429-2-feifei.wang2@arm.com> Accept-Language: en-GB, 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.5.1.3 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: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1a6fc50e-523b-4f33-1e08-08d8a6770974 x-ms-traffictypediagnostic: BYAPR11MB2630: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5RUXwclPFg8UwiE51ROtaCOGy6UzMPwLiKykGhjZypgDq9ddLIIRkg3Wx1cDFp5OvQ71Eo0k7MaIzVpaIUbUu25BBV2P7IvEpcZvCCJF3GXmLTXGRmg1VYxAZ2mcDQqriO2Stxea6m0wM0bTEl6GCjouvl7vdJU3OW/KeNPQyU2Pb36td5Fmmk51PY94m3A+i3J5nC+XgYq5oBG03z/j2v9UNAPKPN0oTrmShIOUJ7hIyFaDDnoDz9gd1g4Ym2mRUFtZwL4iUgxwrKeHYuoXYvEGqsXjAR4l68dDB0uGLGackhMjGmujujTlKfpmaZYQ6n1w6B3rWT7oCyE1rCUQdLHfJghYwx171XNiqcHM7DZuNhQg9CnG0oQbVmkxJL4pGPQ3QPgSd7I2IqToO4Z2ew== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(39860400002)(346002)(376002)(366004)(4326008)(186003)(7696005)(8676002)(54906003)(478600001)(52536014)(6506007)(316002)(8936002)(86362001)(33656002)(110136005)(26005)(83380400001)(55016002)(66446008)(76116006)(9686003)(66946007)(66556008)(66476007)(71200400001)(5660300002)(2906002)(64756008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?msL4xOv2I+FvuvhR73ACSa2Oqh713PVA0PTu5W4v0233B9eGC0IDZpfgPhX3?= =?us-ascii?Q?i4QY4e9HVjOhP6J+7ulXiRZfW06+NSw55RJZbN5xrmwRcpy3fz1/mM+DJO+M?= =?us-ascii?Q?r/HMcSpQe2scQkAg2kfxn4vqEKdYlv8Hro2jVPBFLOGZEaQTg+u40uTy0QPv?= =?us-ascii?Q?WVoVCj5hnK2kEfgMHlMOD0pM1OO8np7nEz0QTWcAboVwJ6YYQk063gSCIdbp?= =?us-ascii?Q?m343DkfOGYAw3FO96vPCEP85oTQzJKaQgCD5/1IUUsYdH4fdu1lMQDEA5Olp?= =?us-ascii?Q?dEtIuzKFjS/dNTMqQjXR7DXZU9Iu6onePz+Xx26JwuucqJVMVE2831RHlhyD?= =?us-ascii?Q?mHtNdelzNHYiZFboS3Wksj/pylDmzRWlkfBGAueicSSOelbItmEmV3882qWc?= =?us-ascii?Q?kQtrQYdbjkUt0pOYRSmduVuaBEIcGbbsVXBqKKw6xERbwJb4YPiowxyB2PnI?= =?us-ascii?Q?9vkfBLFmaFlbCjoaob31tpEt0pVCgWZQSWfk+4VQlXED+tdgRRI9Rj7+fZLS?= =?us-ascii?Q?mbBJxVO1Rtp6kLlToBldCxvjSh75jvZ4hjCfFxZ7+HTIhHmsBShYt4bh07wt?= =?us-ascii?Q?NmTf2u9NLpdFaWFyaABcHriuO4FNcceEhx9HHQXer8fpzraJ9++hcuyHcfJe?= =?us-ascii?Q?rZaVzvj9zZJzycRQ3S/ScjKSJNKxhO0rzPAQ5Swlqxz8vMBWVie0lPyUZ+Gd?= =?us-ascii?Q?MYjdgBTte1Wbq0AgGwRyDireIjG58QLpIcVDE0i0e8jMdO1k1+ha9z9HCN5i?= =?us-ascii?Q?ODW7jgZ1GdZygBgiZ1kB6TtUJ9wKaHyN0RVLVC2jtRY7DUqaTXai6COELu3f?= =?us-ascii?Q?eRDb55200JG1hQpbUL1jJg5b33fc1fuiudn0bzVbMhLodF8mR9SDoj34JZOD?= =?us-ascii?Q?/k03kW8UNFLBvqhaj515iKmuCDdxuHT9VeU98R19JRjn4TZWE0sTlV+sVnDG?= =?us-ascii?Q?Pb0N4tvGmsV+XVLBHsXni95n+Jk36uM3YeIx/WWb3CU=3D?= x-ms-exchange-transport-forked: True 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: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a6fc50e-523b-4f33-1e08-08d8a6770974 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Dec 2020 12:42:26.1699 (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: h1ca0t/AVjrTbgaf+sLfMb4DQDpbqs/SG71ZQjV9UB6hSPCTi1yWPc+RZt4ohESqucqtCEGAUPtlQLfapAHz7OR3dWcLrs1JIBqs2JaM4bA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2630 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v1 1/2] app/test: remove unnecessary barriers for ring stress test 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" Hi Feifei, >=20 > The variable "wrk_cmd" is a signal to control threads from running and > stopping. When worker lcores load "wrk_cmd =3D=3D WRK_CMD_RUN", they star= t > running and when worker lcores load "wrk_cmd =3D=3D WRK_CMD_STOP", they > stop. >=20 > For the wmb in test_mt1, no storing operations must keep the order > after storing "wrk_cmd". Thus the wmb is unnecessary. I think there is a bug in my original code, we should do smp_wmb() *before*= =20 setting wrk_cmd, not after: /* launch on all workers */ RTE_LCORE_FOREACH_WORKER(lc) { arg[lc].rng =3D r; arg[lc].stats =3D init_stat; rte_eal_remote_launch(test, &arg[lc], lc); } /* signal worker to start test */ + rte_smp_wmb(); wrk_cmd =3D WRK_CMD_RUN; - rte_smp_wmb(); usleep(run_time * US_PER_S); I still think we'd better have some synchronisation here. Otherwise what would prevent compiler and/or cpu to update wrk_cmd out of o= rder (before _init_ phase is completed)? We probably can safely assume no reordering from the compiler here, as we have function calls straight before and after 'wrk_cmd =3D WRK_CMD_RU= N;' But for consistency and easier maintenance, I still think it is better to have something here, after all it is not performance critical pass.=20 > For the rmb in test_worker, the parameters have been prepared when > worker lcores call "test_worker". It is unnessary to wait wrk_cmd to be > loaded, then the parameters can be loaded, So the rmb can be removed. It is not only about parameters loading, it is to prevent worker core to s= tart too early. As I understand, your goal is to get rid of rte_smp_*() calls. Might be better to replace such places here with _atomic_ semantics. Then, as I can see, we also can get rid of 'volatile' fo wrk_cmd. =20 > In the meanwhile, fix a typo. The note above storing "stop" into > "wrk_cmd" should be "stop test" rather than "start test". >=20 > Signed-off-by: Feifei Wang > Reviewed-by: Honnappa Nagarahalli > Reviewed-by: Ruifeng Wang > --- > app/test/test_ring_stress_impl.h | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) >=20 > diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress= _impl.h > index f9ca63b90..384555ef9 100644 > --- a/app/test/test_ring_stress_impl.h > +++ b/app/test/test_ring_stress_impl.h > @@ -198,7 +198,6 @@ test_worker(void *arg, const char *fname, int32_t prc= s) > fill_ring_elm(&loc_elm, lc); >=20 > while (wrk_cmd !=3D WRK_CMD_RUN) { > - rte_smp_rmb(); > rte_pause(); > } >=20 > @@ -357,13 +356,11 @@ test_mt1(int (*test)(void *)) >=20 > /* signal worker to start test */ > wrk_cmd =3D WRK_CMD_RUN; > - rte_smp_wmb(); >=20 > usleep(run_time * US_PER_S); >=20 > - /* signal worker to start test */ > + /* signal worker to stop test */ > wrk_cmd =3D WRK_CMD_STOP; > - rte_smp_wmb(); >=20 > /* wait for workers and collect stats. */ > mc =3D rte_lcore_id(); > -- > 2.17.1