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 503A22BD7 for ; Fri, 18 Mar 2016 11:39:16 +0100 (CET) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O4800215DLEUH90@mailout4.w1.samsung.com> for dev@dpdk.org; Fri, 18 Mar 2016 10:39:14 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-18-56ebdad288b2 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 2D.BB.16778.2DADBE65; Fri, 18 Mar 2016 10:39:14 +0000 (GMT) Received: from [106.109.129.180] by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O48009AVDLDUS50@eusync2.samsung.com>; Fri, 18 Mar 2016 10:39:14 +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> Cc: Dyasly Sergey , Jerin Jacob , Jianbo Liu , Thomas Monjalon , Tetsuya Mukawa From: Ilya Maximets Message-id: <56EBDAD1.1090608@samsung.com> Date: Fri, 18 Mar 2016 13:39:13 +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+NgFnrDLMWRmVeSWpSXmKPExsVy+t/xK7qXbr0OM2jpkLN492k7k0X7zLNM FhMnmVhMfxphcaznE6vF5NlSFl82TWezuD7hAqsDh8fF/juMHhtO9LN6/FqwlNWj8bmEx+I9 L5k87lzbw+Yx72SgR9+WVYwBHFFcNimpOZllqUX6dglcGfPn7WIpmMRVsWHif/YGxrUcXYyc HBICJhIXVy9hgrDFJC7cW8/WxcjFISSwlFHi4+XN7BDOC0aJnQvWsYJUCQsES2xY84QZxBYR KJFY9+IvVNE2JomvjZOZQBxmgYuMEg8fHmcDqWIT0JE4tfoII4jNK6AlceHaGbBuFgFViSOH JoLtFhWIkDjc2cUOUSMo8WPyPRYQm1MgTOLKop9ANRxAQ/Uk7l/UAgkzC8hLbF7zlnkCo8As JB2zEKpmIalawMi8ilE0tTS5oDgpPddQrzgxt7g0L10vOT93EyMkDr7sYFx8zOoQowAHoxIP 74uq12FCrIllxZW5hxglOJiVRHiXXAcK8aYkVlalFuXHF5XmpBYfYpTmYFES5527632IkEB6 YklqdmpqQWoRTJaJg1OqgdEoSnLy4wo+mzLNo3lW7mUdUm6sl/P4i911NFWmTZlqH25Rz5gk JRnEoGPN6usdbLNPT+gUv1REoZ7rjNsTjBgCIspCV/fFNZdb7X7Ae0ttc2d8u3nQ3r2FUZvq 7i08YHZF+cFKjr8NUX4RbJPTA/8aLzie3v/24AvtWS8qttksmLV9f+NCJZbijERDLeai4kQA Z6SnEX8CAAA= 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:39:16 -0000 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. > >> >>>> vq->used->idx += entry_success; >>>> vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx), >>>> sizeof(vq->used->idx)); >>>> -- 2.5.0 >>> >>> > > >