All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] vhost-user question
@ 2018-01-31 11:42 jack.chen
  2018-01-31 17:31 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 7+ messages in thread
From: jack.chen @ 2018-01-31 11:42 UTC (permalink / raw)
  To: qemu

hello,I am confused when I read vhost-user source code in qemu.I know
vhost-user app shared memory with qemu by mmap,but why it can use fd which
is belong to qemu?
relative code:
 qemu code in function vhost_user_set_mem_table
fd = memory_region_get_fd(mr);
        if (fd > 0) {
            msg.payload.memory.regions[fd_num].userspace_addr =
reg->userspace_addr;
            msg.payload.memory.regions[fd_num].memory_size  =
reg->memory_size;
            msg.payload.memory.regions[fd_num].guest_phys_addr =
reg->guest_phys_addr;
            msg.payload.memory.regions[fd_num].mmap_offset = offset;
            assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
            fds[fd_num++] = fd;
        }

……
DPDK code in vhost_user_set_mem_table

mmap_addr = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_POPULATE, fd, 0);
……

thanks a lot!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-01 10:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 11:42 [Qemu-devel] vhost-user question jack.chen
2018-01-31 17:31 ` Dr. David Alan Gilbert
2018-02-01  2:03   ` jack.chen
2018-02-01  9:51     ` Dr. David Alan Gilbert
2018-02-01 10:17       ` jack.chen
2018-02-01 10:30         ` Dr. David Alan Gilbert
2018-02-01 10:50           ` jack

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.