From: Mark McLoughlin <markmc@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>,
Avi Kivity <avi@qumranet.com>,
Rusty Russell <rusty@rustcorp.com.au>
Cc: kvm@vger.kernel.org, Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH 2/5] lguest: Use VRINGSETINFO ioctl() instead of mmap()
Date: Fri, 13 Jun 2008 14:57:58 +0100 [thread overview]
Message-ID: <1213365481-23460-3-git-send-email-markmc@redhat.com> (raw)
In-Reply-To: <1213365481-23460-2-git-send-email-markmc@redhat.com>
(Against lguest:use-tun-ringfd.patch)
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
Documentation/lguest/lguest.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 630e159..d37fa2d 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -1373,22 +1373,16 @@ static bool recvfd_used(int fd, struct device *dev)
static int map_vring(struct vring *vr)
{
int fd = open_or_die("/dev/vring", O_RDWR);
+ struct vring_ioctl_info info;
- /* Map the rings over where they belong in Guest. */
- if (mmap(vr->desc, page_align(vring_size(vr->num, getpagesize())),
- PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, fd,
- vr->num * getpagesize()) != vr->desc)
- err(1, "mmaping /dev/vring");
-
- /* This is subtle and nasty. If we lazily map this, Waker may
- * see different pages when we touch it, and hence it will get
- * a different result for poll(). */
- memset(vr->desc, 0, vring_size(vr->num, getpagesize()));
-
- /* Set offset & limit. */
- if (ioctl(fd, VRINGSETBASE, guest_base) != 0
- || ioctl(fd, VRINGSETLIMIT, guest_limit) != 0)
- err(1, "Setting vring offset and limit");
+ info.num_descs = vr->num;
+ info.descs = (unsigned long)vr->desc;
+ info.base = (unsigned long)guest_base;
+ info.limit = guest_limit;
+
+ /* Tell /dev/vring where the ring is */
+ if (ioctl(fd, VRINGSETINFO, &info) != 0)
+ err(1, "Setting up /dev/vring fd");
return fd;
}
--
1.5.4.1
next prev parent reply other threads:[~2008-06-13 13:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-13 13:57 [PATCH 0/0][RFC] KVM use of vringfd Mark McLoughlin
2008-06-13 13:57 ` [PATCH 1/5] vring: Replace mmap() interface with ioctl() Mark McLoughlin
2008-06-13 13:57 ` Mark McLoughlin [this message]
2008-06-13 13:57 ` [PATCH 3/5] kvm: qemu: Publish last_avail index in the ring Mark McLoughlin
2008-06-13 13:58 ` [PATCH 4/5] kvm: qemu: Use vringfd to eliminate copies Mark McLoughlin
2008-06-13 13:58 ` [PATCH 5/5] kvm: qemu: Add support for partial csums and GSO Mark McLoughlin
2008-06-14 23:28 ` [PATCH 4/5] kvm: qemu: Use vringfd to eliminate copies Anthony Liguori
2008-06-16 2:10 ` Rusty Russell
2008-06-16 14:02 ` Anthony Liguori
2008-06-16 14:58 ` Avi Kivity
2008-06-18 5:43 ` Rusty Russell
2008-06-18 14:01 ` Avi Kivity
2008-06-17 14:08 ` Mark McLoughlin
2008-06-17 14:54 ` Anthony Liguori
2008-06-17 15:45 ` Mark McLoughlin
2008-06-13 14:09 ` [PATCH 1/5] vring: Replace mmap() interface with ioctl() Avi Kivity
2008-06-17 12:19 ` Mark McLoughlin
2008-06-18 14:05 ` Avi Kivity
2008-06-14 9:02 ` Rusty Russell
2008-06-14 14:20 ` Avi Kivity
2008-06-14 23:23 ` Anthony Liguori
2008-06-15 15:24 ` Avi Kivity
2008-06-15 19:13 ` Anthony Liguori
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=1213365481-23460-3-git-send-email-markmc@redhat.com \
--to=markmc@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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