From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <anatoly.burakov@intel.com> Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 83F321B1B9 for <dev@dpdk.org>; Sat, 17 Feb 2018 14:59:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2018 05:59:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,525,1511856000"; d="scan'208";a="176119442" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.252.1.250]) ([10.252.1.250]) by orsmga004.jf.intel.com with ESMTP; 17 Feb 2018 05:59:18 -0800 To: dev@dpdk.org References: <CAMKNYbw7=b69eCM17p8SperLRD86wtKw3iLj1FtG8gL7bUakNg@mail.gmail.com> From: "Burakov, Anatoly" <anatoly.burakov@intel.com> Message-ID: <d22dce85-9e57-8e47-001d-21856a627af0@intel.com> Date: Sat, 17 Feb 2018 13:59:17 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <CAMKNYbw7=b69eCM17p8SperLRD86wtKw3iLj1FtG8gL7bUakNg@mail.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] release/acquire memory barriers and ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> X-List-Received-Date: Sat, 17 Feb 2018 13:59:21 -0000 On 13-Feb-18 7:37 PM, Alex Kiselev wrote: > Hi. > > I've been wondering should I use a release/acquire memory barrier pair > in order to be sure that the other thread will see the fully/corrected > initialized object > passed to it via a dpdk ring or ring itself is a kind of barrier? > > Let's say I have a pseudo code: > > Thread1: > obj = alloc(); > ... > obj initialization > ... > > ??? fence(memory_order_release); ??? > rte_ring_sp_enqueue(ring, obj) > > > Thread2: > ??? fence(memory_order_acquire); ??? > rte_ring_sc_dequeue(ring, obj) > > Should I use fences in that code? > > Thanks. > > -- > Alex > Rings do that automatically, no additional fences needed. -- Thanks, Anatoly