[dpdk-dev] [PATCH v2 09/11] lib/librte_vhost: vhost user support

Linhaifeng haifeng.lin at huawei.com
Thu Feb 12 11:19:27 CET 2015



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



More information about the dev mailing list