DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Alex Kiselev <kiselev99@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] release/acquire memory barriers and ring
Date: Fri, 16 Feb 2018 09:58:12 -0800	[thread overview]
Message-ID: <20180216095812.7e634a53@xeon-e3> (raw)
In-Reply-To: <CAMKNYbw7=b69eCM17p8SperLRD86wtKw3iLj1FtG8gL7bUakNg@mail.gmail.com>

On Tue, 13 Feb 2018 22:37:37 +0300
Alex Kiselev <kiselev99@gmail.com> 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

Not necessary. Enqueue/dequeue has necessary ordering; it is built
on compare-exchange which has implied barrier.

  parent reply	other threads:[~2018-02-16 17:58 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 [this message]
2018-02-17 13:59 ` Burakov, Anatoly

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=20180216095812.7e634a53@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=kiselev99@gmail.com \
    /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).