From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by dpdk.org (Postfix) with ESMTP id 600945936 for ; Thu, 12 Feb 2015 11:20:12 +0100 (CET) Received: from 172.24.2.119 (EHLO szxeml432-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BBV80344; Thu, 12 Feb 2015 18:20:10 +0800 (CST) Received: from [127.0.0.1] (10.177.19.115) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.158.1; Thu, 12 Feb 2015 18:19:29 +0800 Message-ID: <54DC7E2F.9030600@huawei.com> Date: Thu, 12 Feb 2015 18:19:27 +0800 From: Linhaifeng User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: "Xie, Huawei" , "dev@dpdk.org" 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> In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.115] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.54DC7E5A.00E1, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fe4f3b0c198fc6ffe6c07c0639b4a9d3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2015 10:20:14 -0000 On 2015/2/12 17:28, Xie, Huawei wrote: > On 2/12/2015 4:28 PM, Linhaifeng wrote: >> >> On 2015/2/12 13:07, Huawei Xie wrote: >>> + >>> + /* This is ugly */ >>> + mapped_size = memory.regions[idx].memory_size + >>> + memory.regions[idx].mmap_offset; >>> + mapped_address = (uint64_t)(uintptr_t)mmap(NULL, >>> + mapped_size, >>> + PROT_READ | PROT_WRITE, MAP_SHARED, >>> + pmsg->fds[idx], >>> + 0); >> Just another ugly way: >> We can use the size of file to mmap then unmmap is not need align to the size of page. >> > Yes, this is like how cuses handle mmap. > We will add this into the to-do list, combine all the regions the first, > check if they belong to the same file, and then map each file once. > Seems there is no elegant way. > > There is another to do for mmap. If there are multiple virtio devices, > the memory are mapped for each virtio device. Actually we only need once. > Great minds think alike. The graceful way is qemu send a message to us to mmap whit which file and size then we not need to mmap for each virtio device. > > > -- Regards, Haifeng