From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <huawei.xie@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 3A2475936
 for <dev@dpdk.org>; Thu, 12 Feb 2015 10:32:58 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga103.fm.intel.com with ESMTP; 12 Feb 2015 01:25:48 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.09,564,1418112000"; d="scan'208";a="665311444"
Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87])
 by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2015 01:32:55 -0800
Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by
 KMSMSX152.gar.corp.intel.com (172.21.73.87) with Microsoft SMTP Server (TLS)
 id 14.3.195.1; Thu, 12 Feb 2015 17:28:10 +0800
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by
 SHSMSX103.ccr.corp.intel.com ([169.254.4.197]) with mapi id 14.03.0195.001;
 Thu, 12 Feb 2015 17:28:09 +0800
From: "Xie, Huawei" <huawei.xie@intel.com>
To: Linhaifeng <haifeng.lin@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v2 09/11] lib/librte_vhost: vhost user support
Thread-Index: AdBGpjZxo1okPRF+QaawP57tdq24ww==
Date: Thu, 12 Feb 2015 09:28:09 +0000
Message-ID: <C37D651A908B024F974696C65296B57B0F39607B@SHSMSX101.ccr.corp.intel.com>
References: <1423717649-11818-1-git-send-email-huawei.xie@intel.com>
 <1423717649-11818-10-git-send-email-huawei.xie@intel.com>
 <54DC63AD.7020007@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 v2 09/11] lib/librte_vhost: vhost user support
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Feb 2015 09:32:58 -0000

On 2/12/2015 4:28 PM, Linhaifeng wrote:=0A=
>=0A=
> On 2015/2/12 13:07, Huawei Xie wrote:=0A=
>> +=0A=
>> +		/* This is ugly */=0A=
>> +		mapped_size =3D memory.regions[idx].memory_size +=0A=
>> +			memory.regions[idx].mmap_offset;=0A=
>> +		mapped_address =3D (uint64_t)(uintptr_t)mmap(NULL,=0A=
>> +			mapped_size,=0A=
>> +			PROT_READ | PROT_WRITE, MAP_SHARED,=0A=
>> +			pmsg->fds[idx],=0A=
>> +			0);=0A=
> Just another ugly way:=0A=
> We can use the size of file to mmap then unmmap is not need align to the =
size of page.=0A=
>=0A=
Yes, this is like how cuses handle mmap.=0A=
We will add this into the to-do list, combine all the regions the first,=0A=
check if they belong to the same file, and then map each file once.=0A=
Seems there is no elegant way.=0A=
=0A=
There is another to do for mmap. If there are multiple virtio devices,=0A=
the memory are mapped for each virtio device. Actually we only need once.=
=0A=
=0A=
=0A=