From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0057.outbound.protection.outlook.com [104.47.1.57]) by dpdk.org (Postfix) with ESMTP id EBD1E1B62C for ; Fri, 10 Nov 2017 04:11:04 +0100 (CET) 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; bh=eUbggTibC6kA5N7iTSG1VoMkLGg3N6ZZ3OElkdVUie8=; b=De4yKe5XmpfOE9TClSulDlyRBmX8zlbKVv8W/bTuE8FyStnOV64o4wFGO5EodZ0NOrGhSPdLFVfL5g81qMagdZPp1UAcY+nAR1npXas3N2pmTZ5qyjUIq98lE+lb1i0hjouZr1txKG4qKKqE5gWSsA27uKREakwtyAXS30+PzEc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jianbo.Liu@arm.com; Received: from arm.com (113.29.88.7) by AM5PR0801MB1346.eurprd08.prod.outlook.com (2603:10a6:203:1f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Fri, 10 Nov 2017 03:11:00 +0000 Date: Fri, 10 Nov 2017 11:09:51 +0800 From: Jianbo Liu To: Jia He Cc: "Ananyev, Konstantin" , "Richardson, Bruce" , "jerin.jacob@caviumnetworks.com" , "dev@dpdk.org" , "olivier.matz@6wind.com" , "hemant.agrawal@nxp.com" , "jia.he@hxt-semitech.com" Message-ID: <20171110030950.GC27104@arm.com> References: <1510121832-16439-1-git-send-email-hejianet@gmail.com> <20171108102814.GA7552@bricha3-MOBL3.ger.corp.intel.com> <9086316b-c16b-c42b-2d85-9b01fa2f66e1@gmail.com> <028263d0-44de-bd0c-c495-081588a0ad20@gmail.com> <20171109032145.GA26939@arm.com> <20171109045601.GA27104@arm.com> <2601191342CEEE43887BDE71AB9772585FABB311@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [113.29.88.7] X-ClientProxiedBy: HK2PR04CA0063.apcprd04.prod.outlook.com (2603:1096:202:14::31) To AM5PR0801MB1346.eurprd08.prod.outlook.com (2603:10a6:203:1f::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c29a3600-244b-468c-0a35-08d527e8acf1 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603256); SRVR:AM5PR0801MB1346; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1346; 3:xxmTmRxjUdP3KSmA6ezz5KgSplblQuGCxBlpanRzRGjOCqxBzX0No9HBL9Ch4BjsQ0ncCSk665gX7ie5XBcdRjfjJ4VdGNT1qUgXQUeAbgTscpgNPLj0w6p2m4HixFqDUpruS7/xRG4n/BrBQ5qVod4TzbT34Qw6qi7WoKs2RfDmWDxVrZu4mnFaResiZxwaT1c8liZ8DkjqLa77qVNFFzsra7jr/3ZVUmShhPi03PPunxoiNZcTQNUvYQY9wKfq; 25:j+ZQijCK9PM/WcHXH+05H7xLKZXGpJEVWzqDT/4lkxZX656Mt0qd0lz/Kcui7+BdScJll/RyGmBq1onpxo8ZbGdfPWzbmLRd+3imncXYOOOEKsIilNdChN0BHcwrx8rZs8grga7zL8RazMTcJcYTLQe5LycaqHnKieOJK06DtKj/Se3kQ2Xy+oYap5UtZLYJkSNmm7W/z1IGt5wvFjyw+GbcNgg9Qs4BsK5DJk/9+9ghWA8pEHC1sZAO65877NcBj+ZJTM3Y/4K+4dDb+OwYDL2n87an2E8lYcHx3jU/tvOYAR7KaI8p5gZS34XFtom4UeTWa8Xyx5um9H09LowlHg==; 31:xFMIHpUuPjqWlQRNuC6xrDWmCG4MY7EmkLCEd9wmNnh3OU6WvKIBe8Bqd+MkqqamIaTtpuxqLz8H/uZXbmlgUa6vHv0IH0aoXZv6JUddnbappIZrB1gZmjKBQc7wlXiRLu8nL1YJCc35D1w7dr3IXhWt/R9tEIiql0EHfr5Dl70cPhvQnoJNi7VcXuKW511YxU1ay1BFMRZ/FjVLaNU7VMD3TrAEl62nDS1D+tCSYx4= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1346: Content-Transfer-Encoding: quoted-printable X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1346; 20:e5VMh74r9ob8/zFMZlnGc52LEsJFglIrFRlHAWLXInmT1cBmKMthj+ynCiJA3X/wTXRmJ1nduC/RBiaj6X9PJ44FkDiuEDAWqHkatNlKSH/ERMvBLsVyPmh+9mPilhXNPH/5LuQT5YapKBESqXewsMqi9KxWYqAhjRdJ1a0MIw4i2qKo3IZZm7ZuAiHf1k8QLhWTwIngBcEmpLeepzsQrK2Q1iqZuf4nzWxcrp7foC3cUBwNmEKBSW1W9QqDHj4XIDKQeVEbIMJ65Qn2x6xfDWmbmy+qxhgEB4iJn3kZpVs+iqLAghcV1EHZs65ZDHrBsHIz6EbmgdwW11TyTcVa9Mz39ThLaNtDIykgJhaCrXfJ5LgyTvWSlsNb6PHoDdGtZpJmdqUmCv8d95VkN/UHCmMfEshN/rTEZdmp/H0UMZLW7LyCf49+7rWfH6GmZW1o8U+idOUxXDWrAPfbOxv7W/V64iRuc90XME1dlRrBAib5Y/DDFM0UM8Pv9joim7fj; 4:T5IgtD/re/0+m2o4KGZLvH9P4cYb80a7FdUTRVHoDW2+TJW/DnPtDU3SXXu0PQqhZCx+5G4p9YL0/3wh4Qot5xT0YQxs2qmzsXqHb3YuvQXZHN8iZsLEl4s+uRLceyexDV4sdLapEMRtifkUsd1IPIllVr8PXeywxhBITarmwFtx82PCBr7uO7PGa/USAjczV4W7WuWZhB3jByDqv6qENpB9gse661R/E7zmbDt11Vi9Qj+0aDKM7amPveweuz8qVYJ7/iK1qQnkvvZNI+y56HgVwiPWyzIYVYFrsSXEi1aKndruGtGFHiwn3+CckFL3RtWiAK7XAbI46wMCXQStO2K/5BY3zjZD9KoZU40T/wilvxB7GsOHk8EFJxWvsSuR X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(185117386973197)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231021)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM5PR0801MB1346; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM5PR0801MB1346; X-Forefront-PRVS: 0487C0DB7E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(189002)(199003)(13464003)(24454002)(40434004)(1076002)(76176999)(6116002)(50986999)(3846002)(106356001)(72206003)(54356999)(58126008)(25786009)(36756003)(316002)(7736002)(33656002)(305945005)(54906003)(101416001)(478600001)(2906002)(105586002)(8746002)(50466002)(8936002)(81166006)(81156014)(68736007)(8676002)(55016002)(47776003)(39060400002)(6246003)(93886005)(53936002)(189998001)(23676003)(97736004)(66066001)(229853002)(1411001)(8656006)(6916009)(5660300001)(5890100001)(2950100002)(86362001)(16526018)(6666003)(21086003)(4326008)(83506002)(18370500001)(125773002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB1346; H:arm.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-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TNKht65KhI37FREUO/RUJNx7YNgHuRbDQ88/hSCXx0QiE3GcCA3qcL8GFWKQrhYnRTxi8oulkMwVuLZdCt59GlNVkezDvIxvpCih/A3WPfK0LKkho2ai1GpXUqzuGQ8Q2hH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2017 03:11:00.3759 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c29a3600-244b-468c-0a35-08d527e8acf1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1346 Subject: Re: [dpdk-dev] [PATCH 1/3] eal/arm64: remove the braces {} for dmb(), dsb() 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: Fri, 10 Nov 2017 03:11:05 -0000 The 11/10/2017 10:06, Jia He wrote: > > > On 11/9/2017 5:38 PM, Ananyev, Konstantin Wrote: > > > >>-----Original Message----- > >>From: Jianbo Liu [mailto:jianbo.liu@arm.com] > >>Sent: Thursday, November 9, 2017 4:56 AM > >>To: Jia He > >>Cc: Richardson, Bruce ; jerin.jacob@caviumn= etworks.com; dev@dpdk.org; olivier.matz@6wind.com; > >>Ananyev, Konstantin ; hemant.agrawal@nxp.= com; jia.he@hxt-semitech.com > >>Subject: Re: [PATCH 1/3] eal/arm64: remove the braces {} for dmb(),dsb(= ) > >> > >>The 11/09/2017 12:43, Jia He wrote: > >>>Hi Jianbo > >>> > >>> > >>>On 11/9/2017 11:21 AM, Jianbo Liu Wrote: > >>>>The 11/09/2017 11:14, Jia He wrote: > >>>>>On 11/9/2017 9:22 AM, Jia He Wrote: > >>>>>>Hi Bruce > >>>>>> > >>>>>> > >>>>>>On 11/8/2017 6:28 PM, Bruce Richardson Wrote: > >>>>>>>On Wed, Nov 08, 2017 at 06:17:10AM +0000, Jia He wrote: > >>>>>>>>for the code as follows: > >>>>>>>>if (condition) > >>>>>>>> rte_smp_rmb(); > >>>>>>>>else > >>>>>>>> rte_smp_wmb(); > >>>>>>>>Without this patch, compiler will report this error: > >>>>>>>>error: 'else' without a previous 'if' > >>>>>>>> > >>>>>>>>Signed-off-by: Jia He > >>>>>>>>Signed-off-by: jia.he@hxt-semitech.com > >>>>>>>>--- > >>>>>>>> lib/librte_eal/common/include/arch/arm/rte_atomic_64.h | 4 ++-= - > >>>>>>>> 1 file changed, 2 insertions(+), 2 deletions(-) > >>>>>>>> > >>>>>>>>diff --git > >>>>>>>>a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h > >>>>>>>>b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h > >>>>>>>>index 0b70d62..38c3393 100644 > >>>>>>>>--- a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h > >>>>>>>>+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h > >>>>>>>>@@ -43,8 +43,8 @@ extern "C" { > >>>>>>>> #include "generic/rte_atomic.h" > >>>>>>>> -#define dsb(opt) { asm volatile("dsb " #opt : : : "memory");= } > >>>>>>>>-#define dmb(opt) { asm volatile("dmb " #opt : : : "memory"); } > >>>>>>>>+#define dsb(opt) asm volatile("dsb " #opt : : : "memory"); > >>>>>>>>+#define dmb(opt) asm volatile("dmb " #opt : : : "memory"); > >>>>>>>Need to remove the trailing ";" I too I think. > >>>>>>>Alternatively, to keep the braces, the standard practice is to use > >>>>>>>do { ... } while(0) > >>>>>>If trailing ";" is not removed > >>>>>>the code: > >>>>>>if (condition) > >>>>>> rte_smp_rmb(); > >>>>>>else > >>>>>> anything(); > >>>>>> > >>>>Sorry, why not use two different functions as your conditions passed = in > >>>>are fixed in the calling functions. > >>>Do you mean to split update_tail() into update_tail_enqueue() and > >>>update_tail_dequeue()? > >>Yes. So it's not need to change dsb/dmb. > >That's a good idea - but you still might hit the same problem in > >Some different place in future... > >Why not to convert these macros into 'always_inline' functions then? > >Konstantin > > > It makes things more complex > opt needs to be redefined with types > such as : __attribute__((always_inline)) void dsb( char* opt) > and the input paramenter shoud be > #define sy "sy" > #define ld "ld" > > And the "#" in asm codes needs to be considerred more. > > IMO, the kernel way is simple and clean, isn't it? > #define dmb(opt) asm volatile("dmb " #opt : : : "memory") > Another choice is adding the do/while. > > @Ananyev @Jianbo > Any thoughts? > I think it's a good to keep your v4. Jianbo IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.