From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by dpdk.org (Postfix) with ESMTP id ED3DA2BDE for ; Fri, 18 Mar 2016 12:00:16 +0100 (CET) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O48002FZEKGUF90@mailout4.w1.samsung.com> for dev@dpdk.org; Fri, 18 Mar 2016 11:00:16 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-a2-56ebdfbf88e7 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id D5.B4.21385.FBFDBE65; Fri, 18 Mar 2016 11:00:15 +0000 (GMT) Received: from [106.109.129.180] by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O48001UAEKFMQ30@eusync1.samsung.com>; Fri, 18 Mar 2016 11:00:15 +0000 (GMT) To: "Xie, Huawei" , "dev@dpdk.org" , Yuanhan Liu 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> Cc: Dyasly Sergey , Jerin Jacob , Jianbo Liu , Thomas Monjalon , Tetsuya Mukawa From: Ilya Maximets Message-id: <56EBDFBE.3010502@samsung.com> Date: Fri, 18 Mar 2016 14:00:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRmVeSWpSXmKPExsVy+t/xy7r7778OM+i/bmXx7tN2Jov2mWeZ LCZOMrGY/jTC4ljPJ1aLybOlLL5sms5mcX3CBVYHDo+L/XcYPTac6Gf1+LVgKatH43MJj8V7 XjJ53Lm2h81j3slAj74tqxgDOKK4bFJSczLLUov07RK4Mma0rWMt2M5TcXXzYcYGxoVcXYyc HBICJhLvetcwQdhiEhfurWfrYuTiEBJYyigxd9dKKOcFo8Sx+VPYQKqEBYIlNqx5wgxiiwiU SKx78Zcdomghs8TrqdOYQRxmgYuMEg8fHgfrYBPQkTi1+ggjiM0roCWxaOtGli5GDg4WAVWJ m38DQcKiAhEShzu72CFKBCV+TL7HAmJzCoRJ/Gj8ClbOLKAncf+iFkiYWUBeYvOat8wTGAVm IemYhVA1C0nVAkbmVYyiqaXJBcVJ6blGesWJucWleel6yfm5mxghUfB1B+PSY1aHGAU4GJV4 eF9UvQ4TYk0sK67MPcQowcGsJMKrfRsoxJuSWFmVWpQfX1Sak1p8iFGag0VJnHfmrvchQgLp iSWp2ampBalFMFkmDk6pBsaWha37Niav2dLN+XHtoew/PH2b153229bStXvZzkr2Ay/VPl9g /rm0JFy9XX6F4NaDujLHP5jrfdpjqF2lmV/3nG21VM272YffhfttYQnasNDOYLM12+OapR/e t+duq13Jm7d69fvi7uwtCRNDLid47eZeqmuouVtpzbblKscyl59jf23k9jZBiaU4I9FQi7mo OBEA0prjHH4CAAA= 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 11:00:17 -0000 On 18.03.2016 13:47, Xie, Huawei wrote: > On 3/18/2016 6:39 PM, Ilya Maximets wrote: >> >> On 18.03.2016 13:27, Xie, Huawei wrote: >>> On 3/18/2016 6:23 PM, Ilya Maximets wrote: >>>> On 18.03.2016 13:08, Xie, Huawei wrote: >>>>> On 2/24/2016 7:47 PM, Ilya Maximets wrote: >>>>>> * Wait until it's our turn to add our buffer >>>>>> @@ -979,7 +979,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, >>>>>> entry_success++; >>>>>> } >>>>>> >>>>>> - rte_compiler_barrier(); >>>>>> + rte_smp_rmb(); >>>>> smp_rmb()? >>>> There is no such function 'smp_rmb' in DPDK. >>>> But: >>>> .../arch/arm/rte_atomic.h:#define rte_smp_rmb() rte_rmb() >>>> .../arch/ppc_64/rte_atomic.h:#define rte_smp_rmb() rte_compiler_barrier() >>>> .../arch/tile/rte_atomic.h:#define rte_smp_rmb() rte_compiler_barrier() >>>> .../arch/x86/rte_atomic.h:#define rte_smp_rmb() rte_compiler_barrier() >>> I mean shoudn't be rte_smp_wmb()? >> No. Here we need to be sure that copying of data from descriptor to >> our local mbuf completed before 'vq->used->idx += entry_success;'. >> >> Read memory barrier will help us with it. >> >> In other places write barriers used because copying performed in >> opposite direction. > > What about the udpate to the used ring? Next line is the only place where this vq->used->idx accessed. So, there must be no issues. >>>>>> vq->used->idx += entry_success; >>>>>> vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx), >>>>>> sizeof(vq->used->idx)); >>>>>> -- 2.5.0 >>>>> >>> >>> > > >