From patchwork Thu Mar 20 15:45:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 26724 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 85AF220143 for ; Thu, 20 Mar 2014 15:48:13 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id gq1sf4017073obb.3 for ; Thu, 20 Mar 2014 08:48: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=74BQDAmrL6ZT4fZDE+p7NkfcTk8N3LbegJO+/UGLrU8=; b=X4Y1ROiqfLakhCFWH8I5HYR2E1S3wEz0HBilYPugqaDYLW6nzdrnur4StDSgQMnXaY CDpJfN5wrli0NrbnrqnyNsuhbWFvN2z0txLik/7RpItHBV/kJsi5f8rJiggsjhf6Fads QuVMLSMZ8JBt6FxGLdIy3Lk9eBQOnaT6vL068EU4TcsLYNez1DhRHgMZz7yuwdKPSVRS xKCBa3rMWriBO8DPKlp0qzEnvA5Fyn8j0VqJcWY1myAYV4MSiFtY4x/hBv5iBIJSXz73 7O+r4wBRNmloLOzCouWlJjcHWzJbKSBQLXGtOV1JV6x6ctkwl5zgtgNd2Qttw/luH+4o l9GA== X-Gm-Message-State: ALoCoQkf6kukMpTm6KKPoC1HZTnFTq9vUVCC71/uXfTEzVLQ4lChfsN6P5o5B6dJCXs3n4nWI8Im X-Received: by 10.182.213.5 with SMTP id no5mr3841925obc.15.1395330493085; Thu, 20 Mar 2014 08:48:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.73 with SMTP id 67ls261876qga.18.gmail; Thu, 20 Mar 2014 08:48:13 -0700 (PDT) X-Received: by 10.52.137.74 with SMTP id qg10mr757340vdb.61.1395330492940; Thu, 20 Mar 2014 08:48:12 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id ug9si511181vcb.32.2014.03.20.08.48.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 08:48:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.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.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so1146062vcb.8 for ; Thu, 20 Mar 2014 08:48:12 -0700 (PDT) X-Received: by 10.52.250.236 with SMTP id zf12mr29387867vdc.9.1395330492865; Thu, 20 Mar 2014 08:48:12 -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 i9csp398593vck; Thu, 20 Mar 2014 08:48:12 -0700 (PDT) X-Received: by 10.224.168.203 with SMTP id v11mr51471149qay.57.1395330492459; Thu, 20 Mar 2014 08:48:12 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id c8si958806qco.39.2014.03.20.08.48.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Mar 2014 08:48: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 1WQfAb-0004Am-QP; Thu, 20 Mar 2014 15:46:13 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQfAa-0004A2-Hg for xen-devel@lists.xen.org; Thu, 20 Mar 2014 15:46:12 +0000 Received: from [85.158.143.35:17019] by server-1.bemta-4.messagelabs.com id 45/DD-09853-34D0B235; Thu, 20 Mar 2014 15:46:11 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1395330368!3603483!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 25789 invoked from network); 20 Mar 2014 15:46:11 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 20 Mar 2014 15:46:11 -0000 X-IronPort-AV: E=Sophos;i="4.97,695,1389744000"; d="scan'208";a="111935190" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 20 Mar 2014 15:46:07 +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; Thu, 20 Mar 2014 11:46:06 -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 1WQfAT-0006O2-Sn; Thu, 20 Mar 2014 15:46:05 +0000 From: Ian Campbell To: Date: Thu, 20 Mar 2014 15:45:51 +0000 Message-ID: <1395330365-9901-3-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395330336.3104.12.camel@kazak.uk.xensource.com> References: <1395330336.3104.12.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 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.220.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" )