From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 65D0EB62 for ; Mon, 23 Mar 2015 13:54:40 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 23 Mar 2015 05:54:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,452,1422950400"; d="scan'208";a="702781081" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by orsmga002.jf.intel.com with ESMTP; 23 Mar 2015 05:54:38 -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; Mon, 23 Mar 2015 20:54:37 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.36]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.111]) with mapi id 14.03.0224.002; Mon, 23 Mar 2015 20:54:36 +0800 From: "Xie, Huawei" To: Linhaifeng , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] cast used->idx to volatile Thread-Index: AQHQZWQ7XK9uXNwZJ06D/GCM+7Oz0J0qBcbg Date: Mon, 23 Mar 2015 12:54:35 +0000 Message-ID: References: <1426925237-8312-1-git-send-email-haifeng.lin@huawei.com> <551005DD.4060508@huawei.com> In-Reply-To: <551005DD.4060508@huawei.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] cast used->idx to volatile 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: Mon, 23 Mar 2015 12:54:40 -0000 > -----Original Message----- > From: Linhaifeng [mailto:haifeng.lin@huawei.com] > Sent: Monday, March 23, 2015 8:24 PM > To: dev@dpdk.org > Cc: Ouyang, Changchun; Xie, Huawei > Subject: Re: [dpdk-dev] [PATCH] cast used->idx to volatile >=20 >=20 >=20 > On 2015/3/21 16:07, linhaifeng wrote: > > From: Linhaifeng > > > > Same as rte_vhost_enqueue_burst we should cast used->idx > > to volatile before notify guest. > > > > Signed-off-by: Linhaifeng > > --- > > lib/librte_vhost/vhost_rxtx.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxt= x.c > > index 535c7a1..8d674d1 100644 > > --- a/lib/librte_vhost/vhost_rxtx.c > > +++ b/lib/librte_vhost/vhost_rxtx.c > > @@ -722,7 +722,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, > uint16_t queue_id, > > } > > > > rte_compiler_barrier(); > > - vq->used->idx +=3D entry_success; > > + *(volatile uint16_t *)&vq->used->idx +=3D entry_success; Haifeng: We have compiler barrier before and an external function call behind, so we= don't need volatile here. Do you meet issue? > > /* Kick guest if required. */ > > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > > eventfd_write((int)vq->callfd, 1); > > >=20 > -- > Regards, > Haifeng