From: Olivier MATZ <olivier.matz@6wind.com>
To: "Hanoch Haim (hhaim)" <hhaim@cisco.com>,
"bruce.richardson@intel.com" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"Ido Barnea \(ibarnea\)" <ibarnea@cisco.com>,
"Itay Marom \(imarom\)" <imarom@cisco.com>
Subject: Re: [dpdk-dev] [PATCH v2] mbuf: optimize rte_mbuf_refcnt_update
Date: Mon, 4 Jan 2016 14:53:29 +0100 [thread overview]
Message-ID: <568A7959.7030506@6wind.com> (raw)
In-Reply-To: <d18f2062724a4453a1f709dcf4f30792@XCH-RTP-017.cisco.com>
Hi Hanoch,
Please find some comments below.
On 12/27/2015 10:39 AM, Hanoch Haim (hhaim) wrote:
> Hi Bruce,
>
> I'm Hanoch from Cisco Systems works for the https://github.com/cisco-system-traffic-generator/trex-core traffic generator project.
>
> While upgrading from DPDK 1.8 to 2.2 Ido found that the following commit creates a mbuf corruption and result in Tx hang
>
>
>
> commit f20b50b946da9070d21e392e4dbc7d9f68bc983e
>
> Author: Olivier Matz <olivier.matz@6wind.com>
>
> Date: Mon Jun 8 16:57:22 2015 +0200
>
>
>
> Looking at the change it is clear why there is an issue, wanted to get your input.
>
>
>
> Init
>
> -----
>
> alloc const mbuf ==> mbuf-a (ref=1)
>
>
>
> Simple case that works
>
> ---------------------
>
>
>
> thread 1 , tx: alloc-mbuf->attach(mbuf-a) (ref=2) inc- non atomic
>
> thread 1 , tx: alloc-mbuf->attach(mbuf-a) (ref32) inc- atomic
do you mean "(ref=3)" ?
>
> thread 1 , drv : free() (ref=2) dec- atomic
>
> thread 1 , drv : free() (ref=3) dec - non atomic
do you mean "(ref=1)" ?
>
> Simple case that does not work
>
> ---------------------
>
>
>
> Both do that in parallel
>
>
>
> thread 2 tx : alloc-mbuf->attach(mbuf-a) (ref=2) inc- non atomic
>
> thread 1 tx : alloc-mbuf->attach(mbuf-a) (ref=2) inc- non atomic
It is not allowed to call a function from the mbuf API in parallel.
Example:
core0 | core1
--------------------------------|---------------------------------------
m = rte_pktmbuf_alloc(m); |
enqueue(m); |
|m = dequeue();
do_something(m); |do_something(m);
do_something() is not allowed because it accesses the same mbuf
structure.
do_something() can be any function of mbuf API: rte_pktmbuf_prepend(),
rte_pktmbuf_attach(), ...
This is allowed:
core0 | core1
--------------------------------|---------------------------------------
m = rte_pktmbuf_alloc(m); |
m2 = rte_pktmbuf_attach(m); |
enqueue(m2); |
|m2 = dequeue();
do_something(m); |do_something(m2);
Regards,
Olivier
next prev parent reply other threads:[~2016-01-04 13:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-27 9:39 Hanoch Haim (hhaim)
2016-01-04 13:53 ` Olivier MATZ [this message]
2016-01-04 14:43 ` Hanoch Haim (hhaim)
2016-01-05 10:57 ` Olivier MATZ
2016-01-05 11:11 ` Hanoch Haim (hhaim)
2016-01-05 12:12 ` Olivier MATZ
2016-01-13 11:48 ` Bruce Richardson
2016-01-13 16:28 ` Hanoch Haim (hhaim)
2016-01-13 16:40 ` Bruce Richardson
-- strict thread matches above, loose matches on Subject: below --
2015-06-01 9:32 [dpdk-dev] [PATCH] mbuf: optimize first reference increment in rte_pktmbuf_attach Olivier Matz
2015-06-08 14:57 ` [dpdk-dev] [PATCH v2] mbuf: optimize rte_mbuf_refcnt_update Olivier Matz
2015-06-09 12:57 ` Bruce Richardson
2015-06-12 14:10 ` Thomas Monjalon
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=568A7959.7030506@6wind.com \
--to=olivier.matz@6wind.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=hhaim@cisco.com \
--cc=ibarnea@cisco.com \
--cc=imarom@cisco.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).