From patchwork Mon Nov 24 22:38:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 41441 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9BCC525E18 for ; Mon, 24 Nov 2014 22:39:48 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id s18sf5954137lam.6 for ; Mon, 24 Nov 2014 14:39:47 -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=rcXhusdRQQU5+GQ70Jv1Tmr58p/FZPczCRZIKp7A6xc=; b=cjdN1Nv7Q7Lytxke1yofMGSrTtXGARTPI8Tjp0ubriUGE0yEJwLEqTgc2L5t0+Q4ky nJJqZXg92Ke0JRrkKYjmAnzSr803UOP2TtI/BPlcVjzhJNVZQjT3FNSuc78F0IaQOJOZ D2+7aCRvd7VeJMgFPVrLa9LjGvHnnfqOo298oBogjZ0OZeOK8b0S8ZY+m/fa4R7Rr9UG iWudxzkTmeauyhuQdI8/cIyLPINk+0Kp31SOjcHQhyVI4qBDjJIwxOMa1rHvuXAZs/4N KuOB7IzA2vmeVAe3jHVY4bHb89IXS9yvq13K5OII95u4VzMJMgL305qzUd/+A2Val97R puRA== X-Gm-Message-State: ALoCoQloJHNSYRvOdX5UZcRpZf/L+vquSvV0EZtECpbYsgBCoX+mMDGB+nULO/L2LVlz1TubBmjF X-Received: by 10.112.14.2 with SMTP id l2mr1954664lbc.5.1416868787597; Mon, 24 Nov 2014 14:39:47 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.67 with SMTP id o3ls455144laj.86.gmail; Mon, 24 Nov 2014 14:39:47 -0800 (PST) X-Received: by 10.152.8.194 with SMTP id t2mr6694813laa.21.1416868787202; Mon, 24 Nov 2014 14:39:47 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id w5si16566167law.53.2014.11.24.14.39.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 14:39:47 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id ge10so8513517lab.3 for ; Mon, 24 Nov 2014 14:39:47 -0800 (PST) X-Received: by 10.112.138.137 with SMTP id qq9mr22754445lbb.80.1416868786989; Mon, 24 Nov 2014 14:39:46 -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 ew9csp348201lbc; Mon, 24 Nov 2014 14:39:46 -0800 (PST) X-Received: by 10.220.190.201 with SMTP id dj9mr13300879vcb.41.1416868785786; Mon, 24 Nov 2014 14:39:45 -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 ti7si6953861vcb.14.2014.11.24.14.39.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Nov 2014 14:39:45 -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 1Xt2IJ-0007rd-C8; Mon, 24 Nov 2014 22:39:43 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xt2Hl-0007m3-Fe for lng-odp@lists.linaro.org; Mon, 24 Nov 2014 22:39:09 +0000 Received: by mail-lb0-f171.google.com with SMTP id n15so2562385lbi.16 for ; Mon, 24 Nov 2014 14:39:04 -0800 (PST) X-Received: by 10.152.36.232 with SMTP id t8mr17713133laj.6.1416868743961; Mon, 24 Nov 2014 14:39:03 -0800 (PST) Received: from macmini.lan (84-217-193-77.tn.glocalnet.net. [84.217.193.77]) by mx.google.com with ESMTPSA id pr9sm2952957lbc.12.2014.11.24.14.39.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 14:39:03 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Mon, 24 Nov 2014 23:38:47 +0100 Message-Id: <1416868730-26140-7-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416868730-26140-1-git-send-email-ola.liljedahl@linaro.org> References: <1416868730-26140-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 6/9] linux-generic: odp_ticketlock.c use odp_atomic.h and __atomic 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.44 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 --- Updated to use odp_atomic.h functions. Updated to use GCC __atomic barriers (temporary fix). Added missing barrier in odp_ticketlock_lock(). platform/linux-generic/odp_ticketlock.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c index be5b885..096bdc0 100644 --- a/platform/linux-generic/odp_ticketlock.c +++ b/platform/linux-generic/odp_ticketlock.c @@ -27,25 +27,24 @@ void odp_ticketlock_lock(odp_ticketlock_t *ticketlock) while (ticket != ticketlock->cur_ticket) odp_spin(); - odp_mem_barrier(); + __atomic_thread_fence(__ATOMIC_ACQUIRE); } void odp_ticketlock_unlock(odp_ticketlock_t *ticketlock) { - odp_sync_stores(); + __atomic_thread_fence(__ATOMIC_RELEASE); ticketlock->cur_ticket++; #if defined __OCTEON__ - odp_sync_stores(); -#else - odp_mem_barrier(); + odp_sync_stores(); /* SYNCW to flush write buffer */ #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); }