From: "Michael S. Tsirkin" <mst@redhat.com>
To: Linhaifeng <haifeng.lin@huawei.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] vhost: flush used->idx update before reading avail->flags
Date: Tue, 9 Jun 2015 10:46:13 +0200 [thread overview]
Message-ID: <20150609084613.GA18121@redhat.com> (raw)
In-Reply-To: <55768FE2.5060505@huawei.com>
On Tue, Jun 09, 2015 at 03:04:02PM +0800, Linhaifeng wrote:
>
>
> On 2015/4/24 15:27, Luke Gorrie wrote:
> > On 24 April 2015 at 03:01, Linhaifeng <haifeng.lin@huawei.com> wrote:
> >
> >> If not add memory fence what would happen? Packets loss or interrupt
> >> loss?How to test it ?
> >>
> >
> > You should be able to test it like this:
> >
> > 1. Boot two Linux kernel (e.g. 3.13) guests.
> > 2. Connect them via vhost switch.
> > 3. Run continuous traffic between them (e.g. iperf).
> >
> > I would expect that within a reasonable timeframe (< 1 hour) one of the
> > guests' network interfaces will hang indefinitely due to a missed interrupt.
> >
> > You won't be able to reproduce this using DPDK guests because they are not
> > using the same interrupt suppression method.
> >
> > This is a serious real-world problem. I wouldn't deploy the vhost
> > implementation without this fix.
> >
> > Cheers,
> > -Luke
> >
>
> I think this patch can't resole this problem. On the other hand we still would miss interrupt.
>
> After add rte_mb() function the we want the case is :
> 1.write used->idx. ring is full or empty.
> 2.virtio_net open interrupt.
> 3.read avail->flags.
>
> but this case(miss interrupt) would happen too:
> 1.write used->idx. ring is full or empty.
> 2.read avail->flags.
> 3.virtio_net open interrupt.
>
That's why a correct guest, after detecting an empty used ring, must always
re-check used idx at least once after writing avail->flags.
By the way, similarly, host side must re-check avail idx after writing
used flags. I don't see where snabbswitch does it - is that a bug
in snabbswitch?
--
MST
next prev parent reply other threads:[~2015-06-09 8:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 16:33 Huawei Xie
2015-04-23 13:57 ` Luke Gorrie
2015-04-24 1:01 ` Linhaifeng
2015-04-24 2:40 ` Xie, Huawei
2015-04-24 7:27 ` Luke Gorrie
2015-06-09 7:04 ` Linhaifeng
2015-06-09 7:45 ` Luke Gorrie
2015-06-09 8:46 ` Michael S. Tsirkin [this message]
2015-06-09 13:34 ` Xie, Huawei
2015-06-10 2:36 ` Linhaifeng
2015-06-10 8:30 ` Luke Gorrie
2015-06-11 0:50 ` Linhaifeng
2015-04-29 11:11 ` [dpdk-dev] [PATCH v2] " Huawei Xie
2015-05-13 10:46 ` Thomas Monjalon
2015-05-15 13:43 ` Nikita Kalyazin
2015-05-15 15:23 ` Michael S. Tsirkin
2015-05-18 6:18 ` Nikita Kalyazin
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=20150609084613.GA18121@redhat.com \
--to=mst@redhat.com \
--cc=dev@dpdk.org \
--cc=haifeng.lin@huawei.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).