From patchwork Thu Nov 20 11:53:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 41234 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 33F4423C27 for ; Thu, 20 Nov 2014 11:54:36 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf1931979wid.11 for ; Thu, 20 Nov 2014 03:54:35 -0800 (PST) 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:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=1OAk+oul5mIN/8BKc+5KebQUxvLcR9ub8DMnXLh7XRE=; b=Dmp+xHFd2Te68eNqv3duY+fEj3nE37d9RS0nUL3Nk3dVky7OX/G3/9gorOH20E7tm5 FreCpr6DXZCMCP4aILrZfbxJgNm2vzhh0PMlDu3fEkPFAk9I2uqMUFKGeBDTJAxjWbhO NmgLslKf9o6ciLS/MUU3rRA/80IBayyRi0u9aNnGzJ4iMm+45YrOcWIJVIifVGlj+LS+ 7g64Ltn8RP+gwo95zg/tgkUGeCxaXlyvWAFyZmikhT/HixsqJ2XJztP3sZEWEymfqgIY 44p4abX42ndYvrk4uSyWqd1V/TyZ/72afCE7CjqJcsAxb28Q8Zgs6EOe+U/ASkCIhpTj f/kA== X-Gm-Message-State: ALoCoQl74hSdH52sMI6YnK7uft6Q7iTDqUY+ZyNPOtjk0oLEkli91voXemwzsZTL2d72bTgAnRKU X-Received: by 10.112.55.10 with SMTP id n10mr965999lbp.14.1416484475428; Thu, 20 Nov 2014 03:54:35 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.202 with SMTP id ks10ls52155lac.72.gmail; Thu, 20 Nov 2014 03:54:35 -0800 (PST) X-Received: by 10.152.28.193 with SMTP id d1mr5825763lah.17.1416484475152; Thu, 20 Nov 2014 03:54:35 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id bn10si1916154lbc.108.2014.11.20.03.54.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 03:54:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id q1so2307533lam.30 for ; Thu, 20 Nov 2014 03:54:35 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr10896404lab.40.1416484475081; Thu, 20 Nov 2014 03:54:35 -0800 (PST) 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.112.184.201 with SMTP id ew9csp246793lbc; Thu, 20 Nov 2014 03:54:34 -0800 (PST) X-Received: by 10.140.94.233 with SMTP id g96mr38145631qge.77.1416484473530; Thu, 20 Nov 2014 03:54:33 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id o51si2424479qge.76.2014.11.20.03.54.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Nov 2014 03:54:33 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XrQJj-00018U-HN; Thu, 20 Nov 2014 11:54:31 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XrQJR-000155-Rg for lng-odp@lists.linaro.org; Thu, 20 Nov 2014 11:54:13 +0000 Received: by mail-lb0-f173.google.com with SMTP id n15so2141834lbi.18 for ; Thu, 20 Nov 2014 03:54:08 -0800 (PST) X-Received: by 10.112.42.198 with SMTP id q6mr10792868lbl.69.1416484448315; Thu, 20 Nov 2014 03:54:08 -0800 (PST) Received: from macmini.lan (84-217-193-77.tn.glocalnet.net. [84.217.193.77]) by mx.google.com with ESMTPSA id bb3sm534566lab.7.2014.11.20.03.54.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Nov 2014 03:54:07 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Thu, 20 Nov 2014 12:53:45 +0100 Message-Id: <1416484428-23849-5-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416484428-23849-1-git-send-email-ola.liljedahl@linaro.org> References: <1416484428-23849-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 4/7] linux-generic: odp_ticketlock.c: use odp_atomic.h and __atomic (tmp), added missing barrier X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ola.liljedahl@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) 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 Signed-off-by: Ola Liljedahl --- platform/linux-generic/odp_ticketlock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c index be5b885..dc6ff83 100644 --- a/platform/linux-generic/odp_ticketlock.c +++ b/platform/linux-generic/odp_ticketlock.c @@ -12,9 +12,8 @@ void odp_ticketlock_init(odp_ticketlock_t *ticketlock) { - ticketlock->next_ticket = 0; + odp_atomic_init_u32(&ticketlock->next_ticket, 0); ticketlock->cur_ticket = 0; - odp_sync_stores(); } @@ -27,7 +26,7 @@ void odp_ticketlock_lock(odp_ticketlock_t *ticketlock) while (ticket != ticketlock->cur_ticket) odp_spin(); - odp_mem_barrier(); + __atomic_thread_fence(__ATOMIC_ACQUIRE); } @@ -38,14 +37,15 @@ void odp_ticketlock_unlock(odp_ticketlock_t *ticketlock) ticketlock->cur_ticket++; #if defined __OCTEON__ - odp_sync_stores(); + odp_sync_stores(); /* Possibly SYNCW instead of SYNC */ #else - odp_mem_barrier(); + __atomic_thread_fence(__ATOMIC_RELEASE); #endif } int odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock) { - return ticketlock->cur_ticket != ticketlock->next_ticket; + return ticketlock->cur_ticket != + odp_atomic_load_u32(&ticketlock->next_ticket); }