All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Mark McLoughlin <markmc@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 1/5] vring: Replace mmap() interface with ioctl()
Date: Fri, 13 Jun 2008 17:09:54 +0300	[thread overview]
Message-ID: <48527FB2.1060409@qumranet.com> (raw)
In-Reply-To: <1213365481-23460-2-git-send-email-markmc@redhat.com>

Mark McLoughlin wrote:
> /dev/vring's mmap() interface is a strange creature. It
> serves as a way for userland to supply the address of the
> already allocated ring descriptors, but causes those pages
> to be re-maped as a natural side effect of the mmap()
>
> This is not an issue for lguest because it does the mmap()
> before even starting the guest. However, in the case of kvm,
> the guest allocates the ring and informs the host of its
> addresss. If we then mmap() it, we cause it to be remapped
> to new pages which the vring driver will then use.
>
> Now, KVM guests don't actually use the ring pages before
> informing the host of its address, so we could probably just
> invalidate the guest's shadow page table and have the new
> pfns picked up. That would be an odd requirement to impose
> on the guest ABI, though.
>
> Since the mmap() semantics are so strange, switch to using a
> single ioctl() for setting up the ring.
>
>   

Definitely an improvement; iterfaces which seem familiar but aren't are 
not user friendly.

In any case the guest can't use the ring directly since physical memory 
is discontiguous.

> -	.ioctl		= vring_ioctl,
> +	.unlocked_ioctl	= vring_ioctl,
> +	.compat_ioctl	= vring_compat_ioctl,
>   

I think you can set compat_ioctl = vring_ioctl (that's what kvm does).

> diff --git a/include/linux/vring.h b/include/linux/vring.h
> index 47c8848..de4125d 100644
> --- a/include/linux/vring.h
> +++ b/include/linux/vring.h
> @@ -21,8 +21,14 @@
>  #include <linux/types.h>
>  
>  /* Ioctl defines. */
> -#define VRINGSETBASE	_IO(0xAD, 0)
> -#define VRINGSETLIMIT	_IO(0xAD, 1)
> +#define VRINGSETINFO _IO(0xAD, 0)
> +
> +struct vring_ioctl_info {
> +	__u16 num_descs;
>   

Padding for 64-bits here, otherwise compat_ioctl breaks.

> +	__u64 descs;
> +	__u64 base;
> +	__u64 limit;
> +};


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  parent reply	other threads:[~2008-06-13 14:09 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   ` [PATCH 2/5] lguest: Use VRINGSETINFO ioctl() instead of mmap() Mark McLoughlin
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   ` Avi Kivity [this message]
2008-06-17 12:19     ` [PATCH 1/5] vring: Replace mmap() interface with ioctl() 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=48527FB2.1060409@qumranet.com \
    --to=avi@qumranet.com \
    --cc=aliguori@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@redhat.com \
    --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 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.