From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal/arm64: fix memory barrier macros Date: Tue, 16 Jan 2018 01:21:28 +0100 Message-ID: <5787318.2SUBePpODR@xps> References: <20180115235934.16054-1-thomas@monjalon.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: jerin.jacob@caviumnetworks.com, jia.he@hxt-semitech.com To: dev@dpdk.org Return-path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 8277B2A63 for ; Tue, 16 Jan 2018 01:22:00 +0100 (CET) In-Reply-To: <20180115235934.16054-1-thomas@monjalon.net> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 16/01/2018 00:59, Thomas Monjalon: > The macros dsb and dmb are defined as an instruction block with braces. > As a consequence, when it is used in if/else without brace: > if (cond) > rte_mb(); > else > statement; > the added semicolon is parsed outside of if/else, > so the "else" cannot match the "if": > if (cond) { > asm volatile("dsb sy" : : : "memory"); > } > ; > else > statement > > The solution is either to use the "do { } while (0)" construct, > or simply remove the braces because there is only one statement. > > Fixes: 84733fd0d75e ("eal/arm64: fix memory barrier definition") Just seen there is already a patch doing the same thing by Jia He: https://dpdk.org/patch/31896 This patch is in a series waiting for required changes.