DPDK patches and discussions
 help / color / mirror / Atom feed
From: Linzhe Lee <slayercat.subscription@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] mbuf: fix atomic refcnt update synchronization
Date: Sat, 3 Sep 2016 00:31:50 +0800	[thread overview]
Message-ID: <CAK_yBkNMQHNG-bLci08HHiOSfcy5zAau6m19KJaVtBYNU_xhMg@mail.gmail.com> (raw)
In-Reply-To: <20160902091236.57250d1a@xeon-e3>

Thanks for reply, Stephen.



I'm in x86-64, my cpu is `Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz`.



When allocation mbuf in program1, and transfer it to program2 for free
via ring, the program1 might meet assert in allocate mbuf sometimes.
(`RTE_ASSERT(rte_mbuf_refcnt_read(m) == 0);`)



but when I using gdb to check it, the refcnt field of mbuf is already
zero. so I believe the problem came from the cache line problem or
incorrect optimization.



When apply this patch, the problem seems solved. I'm submitting it for
your comments.


2016-09-03 0:12 GMT+08:00 Stephen Hemminger <stephen@networkplumber.org>:
> On Fri,  2 Sep 2016 13:25:06 +0800
> lilinzhe <slayercat.subscription@gmail.com> wrote:
>
>> From: 李林哲 <lilinzhe@ijinshan.com>
>>
>> chagne atomic ref update to always call atomic_add
>>
>> when mbuf is allocated by cpu1 and freed by cpu2. cpu1 cache may not be updated by such a set operation.
>> causes refcnt reads incorrect values.
>
> What architecture are you dealing with? On X86 memory is cache coherent.
>
> Doing atomic operation all the time on each mbuf free would significantly
> slow down performance.
>

  reply	other threads:[~2016-09-02 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  5:25 lilinzhe
2016-09-02 16:12 ` Stephen Hemminger
2016-09-02 16:31   ` Linzhe Lee [this message]
2016-09-02 16:51     ` Stephen Hemminger
2016-09-03  2:05       ` Linzhe Lee
2016-09-03 22:52         ` Ananyev, Konstantin

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=CAK_yBkNMQHNG-bLci08HHiOSfcy5zAau6m19KJaVtBYNU_xhMg@mail.gmail.com \
    --to=slayercat.subscription@gmail.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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).