From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50044.outbound.protection.outlook.com [40.107.5.44]) by dpdk.org (Postfix) with ESMTP id 8BBFF4C8F for ; Tue, 2 Apr 2019 05:43:15 +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=tAoY6WI7kknV92x4zgA63D/YlmwbmzcPd5QgocKkbWI=; b=SmJjd8+ZbH47RixN9kywxDxDB1UszeAnljhOq2A7AoauZhW5y0aKq/QAKTZrGs1jGPMVP2PsOUSa3VX59JfcVx8XX26bqiNvbObnyti4+AgP3k2l/TWAa/2whFkNK60VlSy9hLcNK2KOdIYzddHZGIr0ki77xY0D6TSxmaZPFWU= Received: from DB7PR08MB3385.eurprd08.prod.outlook.com (20.176.238.90) by DB7PR08MB3275.eurprd08.prod.outlook.com (52.134.111.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Tue, 2 Apr 2019 03:43:14 +0000 Received: from DB7PR08MB3385.eurprd08.prod.outlook.com ([fe80::54da:2a4f:adc2:63fe]) by DB7PR08MB3385.eurprd08.prod.outlook.com ([fe80::54da:2a4f:adc2:63fe%5]) with mapi id 15.20.1750.017; Tue, 2 Apr 2019 03:43:14 +0000 From: "Phil Yang (Arm Technology China)" To: Honnappa Nagarahalli , "dev@dpdk.org" , "thomas@monjalon.net" CC: "david.hunt@intel.com" , "reshma.pattan@intel.com" , "Gavin Hu (Arm Technology China)" , nd , nd , nd Thread-Topic: [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins Thread-Index: AQHU5h4gfmXaZyG7Ok6jWleW+YEeGaYngmSAgAC7j4A= Date: Tue, 2 Apr 2019 03:43:14 +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: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Phil.Yang@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 933731af-4590-448c-be4d-08d6b71d55f1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DB7PR08MB3275; x-ms-traffictypediagnostic: DB7PR08MB3275: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0995196AA2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39860400002)(396003)(136003)(199004)(189003)(13464003)(6246003)(6436002)(110136005)(25786009)(106356001)(81156014)(105586002)(476003)(2906002)(54906003)(53936002)(26005)(81166006)(52536014)(186003)(486006)(53546011)(8676002)(74316002)(102836004)(68736007)(446003)(6506007)(99286004)(76176011)(11346002)(8936002)(316002)(33656002)(5660300002)(4326008)(14454004)(3846002)(55236004)(66066001)(72206003)(55016002)(256004)(2201001)(478600001)(7736002)(9686003)(7696005)(2501003)(229853002)(71190400001)(71200400001)(97736004)(305945005)(86362001)(6116002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3275; H:DB7PR08MB3385.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: QaMaG3kKd5Uiq2xITJzTbS1nRqO2mpKsinNptHo1d9XExqMr5BdGLdz3MDbzMPdNjZlGlpBi/OJ4qu/8zLoJVjnuNM5nE8BHslIxmD2tJOeXE2kr3wVMwTqgdt3fe+CRM2Nl+gnAxQG0rF5YYzJbYq6ciq5xlA7nF21m8rr+ndp+OPOkJ91rwovj5R1APhTDLpDUdtaPyHPd4pkB3LMcQfWFbPjyqZAhhV6mZ3E2A9pQxslGNb6DEdeDfC2XW7EJlxF2c+b3gw6Z+npwdhH5rqHM+sQF20Ng5gDgiPAaAZ2b1cUXDh4YHZiozwXCbwp9LJKfUAX4ySoA9WEuM5UcT0hZ9acjXKpxu3sbYeEwNLvy/Y5EHB/H8qiH/QSrgXRiyfC47yonBM5efj0SfPiNgemTf99A/iv69O3FAHrfclU= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 933731af-4590-448c-be4d-08d6b71d55f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Apr 2019 03:43:14.2333 (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: DB7PR08MB3275 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: , X-List-Received-Date: Tue, 02 Apr 2019 03:43:15 -0000 > -----Original Message----- > From: Honnappa Nagarahalli > Sent: Tuesday, April 2, 2019 12:24 AM > 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 > Subject: RE: [PATCH v2 2/3] test/distributor: replace sync builtins with = atomic > builtins >=20 > > > > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c > > index 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; > > > > +#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 librar= y does > not have a C11 version of the library (assuming that using __atomic_xxx d= oes > not impact performance on other platforms negatively). This applies to ot= her > instances in this patch. Hi Honnappa, Thanks for your comments. Agree. I don't think __atomic_xxx will cause performance degradation on oth= er platforms. Remove the conditional compilation will make the code more c= lear. Thanks, Phil Yang >=20 > > 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 > > > > 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 > > > > num =3D rte_distributor_get_pkt(d, id, buf, buf, num); > > > > 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; > > > > +#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; > > > > -- > > 2.7.4 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 F1CDDA0679 for ; Tue, 2 Apr 2019 05:43:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4209A4F93; Tue, 2 Apr 2019 05:43:17 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50044.outbound.protection.outlook.com [40.107.5.44]) by dpdk.org (Postfix) with ESMTP id 8BBFF4C8F for ; Tue, 2 Apr 2019 05:43:15 +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=tAoY6WI7kknV92x4zgA63D/YlmwbmzcPd5QgocKkbWI=; b=SmJjd8+ZbH47RixN9kywxDxDB1UszeAnljhOq2A7AoauZhW5y0aKq/QAKTZrGs1jGPMVP2PsOUSa3VX59JfcVx8XX26bqiNvbObnyti4+AgP3k2l/TWAa/2whFkNK60VlSy9hLcNK2KOdIYzddHZGIr0ki77xY0D6TSxmaZPFWU= Received: from DB7PR08MB3385.eurprd08.prod.outlook.com (20.176.238.90) by DB7PR08MB3275.eurprd08.prod.outlook.com (52.134.111.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Tue, 2 Apr 2019 03:43:14 +0000 Received: from DB7PR08MB3385.eurprd08.prod.outlook.com ([fe80::54da:2a4f:adc2:63fe]) by DB7PR08MB3385.eurprd08.prod.outlook.com ([fe80::54da:2a4f:adc2:63fe%5]) with mapi id 15.20.1750.017; Tue, 2 Apr 2019 03:43:14 +0000 From: "Phil Yang (Arm Technology China)" To: Honnappa Nagarahalli , "dev@dpdk.org" , "thomas@monjalon.net" CC: "david.hunt@intel.com" , "reshma.pattan@intel.com" , "Gavin Hu (Arm Technology China)" , nd , nd , nd Thread-Topic: [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins Thread-Index: AQHU5h4gfmXaZyG7Ok6jWleW+YEeGaYngmSAgAC7j4A= Date: Tue, 2 Apr 2019 03:43:14 +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: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Phil.Yang@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 933731af-4590-448c-be4d-08d6b71d55f1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DB7PR08MB3275; x-ms-traffictypediagnostic: DB7PR08MB3275: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0995196AA2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39860400002)(396003)(136003)(199004)(189003)(13464003)(6246003)(6436002)(110136005)(25786009)(106356001)(81156014)(105586002)(476003)(2906002)(54906003)(53936002)(26005)(81166006)(52536014)(186003)(486006)(53546011)(8676002)(74316002)(102836004)(68736007)(446003)(6506007)(99286004)(76176011)(11346002)(8936002)(316002)(33656002)(5660300002)(4326008)(14454004)(3846002)(55236004)(66066001)(72206003)(55016002)(256004)(2201001)(478600001)(7736002)(9686003)(7696005)(2501003)(229853002)(71190400001)(71200400001)(97736004)(305945005)(86362001)(6116002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3275; H:DB7PR08MB3385.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: QaMaG3kKd5Uiq2xITJzTbS1nRqO2mpKsinNptHo1d9XExqMr5BdGLdz3MDbzMPdNjZlGlpBi/OJ4qu/8zLoJVjnuNM5nE8BHslIxmD2tJOeXE2kr3wVMwTqgdt3fe+CRM2Nl+gnAxQG0rF5YYzJbYq6ciq5xlA7nF21m8rr+ndp+OPOkJ91rwovj5R1APhTDLpDUdtaPyHPd4pkB3LMcQfWFbPjyqZAhhV6mZ3E2A9pQxslGNb6DEdeDfC2XW7EJlxF2c+b3gw6Z+npwdhH5rqHM+sQF20Ng5gDgiPAaAZ2b1cUXDh4YHZiozwXCbwp9LJKfUAX4ySoA9WEuM5UcT0hZ9acjXKpxu3sbYeEwNLvy/Y5EHB/H8qiH/QSrgXRiyfC47yonBM5efj0SfPiNgemTf99A/iv69O3FAHrfclU= 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: 933731af-4590-448c-be4d-08d6b71d55f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Apr 2019 03:43:14.2333 (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: DB7PR08MB3275 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: <20190402034314.wvPyW71SxtH4uKQxNXpUjQPYIiMUF8zKc1gfh8roE3Q@z> > -----Original Message----- > From: Honnappa Nagarahalli > Sent: Tuesday, April 2, 2019 12:24 AM > 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 > Subject: RE: [PATCH v2 2/3] test/distributor: replace sync builtins with = atomic > builtins >=20 > > > > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c > > index 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; > > > > +#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 librar= y does > not have a C11 version of the library (assuming that using __atomic_xxx d= oes > not impact performance on other platforms negatively). This applies to ot= her > instances in this patch. Hi Honnappa, Thanks for your comments. Agree. I don't think __atomic_xxx will cause performance degradation on oth= er platforms. Remove the conditional compilation will make the code more c= lear. Thanks, Phil Yang >=20 > > 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 > > > > 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 > > > > num =3D rte_distributor_get_pkt(d, id, buf, buf, num); > > > > 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; > > > > +#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; > > > > -- > > 2.7.4