From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id DCDF912A8 for ; Tue, 9 Jun 2015 10:46:16 +0200 (CEST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 0094419CBB6; Tue, 9 Jun 2015 08:46:15 +0000 (UTC) Received: from redhat.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t598kDVR023585; Tue, 9 Jun 2015 04:46:14 -0400 Date: Tue, 9 Jun 2015 10:46:13 +0200 From: "Michael S. Tsirkin" To: Linhaifeng Message-ID: <20150609084613.GA18121@redhat.com> References: <1429720392-25345-1-git-send-email-huawei.xie@intel.com> <553995DB.4000801@huawei.com> <55768FE2.5060505@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55768FE2.5060505@huawei.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] vhost: flush used->idx update before reading avail->flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2015 08:46:17 -0000 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 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