From patchwork Wed Mar 22 04:54:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Brooks X-Patchwork-Id: 95691 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp60494qgd; Tue, 21 Mar 2017 21:54:31 -0700 (PDT) X-Received: by 10.55.10.149 with SMTP id 143mr32341892qkk.212.1490158470935; Tue, 21 Mar 2017 21:54:30 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d16si224697qka.81.2017.03.21.21.54.30; Tue, 21 Mar 2017 21:54:30 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E2A6B62DBA; Wed, 22 Mar 2017 04:54:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id CC1EC62D48; Wed, 22 Mar 2017 04:54:25 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 932AF62D4A; Wed, 22 Mar 2017 04:54:22 +0000 (UTC) Received: from mail-ot0-f171.google.com (mail-ot0-f171.google.com [74.125.82.171]) by lists.linaro.org (Postfix) with ESMTPS id BBD3462D00 for ; Wed, 22 Mar 2017 04:54:21 +0000 (UTC) Received: by mail-ot0-f171.google.com with SMTP id i1so164073042ota.3 for ; Tue, 21 Mar 2017 21:54:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7kmy6ZzUQ5EY4FQy4G+6vd2YO6mamyTQ7h1XbRhJxhk=; b=JrMfyCu842kDRmaoNW6cC8wxLey++SgTGuISvW36gATZf8wBaBJu2IWBUUUHQZvK9V /zCKnAdXIMX7HupQZRjOrPZGnnZSAh0FGY3sSdUjnovXEs8oLLJIZX4t5XXswvXdPY+Q f4gsyhfFqepSvg10utfYs6lHOlg2/wLamXrq7vWWHq843klU8QWpfCNWpFmAq5ASpH2X Wxe2yHQXQzI8kZhhFrf3/8kWGXv88iaOceK2JgboD60hW5TBOT0WgGVhTgA5+Dzq9jNK NEC1T3DNSs2IIY8hqY5+S9UyxkqX8nIeHW8VZVKTIbTrYkLYQjSXZ0yEtnY+fZ/PxXKB PtcQ== X-Gm-Message-State: AFeK/H3J2E14Js640uF5BzbCqCs2lTc+Pjf51R/RR/hogBp8UWOHKwnRVzPTsWwAaVjt3/cdZL0= X-Received: by 10.157.20.151 with SMTP id d23mr20447906ote.37.1490158461207; Tue, 21 Mar 2017 21:54:21 -0700 (PDT) Received: from localhost.localdomain (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id p96sm135147ota.14.2017.03.21.21.54.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 21:54:20 -0700 (PDT) From: Brian Brooks To: lng-odp@lists.linaro.org Date: Tue, 21 Mar 2017 23:54:17 -0500 Message-Id: <20170322045417.13555-1-brian.brooks@linaro.org> X-Mailer: git-send-email 2.12.0 Subject: [lng-odp] [PATCH] Fix memory ordering in ring dequeue X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Acquire ordering is needed to maintain proper release consistency with the ring enqueue operation. This issue presented itself as deadlock when running on an ARM-based chip. Signed-off-by: Brian Brooks --- platform/linux-generic/include/odp_ring_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.12.0 Reviewed-by: Bill Fischofer diff --git a/platform/linux-generic/include/odp_ring_internal.h b/platform/linux-generic/include/odp_ring_internal.h index 55fedeb3..44b83c60 100644 --- a/platform/linux-generic/include/odp_ring_internal.h +++ b/platform/linux-generic/include/odp_ring_internal.h @@ -57,7 +57,7 @@ static inline uint32_t ring_deq(ring_t *ring, uint32_t mask) /* Move reader head. This thread owns data at the new head. */ do { - tail = odp_atomic_load_u32(&ring->w_tail); + tail = odp_atomic_load_acq_u32(&ring->w_tail); if (head == tail) return RING_EMPTY; @@ -90,7 +90,7 @@ static inline uint32_t ring_deq_multi(ring_t *ring, uint32_t mask, /* Move reader head. This thread owns data at the new head. */ do { - tail = odp_atomic_load_u32(&ring->w_tail); + tail = odp_atomic_load_acq_u32(&ring->w_tail); /* Ring is empty */ if (head == tail)