From: Linhaifeng <haifeng.lin@huawei.com>
To: qemu-devel@nongnu.org, jerry.lilijun@huawei.com
Subject: Re: [Qemu-devel] vhost-user:why region[0] always mmap failed ?
Date: Sat, 1 Nov 2014 10:28:21 +0800 [thread overview]
Message-ID: <54544545.40301@huawei.com> (raw)
In-Reply-To: <20141015212849.GA20193@vader>
On 2014/10/16 5:28, Anshul Makkar wrote:
> Hi,
>
> Please can you share in what scenario this mapping fails. I am not seeing any such issue.
>
> Thanks
> Anshul Makkar
>
VM info:
memory:4G
hugepage size:2M
memory regions info:
gpa = 0xC0000
size = 3220439040
ua = 0x2aaaaacc0000
offset = 786432
gpa = 0x100000000
size = 1073741824
ua = 0x2aab6ac00000
offset = 18446650252267094016
gpa = 0x0
size = 655360
ua = 0x2aaaaac00000
offset = 0
log:
mmap fd[61] size[3221225472] failed
mmap fd[62] size[18446650253340835840] failed
> On Wed, Sep 17, 2014 at 10:33:23AM +0800, Linhaifeng wrote:
>> Hi,
>>
>> There is two memory regions when receive VHOST_SET_MEM_TABLE message:
>> region[0]
>> gpa = 0x0
>> size = 655360
>> ua = 0x2aaaaac00000
>> offset = 0
>> region[1]
>> gpa = 0xC0000
>> size = 2146697216
>> ua = 0x2aaaaacc0000
>> offset = 786432
>>
>> region[0] always mmap failed.The user code is :
>>
>> for (idx = 0; idx < msg->msg.memory.nregions; idx++) {
>> if (msg->fds[idx] > 0) {
>> size_t size;
>> uint64_t *guest_mem;
>> Region *region = &vhost_server->memory.regions[i];
>>
>> region->guest_phys_addr = msg->msg.memory.regions[idx].guest_phys_addr;
>> region->memory_size = msg->msg.memory.regions[idx].memory_size;
>> region->userspace_addr = msg->msg.memory.regions[idx].userspace_addr;
>> region->mmap_offset = msg->msg.memory.regions[idx].mmap_offset;
>>
>> assert(idx < msg->fd_num);
>> assert(msg->fds[idx] > 0);
>>
>> size = region->memory_size + region->mmap_offset;
>> guest_mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, msg->fds[idx], 0);
>> if (MAP_FAILED == guest_mem) {
>> continue;
>> }
>> i++;
>> guest_mem += (region->mmap_offset / sizeof(*guest_mem));
>> region->mmap_addr = (uint64_t)guest_mem;
>> vhost_server->memory.nregions++;
>> }
>> }
>>
>>
>
>
--
Regards,
Haifeng
prev parent reply other threads:[~2014-11-01 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 2:33 [Qemu-devel] vhost-user:why region[0] always mmap failed ? Linhaifeng
2014-10-15 21:28 ` Anshul Makkar
2014-11-01 2:28 ` Linhaifeng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54544545.40301@huawei.com \
--to=haifeng.lin@huawei.com \
--cc=jerry.lilijun@huawei.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).