DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nikita Kalyazin <n.kalyazin@samsung.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Dyasly Sergey <s.dyasly@samsung.com>
Subject: Re: [dpdk-dev] [PATCH] vhost: call write barrier before used index update
Date: Wed, 21 Oct 2015 18:42:04 +0300	[thread overview]
Message-ID: <20151021154204.GB27896@kalyazin.rnd.samsung.ru> (raw)
In-Reply-To: <20151020142951.GA18496@bricha3-MOBL3>

Hi,

> This has been discussed a number of times before on list, and the consensus
> seems to be that the correct way to fix this is to introduce a set of specific
> barrier operations that insert the correct barrier type on each architecture,
> i.e. compiler barriers on IA, and full wmbs on architectures that require that.
Linux kernel contains two sets of macros: *mb() and smp_*mb().  As far as
I understand, the former are meant to order memory accesses when interacting
with peripherals (physical NICs in our case), and the latter - to provide
synchronization between CPU cores (applicable for virtual NICs in our case).
smp_*mb() for Intel architecture would be a simple compiler barrier, whereas
for processors with weaker memory model they may use real barrier
instructions.
Maybe implementing barriers similar way would work in DPDK as well?

-- 

Best regards,

Nikita Kalyazin,
n.kalyazin@samsung.com

Software Engineer
Virtualization Group
Samsung R&D Institute Russia
Tel: +7 (495) 797-25-00 #3816
Tel: +7 (495) 797-25-03
Office #1501, 12-1, Dvintsev str.,
Moscow, 127018, Russia

On Tue, Oct 20, 2015 at 03:29:51PM +0100, Bruce Richardson wrote:
> On Tue, Oct 20, 2015 at 05:07:46PM +0300, Nikita Kalyazin wrote:
> > Descriptors that have been put into the used vring must be observable by
> > guest earlier than the new used index value.
> > Although compiler barrier serves well for Intel architectue here, the
> > proper cross-platform solution is to use write barrier before the used
> > index is updated.
> > 
> > Signed-off-by: Nikita Kalyazin <n.kalyazin@samsung.com>
> > ---
> Yes, but no! :-)
> 
> This has been discussed a number of times before on list, and the consensus
> seems to be that the correct way to fix this is to introduce a set of specific
> barrier operations that insert the correct barrier type on each architecture,
> i.e. compiler barriers on IA, and full wmbs on architectures that require that.
> 
> See discussion here: http://dpdk.org/dev/patchwork/patch/4293/
> and in the thread here: http://dpdk.org/ml/archives/dev/2015-March/015202.html
> 
> So correct problem statment, but unfortunately NAK for the implementation.
> 
> Patches for general memory barrier implementation as described above welcome :-)
> 
> Regards,
> /Bruce

  reply	other threads:[~2015-10-21 15:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 14:07 Nikita Kalyazin
2015-10-20 14:29 ` Bruce Richardson
2015-10-21 15:42   ` Nikita Kalyazin [this message]
2015-10-21 15:47     ` Bruce Richardson

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=20151021154204.GB27896@kalyazin.rnd.samsung.ru \
    --to=n.kalyazin@samsung.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=s.dyasly@samsung.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).