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 3457D1F5 for ; Wed, 28 Jan 2015 07:14:19 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 27 Jan 2015 22:09:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,479,1418112000"; d="scan'208";a="643676977" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by orsmga001.jf.intel.com with ESMTP; 27 Jan 2015 22:14:16 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.110.15) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 28 Jan 2015 14:13:00 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.238]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.231]) with mapi id 14.03.0195.001; Wed, 28 Jan 2015 14:12:59 +0800 From: "Ouyang, Changchun" To: "Xie, Huawei" , Stephen Hemminger Thread-Topic: [dpdk-dev] [PATCH v2 02/24] virtio: Use weaker barriers Thread-Index: AQHQOdoJdWUgQ6r9QU+K5JWgMpQyTJzTBPmAgAAw0oCAAGmEAIABb4gA Date: Wed, 28 Jan 2015 06:12:59 +0000 Message-ID: References: <1421298930-15210-1-git-send-email-changchun.ouyang@intel.com> <1422326164-13697-1-git-send-email-changchun.ouyang@intel.com> <1422326164-13697-3-git-send-email-changchun.ouyang@intel.com> <20150127095831.1572b67a@uryu.home.lan> In-Reply-To: Accept-Language: zh-CN, 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 v2 02/24] virtio: Use weaker barriers 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: Wed, 28 Jan 2015 06:14:19 -0000 > -----Original Message----- > From: Xie, Huawei > Sent: Wednesday, January 28, 2015 12:16 AM > To: Stephen Hemminger > Cc: Ouyang, Changchun; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 02/24] virtio: Use weaker barriers >=20 >=20 >=20 > > -----Original Message----- > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Tuesday, January 27, 2015 5:59 PM > > To: Xie, Huawei > > Cc: Ouyang, Changchun; dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 02/24] virtio: Use weaker barriers > > > > > > > I recall our original code is virtio_wmb(). > > > Use store fence to ensure all updates to entries before updating the > index. > > > Why do we need virtio_rmb() here and add virtio_wmb after > > vq_update_avail_idx()? > > > > Store fence is unnecessary, Intel CPU's are cache coherent, please > > read the virtio Linux ring header file for explanation. A full fence > > WMB is more expensive and causes CPU stall > > >=20 >=20 > I mean virtio_wmb rather than virtio_rmb should be used here, and both of > them are defined as compiler barrier. >=20 > The following code is linux virtio driver for adding buffer to vring. > /* Put entry in available array (but don't update avail->idx until they > * do sync). */ > avail =3D (vq->vring.avail->idx & (vq->vring.num-1)); > vq->vring.avail->ring[avail] =3D head; >=20 > /* Descriptors and available array need to be set before we expose > the > * new available array entries. */ > virtio_wmb(vq->weak_barriers); > vq->vring.avail->idx++; >=20 Yes, use virtio_wmb is better here, will change it in next version. Thanks Changchun