All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshul Makkar <anshul.makkar@profitbricks.com>
To: Linhaifeng <haifeng.lin@huawei.com>
Cc: qemu-devel@nongnu.org, jerry.lilijun@huawei.com
Subject: Re: [Qemu-devel] vhost-user:why region[0] always mmap failed ?
Date: Wed, 15 Oct 2014 23:28:49 +0200	[thread overview]
Message-ID: <20141015212849.GA20193@vader> (raw)
In-Reply-To: <5418F2F3.4000207@huawei.com>

Hi,

Please can you share in what scenario this mapping fails. I am not seeing any such issue.

Thanks
Anshul Makkar

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++;
>         }
>     }
> 
> 

  reply	other threads:[~2014-10-15 21: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 [this message]
2014-11-01  2:28   ` Linhaifeng

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=20141015212849.GA20193@vader \
    --to=anshul.makkar@profitbricks.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.