From: Joyce Kong <Joyce.Kong@arm.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
Gavin Hu <Gavin.Hu@arm.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
"tiwei.bie@intel.com" <tiwei.bie@intel.com>,
"zhihong.wang@intel.com" <zhihong.wang@intel.com>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"jerinj@marvell.com" <jerinj@marvell.com>,
"yinan.wang@intel.com" <yinan.wang@intel.com>, nd <nd@arm.com>,
"dev@dpdk.org" <dev@dpdk.org>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split vring used idx
Date: Thu, 16 Apr 2020 06:46:11 +0000 [thread overview]
Message-ID: <DB7PR08MB3307BA2D1997DC33048BEF1692D80@DB7PR08MB3307.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <DBBPR08MB4646A883D52AF389C969F12D98D80@DBBPR08MB4646.eurprd08.prod.outlook.com>
<snip>
> > > Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for
> > > split vring used idx
> > >
> > > On Thu, 2 Apr 2020 10:57:52 +0800
> > > Joyce Kong <joyce.kong@arm.com> wrote:
> > >
> > > > -(vq)->vq_used_cons_idx))
> > > > +static inline uint16_t
> > > > +virtqueue_nused(struct virtqueue *vq)
> > > vq is unmodified and should be const
> > >
> > > > +{
> > > > +uint16_t idx;
> > > > +if (vq->hw->weak_barriers) {
> > > Put blank line between declaration and if statement
> > Will fix in v3.
> > >
> > > > +/* x86 prefers to using rte_smp_rmb over __atomic_load_n as it
> > > > +reports
> > > > + * a slightly better perf, which comes from the saved branch by
> > > > +the
> > > compiler.
> > > > + * The if and else branches are identical with the smp and cio
> > > > + barriers
> > > both
> > > > + * defined as compiler barriers on x86.
> > > > + */
> > >
> > > Do not put comments on left margin (except in function prolog).
> > Will fix in v3.
> > >
> > > > +#ifdef RTE_ARCH_X86_64
> > > > +idx = vq->vq_split.ring.used->idx; rte_smp_rmb(); #else idx =
> > > +__atomic_load_n(&(vq)->vq_split.ring.used->idx,
> > > > +__ATOMIC_ACQUIRE);
> > > > +#endif
> > > > +} else {
> > > > +idx = vq->vq_split.ring.used->idx; rte_cio_rmb(); } return (idx -
> > > > +vq->vq_used_cons_idx);
> > >
> > > Parenthesis around arguments to return are unnecessary.
> > > BSD code likes it, Linux style does not.
> > Will fix in v3.
> > >
> > > > +}
> > >
> > > This kind of arch specific code is hard to maintain.
> > > Does it really make that much difference.
> > Yes, a stronger than required barrier is a performance killer,
> > especially in the fast path.
> > The test was conducted on the ThunderX2+Intel XL710 testbed, the PVP
> > test case.
> > /Gavin
> I think if the performance deference is not much we should stay with C11 built-ins for x86. How much is the
> performance difference on x86?
According to intel's PVP test for packed ring, ~1.5% perf loss would be caused on x86 if staying with __atomic_load_n. So rte_smp_rmb is kept for x86 in packed ring patches which have been merged and the similar change is done in split ring patches.
next prev parent reply other threads:[~2020-04-16 6:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 9:24 [dpdk-dev] [PATCH v1 0/2] one way barrier for split vring idx Joyce Kong
2020-02-12 9:24 ` [dpdk-dev] [PATCH v1 1/2] virtio: one way barrier for split vring used idx Joyce Kong
2020-02-12 9:24 ` [dpdk-dev] [PATCH v1 2/2] virtio: one way barrier for split vring avail idx Joyce Kong
2020-04-02 2:57 ` [dpdk-dev] [PATCH v2 0/2] one way barrier for split vring idx Joyce Kong
2020-04-02 2:57 ` [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split vring used idx Joyce Kong
2020-04-02 15:47 ` Stephen Hemminger
2020-04-03 8:55 ` Gavin Hu
2020-04-16 4:40 ` Honnappa Nagarahalli
2020-04-16 6:46 ` Joyce Kong [this message]
2020-04-02 2:57 ` [dpdk-dev] [PATCH v2 2/2] virtio: one way barrier for split vring avail idx Joyce Kong
2020-04-06 15:26 ` [dpdk-dev] [PATCH v3 0/2] one way barrier for split vring idx Joyce Kong
2020-04-16 9:08 ` Ye Xiaolong
2020-04-06 15:26 ` [dpdk-dev] [PATCH v3 1/2] virtio: one way barrier for split vring used idx Joyce Kong
2020-04-17 6:51 ` Ye Xiaolong
2020-04-17 8:14 ` Joyce Kong
2020-04-06 15:26 ` [dpdk-dev] [PATCH v3 2/2] virtio: one way barrier for split vring avail idx Joyce Kong
2020-04-24 3:39 ` [dpdk-dev] [PATCH v4 0/2] one way barrier for split vring idx Joyce Kong
2020-04-28 16:06 ` Maxime Coquelin
2020-04-29 17:45 ` Ferruh Yigit
2020-04-30 9:09 ` Maxime Coquelin
2020-04-30 9:16 ` Joyce Kong
2020-04-30 9:24 ` Maxime Coquelin
2020-04-24 3:39 ` [dpdk-dev] [PATCH v4 1/2] virtio: one way barrier for split vring used idx Joyce Kong
2020-04-27 9:03 ` Maxime Coquelin
2020-04-24 3:39 ` [dpdk-dev] [PATCH v4 2/2] virtio: one way barrier for split vring avail idx Joyce Kong
2020-04-27 9:03 ` Maxime Coquelin
2020-04-30 9:14 ` [dpdk-dev] [PATCH v5 0/2] one way barrier for split vring idx Joyce Kong
2020-04-30 20:54 ` Maxime Coquelin
2020-04-30 9:14 ` [dpdk-dev] [PATCH v5 1/2] virtio: one way barrier for split vring used idx Joyce Kong
2020-04-30 22:58 ` Ferruh Yigit
2020-05-04 10:04 ` Maxime Coquelin
2020-04-30 9:14 ` [dpdk-dev] [PATCH v5 2/2] virtio: one way barrier for split vring avail idx Joyce Kong
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=DB7PR08MB3307BA2D1997DC33048BEF1692D80@DB7PR08MB3307.eurprd08.prod.outlook.com \
--to=joyce.kong@arm.com \
--cc=Gavin.Hu@arm.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=maxime.coquelin@redhat.com \
--cc=nd@arm.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=tiwei.bie@intel.com \
--cc=yinan.wang@intel.com \
--cc=zhihong.wang@intel.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).