From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 2422A2C30 for ; Fri, 3 Jun 2016 10:16:37 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id a20so96086334wma.1 for ; Fri, 03 Jun 2016 01:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=dCBwVQtcVex8qFBjLPFM8qVh995FmKBzmzeDMAyficA=; b=LPZ+vz1sgDm2vQCiRZrvFOhLK7hbPw3dJ5TiFq1DDbLqJcdEb/odXPr5sRZ4V+TDhK CIeK9kQjU4DRyDGJmHJWjP1QltZ3m5n4pKzX0RLNRk4muGN54xwVAZJ5TDlW/tBEeK/J pOeAtMqQghRcBABeyb56l3+oYYujgRISVg19WJQfFxukUujpS+I+phyg8WJcqmxZEiic 84jWQzg8b50dMFZjmUtl2339ESqNLCmNL6UjcNfNDCUMOGH6a3gkdj1RICjWYoEqGq9Y pGROopDhGxZrsF5BXipv4j6B3auK+hyfSphXBE0Wi2xV+OzvWMZ2Z/B+vpkSZ83DrQLn BXZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=dCBwVQtcVex8qFBjLPFM8qVh995FmKBzmzeDMAyficA=; b=Y7QZePOwbQk+gsoll0FvGB0xHiL5KtGtyrsEvb0yqy6Cs5AmGgveWyWfY4lYeS1eCw abCVx2aFMftgUeor23d8Q0XX1kwzXY5b9bWkuwkJnkoSvwlQc/b5spgB/xe5nmW07Zkm RRNOIrGRMJiFOlODTWmPXlPRLZ9Er9RQMBgyQSaUEVcSuD2Pb+Z9+l6atXnI3ea6LZRH 0Y37Z/WMr37uIRCxEoMe9XlzH5MovrhDaCPR55NTcWmQvwyZuorp5foPSGFX2WbviGII VSdXkCG0doafNKXHTUy4zXNY1gtUOJQ+fXPd9idJ/8GqYqMCtZMejX41PRlpcaZ2a0LP exvg== X-Gm-Message-State: ALyK8tI9WxxpId+wM/VnPDwHyQQPTvoZX6YzZwKVNdAOTanP5plcG54JVn7mFbFphh5lh5KO X-Received: by 10.28.168.71 with SMTP id r68mr29242865wme.44.1464941796831; Fri, 03 Jun 2016 01:16:36 -0700 (PDT) Received: from [137.194.56.56] (eduroam-0-56.enst.fr. [137.194.56.56]) by smtp.gmail.com with ESMTPSA id db6sm4470727wjb.2.2016.06.03.01.16.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Jun 2016 01:16:36 -0700 (PDT) To: Thomas Monjalon , dev@dpdk.org References: <1464941723-18154-1-git-send-email-thomas.monjalon@6wind.com> Cc: Damjan Marion From: Olivier MATZ Message-ID: <57513CE3.60506@6wind.com> Date: Fri, 3 Jun 2016 10:16:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1464941723-18154-1-git-send-email-thomas.monjalon@6wind.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] eal/x86: fix clang build with -O0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2016 08:16:37 -0000 Hi Thomas, On 06/03/2016 10:15 AM, Thomas Monjalon wrote: > From: Damjan Marion > > Clang seems to have a bug with asm inside inline function rte_xabort(): > > rte_rtm.h:56:15: error: invalid operand for inline asm constraint 'i' > asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); > ^ > > It is seen only when building with EXTRA_CFLAGS=-O0. > > The workaround is to replace the inline function by a macro. > > Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86") > > Signed-off-by: Damjan Marion > Signed-off-by: Thomas Monjalon > --- > lib/librte_eal/common/include/arch/x86/rte_rtm.h | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_eal/common/include/arch/x86/rte_rtm.h b/lib/librte_eal/common/include/arch/x86/rte_rtm.h > index d935641..0649f79 100644 > --- a/lib/librte_eal/common/include/arch/x86/rte_rtm.h > +++ b/lib/librte_eal/common/include/arch/x86/rte_rtm.h > @@ -50,11 +50,10 @@ void rte_xend(void) > asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); > } > > -static __attribute__((__always_inline__)) inline > -void rte_xabort(const unsigned int status) > -{ > - asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); > -} > +/* not an inline function to workaround a clang bug with -O0 */ > +#define rte_xabort(status) do { \ > + asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ > +} while (0) > > static __attribute__((__always_inline__)) inline > int rte_xtest(void) > Generally speaking, it's not a good idea to replace a static inline by a macro because it relaxes type checking. Looks ok in that case to workaround the clang issue. Acked-by: Olivier Matz