From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C5CB35684 for ; Fri, 18 Mar 2016 11:47:41 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 18 Mar 2016 03:47:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,354,1455004800"; d="scan'208";a="936714242" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 18 Mar 2016 03:47:40 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 18 Mar 2016 03:47:40 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 18 Mar 2016 03:47:39 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by shsmsx102.ccr.corp.intel.com ([169.254.2.232]) with mapi id 14.03.0248.002; Fri, 18 Mar 2016 18:47:38 +0800 From: "Xie, Huawei" To: Ilya Maximets , "dev@dpdk.org" , Yuanhan Liu CC: Dyasly Sergey , Jerin Jacob , Jianbo Liu , "Thomas Monjalon" , Tetsuya Mukawa Thread-Topic: [PATCH RFC v3 1/3] vhost: use SMP barriers instead of compiler ones. Thread-Index: AdGA/iVK8b+ddm8JQy6p0FOaeGbrKA== Date: Fri, 18 Mar 2016 10:47:37 +0000 Message-ID: References: <1456314438-4021-1-git-send-email-i.maximets@samsung.com> <1456314438-4021-2-git-send-email-i.maximets@samsung.com> <56EBD718.8010604@samsung.com> <56EBDAD1.1090608@samsung.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 Subject: Re: [dpdk-dev] [PATCH RFC v3 1/3] vhost: use SMP barriers instead of compiler ones. 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: Fri, 18 Mar 2016 10:47:42 -0000 On 3/18/2016 6:39 PM, Ilya Maximets wrote:=0A= >=0A= > On 18.03.2016 13:27, Xie, Huawei wrote:=0A= >> On 3/18/2016 6:23 PM, Ilya Maximets wrote:=0A= >>> On 18.03.2016 13:08, Xie, Huawei wrote:=0A= >>>> On 2/24/2016 7:47 PM, Ilya Maximets wrote:=0A= >>>>> * Wait until it's our turn to add our buffer=0A= >>>>> @@ -979,7 +979,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, u= int16_t queue_id,=0A= >>>>> entry_success++;=0A= >>>>> }=0A= >>>>> =0A= >>>>> - rte_compiler_barrier();=0A= >>>>> + rte_smp_rmb();=0A= >>>> smp_rmb()?=0A= >>> There is no such function 'smp_rmb' in DPDK.=0A= >>> But:=0A= >>> .../arch/arm/rte_atomic.h:#define rte_smp_rmb() rte_rmb()=0A= >>> .../arch/ppc_64/rte_atomic.h:#define rte_smp_rmb() rte_compiler_barrier= ()=0A= >>> .../arch/tile/rte_atomic.h:#define rte_smp_rmb() rte_compiler_barrier()= =0A= >>> .../arch/x86/rte_atomic.h:#define rte_smp_rmb() rte_compiler_barrier()= =0A= >> I mean shoudn't be rte_smp_wmb()?=0A= > No. Here we need to be sure that copying of data from descriptor to=0A= > our local mbuf completed before 'vq->used->idx +=3D entry_success;'.=0A= >=0A= > Read memory barrier will help us with it.=0A= >=0A= > In other places write barriers used because copying performed in=0A= > opposite direction.=0A= =0A= What about the udpate to the used ring?=0A= =0A= =0A= >=0A= >>>>> vq->used->idx +=3D entry_success;=0A= >>>>> vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),=0A= >>>>> sizeof(vq->used->idx));=0A= >>>>> -- 2.5.0=0A= >>>>=0A= >>=0A= >>=0A= =0A=