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 9C36EA0487 for ; Mon, 1 Jul 2019 11:59:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B92A2C38; Mon, 1 Jul 2019 11:59:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 5D9A72BC8 for ; Mon, 1 Jul 2019 11:59:01 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x619tojV005258; Mon, 1 Jul 2019 02:58:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=di7ZASIPNYlNqH+JoVysGB3LaPYOWlLCyNkHfkiWfXc=; b=eFQ6/BnRiQPQ63F99vwBem/cY2YLhFP7g85UlmQ/cIXOhoJ30CuoZE/KJZa8VsVplRTf gmmlh8fbgVqiM8r1Od1bKfJZFb/l8gCHSXJTfPGpeHNtu/ReTQboMOzz4d0FchJ4cT2h OIHhWslLw8G0NHd4Tm23+Wta+ylInB0+a/kuaRm25TTcKOQevZsa7JpWrnBabbe88dYa MF1axHLV9mfBQeEkZ0eBmJecln6GkT5uof5qBdacdduVatsxY+Y705Hpw5e4vWRmHxDs Qc14zTPXmNvwspt5hy29/McHC84LiaetITOY7BxKjkv1B5vR6yAFicBQnP6KzKUjocXk dg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2tff8284qq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 01 Jul 2019 02:58:47 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 1 Jul 2019 02:58:46 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (104.47.34.55) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 1 Jul 2019 02:58:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=di7ZASIPNYlNqH+JoVysGB3LaPYOWlLCyNkHfkiWfXc=; b=cOdX3TIMfHxkVZVxmB2qG+SS9YKw6K8igQRVlQ6EwPbXuPRu/f7i0HZi0wEG37kppljsN5IIKzT7vA7O1REP7PAcQ4k3NpI8NC9fyRCuLlgeSsFvheekXJ5zIWQZZfAN8A92h+PrukmgFYv12I9AoNh/dHgmRcqUXvDVm7/Oiy0= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1813.namprd18.prod.outlook.com (10.165.88.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.18; Mon, 1 Jul 2019 09:58:44 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::1859:6ecd:9898:f96c]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::1859:6ecd:9898:f96c%7]) with mapi id 15.20.2032.019; Mon, 1 Jul 2019 09:58:44 +0000 From: Pavan Nikhilesh Bhagavatula To: Gavin Hu , "dev@dpdk.org" CC: "thomas@monjalon.net" , Jerin Jacob Kollanukkaran , "hemant.agrawal@nxp.com" , "bruce.richardson@intel.com" , "chaozhu@linux.vnet.ibm.com" , "Honnappa.Nagarahalli@arm.com" , "nd@arm.com" Thread-Topic: [dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal Thread-Index: AQHVL1/yKyWqUGf+Rkectdm7+AOs9qa1hHGQ Date: Mon, 1 Jul 2019 09:58:44 +0000 Message-ID: References: <1561911676-37718-1-git-send-email-gavin.hu@arm.com> <1561911676-37718-2-git-send-email-gavin.hu@arm.com> In-Reply-To: <1561911676-37718-2-git-send-email-gavin.hu@arm.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.140.231.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0e372755-04ad-4059-f3c6-08d6fe0ab443 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:CY4PR1801MB1813; x-ms-traffictypediagnostic: CY4PR1801MB1813: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 00851CA28B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(396003)(136003)(346002)(39850400004)(13464003)(199004)(189003)(305945005)(66066001)(7736002)(316002)(33656002)(54906003)(66946007)(8936002)(55016002)(64756008)(66556008)(66476007)(76116006)(73956011)(2906002)(4326008)(74316002)(76176011)(486006)(66446008)(68736007)(8676002)(25786009)(446003)(256004)(110136005)(11346002)(6436002)(476003)(71200400001)(71190400001)(6116002)(3846002)(81156014)(81166006)(55236004)(7696005)(99286004)(14454004)(2501003)(86362001)(229853002)(478600001)(5660300002)(102836004)(53936002)(6246003)(9686003)(6506007)(186003)(26005)(52536014)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1813; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Kle/BRjUBgrmkehisSMFCt7YTYePs9Xa4vUi2C8j/ROCEpUa38xHdAGZftY73aZIIeiyrX7gc5j7deZbjR8GQC+fJS6SwTmyaq80Foa4sJkZ2SRBfRSwjBRYYDdtS+axKB3PaDjOEQObIHP6Kh5zGcVXafHJNWFTEJDq90Z7/9/9N1pfKkZcftWG4KRzR4o6KbfTD2ZHH3xE+nK0W761I1S5/xerxKQMFAoMutae19yD9E6+YHns/X/9wRqDop7W993Dn30PsxvawoZGs+51Hdj1itpBMvPTNemRBQQot9KyuxxH3SxhxleT4k5EAMBMRxpbMxQpVeZvj44EUB6GEASnukNgERHKBcyBqQw1ZLPTQLy2pqTT3wyPTr/wZ6Yb0iKJct7j+mRtArBKao8RxDSimOsclbQ1rrba+Iv+Rbo= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0e372755-04ad-4059-f3c6-08d6fe0ab443 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2019 09:58:44.4765 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pbhagavatula@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1813 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-01_08:, , signatures=0 Subject: Re: [dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal 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 Gavin, >-----Original Message----- >From: dev On Behalf Of Gavin Hu >Sent: Sunday, June 30, 2019 9:51 PM >To: dev@dpdk.org >Cc: thomas@monjalon.net; Jerin Jacob Kollanukkaran >; hemant.agrawal@nxp.com; >bruce.richardson@intel.com; chaozhu@linux.vnet.ibm.com; >Honnappa.Nagarahalli@arm.com; nd@arm.com; gavin.hu@arm.com >Subject: [dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal > >The rte_wait_until_equal_xxx APIs abstract the functionality of 'polling >for a memory location to become equal to a given value'. > >Signed-off-by: Gavin Hu >Reviewed-by: Ruifeng Wang >Reviewed-by: Steve Capper >Reviewed-by: Ola Liljedahl >Reviewed-by: Honnappa Nagarahalli >--- > .../common/include/arch/arm/rte_pause_64.h | 143 >+++++++++++++++++++++ > lib/librte_eal/common/include/generic/rte_pause.h | 20 +++ > 2 files changed, 163 insertions(+) > >diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h >b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h >index 93895d3..0095da6 100644 >--- a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h >+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h >@@ -17,6 +17,149 @@ static inline void rte_pause(void) > asm volatile("yield" ::: "memory"); > } > >+#ifdef RTE_USE_WFE >+#define rte_wait_until_equal_relaxed(addr, expected) do {\ >+ typeof(*addr) tmp; \ >+ if (__builtin_constant_p((expected))) \ >+ do { \ >+ if (sizeof(*(addr)) =3D=3D 16)\ >+ asm volatile( \ >+ "sevl\n" \ >+ "1: wfe\n" \ >+ "ldxrh %w0, %1\n" \ >+ "cmp %w0, %w2\n" \ >+ "bne 1b\n" \ >+ : "=3D&r"(tmp) \ >+ : "Q"(*addr), >"i"(expected) \ >+ : "cc", "memory"); \ Can we have early exit here i.e. instead of going directly to wfe can we fi= rst check the condition and then fallthrough? Something like: asm volatile(" ldxrh %w0 %1 \n" " cmp %w0 %w2 \n" " b.eq 2: \n" "1: wfe \n" " ldxrh %w0, %1 \n" =20 " cmp %w0, %w2 \n" =20 " b.ne 1b \n" =20 "2: \n" :::); Regards, Pavan.