All of lore.kernel.org
 help / color / mirror / Atom feed
From: "jack.chen" <zhunxun@gmail.com>
To: qemu <qemu-devel@nongnu.org>
Subject: [Qemu-devel] vhost-user question
Date: Wed, 31 Jan 2018 19:42:10 +0800	[thread overview]
Message-ID: <CADUDsAo6ku+WT1+DTG6u6CUjdg6xzG6LwBt8RwHK4eR_UWY=Jg@mail.gmail.com> (raw)

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!

             reply	other threads:[~2018-01-31 11:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 11:42 jack.chen [this message]
2018-01-31 17:31 ` [Qemu-devel] vhost-user question 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

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='CADUDsAo6ku+WT1+DTG6u6CUjdg6xzG6LwBt8RwHK4eR_UWY=Jg@mail.gmail.com' \
    --to=zhunxun@gmail.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.