qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] vhost-user:why region[0] always mmap failed ?


From: Anshul Makkar
Subject: Re: [Qemu-devel] vhost-user:why region[0] always mmap failed ?
Date: Wed, 15 Oct 2014 23:28:49 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]