From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1A2DE5A58 for ; Tue, 9 Jun 2015 15:34:54 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 09 Jun 2015 06:34:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,581,1427785200"; d="scan'208";a="723871407" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by fmsmga001.fm.intel.com with ESMTP; 09 Jun 2015 06:34:52 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by KMSMSX152.gar.corp.intel.com (172.21.73.87) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 9 Jun 2015 21:34:51 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.246]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.168]) with mapi id 14.03.0224.002; Tue, 9 Jun 2015 21:34:50 +0800 From: "Xie, Huawei" To: "Michael S. Tsirkin" Thread-Topic: [PATCH] vhost: flush used->idx update before reading avail->flags Thread-Index: AdCiuQ5cHS3E2e3uQ4er9MFrV/6bZg== Date: Tue, 9 Jun 2015 13:34:49 +0000 Message-ID: References: <1429720392-25345-1-git-send-email-huawei.xie@intel.com> <553995DB.4000801@huawei.com> <55768FE2.5060505@huawei.com> <20150609084613.GA18121@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 13:34:55 -0000 On 6/9/2015 4:47 PM, Michael S. Tsirkin wrote:=0A= > On Tue, Jun 09, 2015 at 03:04:02PM +0800, Linhaifeng wrote:=0A= >>=0A= >> On 2015/4/24 15:27, Luke Gorrie wrote:=0A= >>> On 24 April 2015 at 03:01, Linhaifeng wrote:= =0A= >>>=0A= >>>> If not add memory fence what would happen? Packets loss or interrupt= =0A= >>>> loss?How to test it ?=0A= >>>>=0A= >>> You should be able to test it like this:=0A= >>>=0A= >>> 1. Boot two Linux kernel (e.g. 3.13) guests.=0A= >>> 2. Connect them via vhost switch.=0A= >>> 3. Run continuous traffic between them (e.g. iperf).=0A= >>>=0A= >>> I would expect that within a reasonable timeframe (< 1 hour) one of the= =0A= >>> guests' network interfaces will hang indefinitely due to a missed inter= rupt.=0A= >>>=0A= >>> You won't be able to reproduce this using DPDK guests because they are = not=0A= >>> using the same interrupt suppression method.=0A= >>>=0A= >>> This is a serious real-world problem. I wouldn't deploy the vhost=0A= >>> implementation without this fix.=0A= >>>=0A= >>> Cheers,=0A= >>> -Luke=0A= >>>=0A= >> I think this patch can't resole this problem. On the other hand we still= would miss interrupt.=0A= >>=0A= >> After add rte_mb() function the we want the case is :=0A= >> 1.write used->idx. ring is full or empty.=0A= >> 2.virtio_net open interrupt.=0A= >> 3.read avail->flags.=0A= >>=0A= >> but this case(miss interrupt) would happen too:=0A= >> 1.write used->idx. ring is full or empty.=0A= >> 2.read avail->flags.=0A= >> 3.virtio_net open interrupt.=0A= >>=0A= > That's why a correct guest, after detecting an empty used ring, must alwa= ys=0A= > re-check used idx at least once after writing avail->flags.=0A= >=0A= > By the way, similarly, host side must re-check avail idx after writing=0A= > used flags. I don't see where snabbswitch does it - is that a bug=0A= > in snabbswitch?=0A= >=0A= yes, both host and guest should recheck if there is more work added=0A= after they toggle the flag.=0A= For DPDK vHost, as it runs in polling mode, we will recheck avail idx=0A= soon, so we don't need recheck.=0A=