From patchwork Wed Mar 26 13:38:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 27121 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F3B2A20062 for ; Wed, 26 Mar 2014 13:40:13 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id cz12sf4585940veb.6 for ; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=fNgiNvL3M9EUZwEJU7UXy3UwG4bn84L9rB6pKxST5kg=; b=GCRAE5p2ncC6u3B2CcrGpvNizQcjOUu4Yf9iK2Xo2qkqqWb/g14zcnKv6kDescnH1J fP3VJaAoGIMaqosWphKacXhfpmYlgNLsjtD2uAdqtEJxWulsdjJ4hQPJmdOvsa0y0q1v NN+8m4gv8wq1gzJggyR2l2Q5eJcCsqVkX9nRn74Q/8SWEB40mIK6o9WRz7gR7Mh0D2il dBNqVkJ6pU+dWmJQ+QKKP70Gf1rUj1gvUvjFspsqb1b80lJs7PakFr3Qq/Trcxulzu1D YbX6BkRJ7xsSqce9s6ZmYglSWZLRHpUvfr0eT5i+//lb0DotUp0US1aeVBtvmrsCNfEi 91mQ== X-Gm-Message-State: ALoCoQmYv5EhBt3OiPwb1bJC1ndNa0vH7k55PhmJ1ZgiQ9lWjq7DSJHXxo4+cRqo+3uqZn7oN/cJ X-Received: by 10.58.151.212 with SMTP id us20mr20321150veb.14.1395841213788; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.137 with SMTP id s9ls685529qge.57.gmail; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) X-Received: by 10.58.1.97 with SMTP id 1mr11792143vel.23.1395841213710; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id wy9si3294099vdc.163.2014.03.26.06.40.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 06:40:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so2291194veb.36 for ; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr32353402vcb.2.1395841213622; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp47065vck; Wed, 26 Mar 2014 06:40:13 -0700 (PDT) X-Received: by 10.224.160.142 with SMTP id n14mr91142948qax.17.1395841212904; Wed, 26 Mar 2014 06:40:12 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id v9si8797807qar.151.2014.03.26.06.40.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Mar 2014 06:40:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSo2k-0004N5-FQ; Wed, 26 Mar 2014 13:38:58 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSo2i-0004KY-1g for xen-devel@lists.xen.org; Wed, 26 Mar 2014 13:38:56 +0000 Received: from [85.158.137.68:14835] by server-3.bemta-3.messagelabs.com id 73/18-05289-F68D2335; Wed, 26 Mar 2014 13:38:55 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1395841128!1838933!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22496 invoked from network); 26 Mar 2014 13:38:54 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Mar 2014 13:38:54 -0000 X-IronPort-AV: E=Sophos;i="4.97,735,1389744000"; d="scan'208";a="113732828" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 26 Mar 2014 13:38:53 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Wed, 26 Mar 2014 09:38:53 -0400 Received: from drall.uk.xensource.com ([10.80.16.71] helo=drall.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WSo2f-00074X-7n; Wed, 26 Mar 2014 13:38:53 +0000 From: Ian Campbell To: Date: Wed, 26 Mar 2014 13:38:38 +0000 Message-ID: <1395841133-2223-3-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395841009.12547.11.camel@kazak.uk.xensource.com> References: <1395841009.12547.11.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v2 03/17] xen: arm32: ensure cmpxchg has full barrier semantics X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Unrelated reads/writes should not pass the xchg. Provide cmpxchg_local for parity with arm64, although it appears to be unused. It also helps make the reason for the separation of __cmpxchg_mb more apparent. With this our cmpxchg is in sync with Linux v3.14-rc7. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- We got our cmpxchg implementation from Linux which AFAICS has always had these additional barriers. I don't recall us having decided that Xen barriers should not have this property as well, and if we did we were remiss in not adding a comment etc... If my memory is faulty then I am happy to replace thispatch with one which adds a comment instead. --- xen/include/asm-arm/arm32/system.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/asm-arm/arm32/system.h index 9f233fe..dfaa3b6 100644 --- a/xen/include/asm-arm/arm32/system.h +++ b/xen/include/asm-arm/arm32/system.h @@ -113,9 +113,29 @@ static always_inline unsigned long __cmpxchg( return oldval; } -#define cmpxchg(ptr,o,n) \ - ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \ - (unsigned long)(n),sizeof(*(ptr)))) +static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old, + unsigned long new, int size) +{ + unsigned long ret; + + smp_mb(); + ret = __cmpxchg(ptr, old, new, size); + smp_mb(); + + return ret; +} + +#define cmpxchg(ptr,o,n) \ + ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n), \ + sizeof(*(ptr)))) + +#define cmpxchg_local(ptr,o,n) \ + ((__typeof__(*(ptr)))__cmpxchg((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n), \ + sizeof(*(ptr)))) #define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : : "cc" ) #define local_irq_enable() asm volatile ( "cpsie i @ local_irq_enable\n" : : : "cc" )