From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CD07B593A for ; Tue, 22 Dec 2015 03:41:47 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 21 Dec 2015 18:41:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,462,1444719600"; d="scan'208";a="712450020" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 21 Dec 2015 18:41:46 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 21 Dec 2015 18:41:46 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 21 Dec 2015 18:41:45 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.190]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.92]) with mapi id 14.03.0248.002; Tue, 22 Dec 2015 10:41:43 +0800 From: "Xie, Huawei" To: Yuanhan Liu Thread-Topic: [PATCH v2 1/6] vhost: handle VHOST_USER_SET_LOG_BASE request Thread-Index: AQHRPATbtmURE7JOBUePmgVPkbcV6J7VwfSAgACFvNA= Date: Tue, 22 Dec 2015 02:41:43 +0000 Message-ID: References: <1449027793-30975-1-git-send-email-yuanhan.liu@linux.intel.com> <1450321921-27799-1-git-send-email-yuanhan.liu@linux.intel.com> <1450321921-27799-2-git-send-email-yuanhan.liu@linux.intel.com> <20151222022541.GD18863@yliu-dev.sh.intel.com> In-Reply-To: <20151222022541.GD18863@yliu-dev.sh.intel.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 Cc: "Michael S. Tsirkin" , "dev@dpdk.org" , Victor Kaplansky Subject: Re: [dpdk-dev] [PATCH v2 1/6] vhost: handle VHOST_USER_SET_LOG_BASE request 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: Tue, 22 Dec 2015 02:41:48 -0000 > -----Original Message----- > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > Sent: Tuesday, December 22, 2015 10:26 AM > To: Xie, Huawei > Cc: dev@dpdk.org; Michael S. Tsirkin; Victor Kaplansky; Iremonger, > Bernard; Pavel Fedin; Peter Xu > Subject: Re: [PATCH v2 1/6] vhost: handle VHOST_USER_SET_LOG_BASE > request >=20 > On Mon, Dec 21, 2015 at 03:32:53PM +0000, Xie, Huawei wrote: > > > + > > > + /* > > > + * mmap from 0 to workaround a hugepage mmap bug: mmap will be > > > + * failed when offset is not page size aligned. > > > + */ > > s /will be failed/will fail/ > > mmap will fail when offset is not zero. I mistake for 4KB page size. Please check if huge page size align is enough= . > > Also we only know this workaround is for hugetlbfs. Not sure of > other > > tmpfs, so mention hugetlbfs here. >=20 > I have already mentioned "to workaround a __hugepage__ mmap bug"; it's > not enough? Yes. >=20 > > > + addr =3D mmap(0, size + off, PROT_READ | PROT_WRITE, MAP_SHARED, fd= , > 0); > > > + if (addr =3D=3D MAP_FAILED) { > > > + RTE_LOG(ERR, VHOST_CONFIG, "mmap log base failed!\n"); > > > + return -1; > > > + } > > > + > > > + /* TODO: unmap on stop */ > > > + dev->log_base =3D (uint64_t)(uintptr_t)addr + off; > > (uint64_t)(uintptr_t)RTE_PTR_ADD(addr, off)? >=20 > No, addr is of (void *) type, we should cast it to uint64_t type first, > before adding it with "off". >=20 > --yliu RTE_PTR_ADD is the DPDK interface for pointer arithmetic operation. >=20 > > > + dev->log_size =3D size; > > > + > > > + return 0; > > > +} > > > diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.h > b/lib/librte_vhost/vhost_user/virtio-net-user.h > > > index b82108d..013cf38 100644 > > > --- a/lib/librte_vhost/vhost_user/virtio-net-user.h > > > +++ b/lib/librte_vhost/vhost_user/virtio-net-user.h > > > @@ -49,6 +49,7 @@ void user_set_vring_kick(struct vhost_device_ctx, > struct VhostUserMsg *); > > > > > > void user_set_protocol_features(struct vhost_device_ctx ctx, > > > uint64_t protocol_features); > > > +int user_set_log_base(struct vhost_device_ctx ctx, struct > VhostUserMsg *); > > > > > > int user_get_vring_base(struct vhost_device_ctx, struct > vhost_vring_state *); > > > > >