From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kiselev Subject: Re: release/acquire memory barriers and ring Date: Tue, 13 Feb 2018 22:43:01 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" To: dev@dpdk.org Return-path: Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) by dpdk.org (Postfix) with ESMTP id 691B91B2B4 for ; Tue, 13 Feb 2018 20:43:02 +0100 (CET) Received: by mail-io0-f178.google.com with SMTP id g14so16358155iob.9 for ; Tue, 13 Feb 2018 11:43:02 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" I am sorry. I should've posted to the user list of couse. My mistake. 2018-02-13 22:37 GMT+03:00 Alex Kiselev : > 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