From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1F39FA0679 for ; Mon, 1 Apr 2019 18:24:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5434568A; Mon, 1 Apr 2019 18:24:04 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140048.outbound.protection.outlook.com [40.107.14.48]) by dpdk.org (Postfix) with ESMTP id 79A74548B for ; Mon, 1 Apr 2019 18:24:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9wI+kILmPlny8KwGg6NNu0sPVffRpjDXM9GypOS1FyI=; b=cDFEahlGcyo8198fQGij5DSjy8gNHZvi/559pVQHG+MaXmVeQf86B/1e7UZjD9comctaeqDW+4vH2H/AgkaYeqzHHqbEfuRfkicr87b0O7Gf5f2aLRe9GQF3/z3Wsq4nkUPbgU4xbEON87KHpt16gnNPlgBdTfBVTHgh4ihdA+A= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.152) by VE1PR08MB4768.eurprd08.prod.outlook.com (10.255.113.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Mon, 1 Apr 2019 16:24:02 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::e0ae:ecad:ec5:8177]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::e0ae:ecad:ec5:8177%2]) with mapi id 15.20.1750.017; Mon, 1 Apr 2019 16:24:02 +0000 From: Honnappa Nagarahalli To: "Phil Yang (Arm Technology China)" , "dev@dpdk.org" , "thomas@monjalon.net" CC: "david.hunt@intel.com" , "reshma.pattan@intel.com" , "Gavin Hu (Arm Technology China)" , "Phil Yang (Arm Technology China)" , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins Thread-Index: AQHU5h4g+Cf7RF5U40C+Gc0897QjeqYngWYQ Date: Mon, 1 Apr 2019 16:24:01 +0000 Message-ID: References: <1546508946-12552-1-git-send-email-phil.yang@arm.com> <1553856998-25394-3-git-send-email-phil.yang@arm.com> In-Reply-To: <1553856998-25394-3-git-send-email-phil.yang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 398316ce-20fe-43ed-1359-08d6b6be73b0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VE1PR08MB4768; x-ms-traffictypediagnostic: VE1PR08MB4768: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0994F5E0C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(366004)(396003)(136003)(376002)(346002)(39860400002)(199004)(189003)(7696005)(55016002)(76176011)(446003)(97736004)(72206003)(33656002)(476003)(9686003)(229853002)(81156014)(4326008)(14454004)(26005)(256004)(68736007)(8936002)(71190400001)(6506007)(486006)(11346002)(6246003)(66066001)(110136005)(6116002)(99286004)(7736002)(81166006)(86362001)(102836004)(305945005)(186003)(53936002)(71200400001)(3846002)(5660300002)(74316002)(54906003)(478600001)(2906002)(8676002)(6436002)(105586002)(106356001)(316002)(52536014)(2201001)(2501003)(25786009)(21314003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4768; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: cgfsj+mV6OsmWylC0EaWSz17NoqNO8zIJvK/l5vZ3NWmyezk20FZrLzycPxAAVbn5UVmk15u6M2woAVuuXqR9D30jo2WvkQLhpCbYErxmtCo+frRr07v8oKUFP3C70H0+lVVbp3thO3JuV3zTkJqGAwZUEVWeOhbOUXZRUAgX25db/ZBjDibB8oczW95DJPjmVJ95eLx0MKWQjWQIFp/aRj+aZauA+Awe+vwSyeX8SNEjUCUTxiC7k3GLbHZuCVeyy4+aWLOiFks0eMNkXifZluBtGtpi3wKq3AfV+5BXZUXC2CN99NsKH09I8aOMJxysyF6iT+WYCb9FFvuEGMf1bmKf5EKZOorhcI3e0dc88WGK2wIeqtWwqh9h3NeCtAoh1zZlu+9xlt4gq6uhveFzqSwqv+u4wyQJmKFgQX0mCY= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 398316ce-20fe-43ed-1359-08d6b6be73b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2019 16:24:01.9103 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4768 Subject: Re: [dpdk-dev] [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins 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" Message-ID: <20190401162401.uzBR2vlh10-Bmus1p-H6H-_uVXxDv0Bz5pjDJtaPVss@z> >=20 > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c in= dex > 98919ec..ddab08d 100644 > --- a/app/test/test_distributor.c > +++ b/app/test/test_distributor.c > @@ -62,9 +62,14 @@ handle_work(void *arg) > struct worker_params *wp =3D arg; > struct rte_distributor *db =3D wp->dist; > unsigned int count =3D 0, num =3D 0; > - unsigned int id =3D __sync_fetch_and_add(&worker_idx, 1); > int i; >=20 > +#ifdef RTE_USE_C11_MEM_MODEL > + unsigned int id =3D __atomic_fetch_add(&worker_idx, 1, > +__ATOMIC_RELAXED); #else > + unsigned int id =3D __sync_fetch_and_add(&worker_idx, 1); #endif > + I suggest we remove the conditional compilation and just keep the __atomic_= xxx calls as this is test code. More over the distributor library does not = have a C11 version of the library (assuming that using __atomic_xxx does no= t impact performance on other platforms negatively). This applies to other = instances in this patch. > for (i =3D 0; i < 8; i++) > buf[i] =3D NULL; > num =3D rte_distributor_get_pkt(db, id, buf, buf, num); @@ -270,7 > +275,12 @@ handle_work_with_free_mbufs(void *arg) > unsigned int count =3D 0; > unsigned int i; > unsigned int num =3D 0; > + > +#ifdef RTE_USE_C11_MEM_MODEL > + unsigned int id =3D __atomic_fetch_add(&worker_idx, 1, > +__ATOMIC_RELAXED); #else > unsigned int id =3D __sync_fetch_and_add(&worker_idx, 1); > +#endif >=20 > for (i =3D 0; i < 8; i++) > buf[i] =3D NULL; > @@ -343,7 +353,13 @@ handle_work_for_shutdown_test(void *arg) > unsigned int total =3D 0; > unsigned int i; > unsigned int returned =3D 0; > + > +#ifdef RTE_USE_C11_MEM_MODEL > + const unsigned int id =3D __atomic_fetch_add(&worker_idx, 1, > + __ATOMIC_RELAXED); > +#else > const unsigned int id =3D __sync_fetch_and_add(&worker_idx, 1); > +#endif >=20 > num =3D rte_distributor_get_pkt(d, id, buf, buf, num); >=20 > diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor= _perf.c > index edf1998..9367460 100644 > --- a/app/test/test_distributor_perf.c > +++ b/app/test/test_distributor_perf.c > @@ -111,9 +111,14 @@ handle_work(void *arg) > unsigned int count =3D 0; > unsigned int num =3D 0; > int i; > - unsigned int id =3D __sync_fetch_and_add(&worker_idx, 1); > struct rte_mbuf *buf[8] __rte_cache_aligned; >=20 > +#ifdef RTE_USE_C11_MEM_MODEL > + unsigned int id =3D __atomic_fetch_add(&worker_idx, 1, > +__ATOMIC_RELAXED); #else > + unsigned int id =3D __sync_fetch_and_add(&worker_idx, 1); #endif > + > for (i =3D 0; i < 8; i++) > buf[i] =3D NULL; >=20 > -- > 2.7.4