DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: dev@dpdk.org
Subject: Re: [dpdk-dev] release/acquire memory barriers and ring
Date: Sat, 17 Feb 2018 13:59:17 +0000	[thread overview]
Message-ID: <d22dce85-9e57-8e47-001d-21856a627af0@intel.com> (raw)
In-Reply-To: <CAMKNYbw7=b69eCM17p8SperLRD86wtKw3iLj1FtG8gL7bUakNg@mail.gmail.com>

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

      parent reply	other threads:[~2018-02-17 13:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 19:37 Alex Kiselev
2018-02-13 19:43 ` Alex Kiselev
2018-02-16 17:58 ` Stephen Hemminger
2018-02-17 13:59 ` Burakov, Anatoly [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d22dce85-9e57-8e47-001d-21856a627af0@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).