public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	virtualization
	<virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: Re: [PATCH 00/10] PV-IO v3
Date: Fri, 17 Aug 2007 17:43:38 +1000	[thread overview]
Message-ID: <1187336618.6449.106.camel@localhost.localdomain> (raw)
In-Reply-To: <1187328402.4363.110.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>

On Fri, 2007-08-17 at 01:26 -0400, Gregory Haskins wrote:
> Hi Rusty,
> 
>  Comments inline...
> 
> On Fri, 2007-08-17 at 11:25 +1000, Rusty Russell wrote:
> > 
> > Transport has several parts.  What the hypervisor knows about (usually
> > shared memory and some interrupt mechanism and possibly "DMA") and what
> > is convention between users (eg. ringbuffer layouts).  Whether it's 1:1
> > or n-way (if 1:1, is it symmetrical?).
> 
> TBH, I am not sure what you mean by 1:1 vs n-way ringbuffers (its
> probably just lack of sleep and tomorrow I will smack myself for
> asking ;)
> 
> But could you elaborate here?

Hi Gregory,

	Sure, these discussions can get pretty esoteric.  The question is
whether you want a point-to-point transport (as we discuss here), or an
N-way.  Lguest has N-way, but I'm not convinced it's worthwhile, as
there's some overhead involved in looking up recipients (basically futex
code).

> > And not having inter-guest is just
> > poor form (and putting it in later is impossible, as we'll see).
> 
> I agree that having an ability to do inter-guest is a good idea.
> However, I don't know if I am convinced if it has to be done in a
> direct, zero-copy way. Mediating through the host certainly can work and
> is probably acceptable for most things.  In this way the host is
> essentially acting as a DMA agent to copy from one guests memory to the
> other.  It solves the "trust" issue and simplifies the need to have a
> "grant table" like mechanism which can get pretty hairy, IMHO.

I agree that page sharing is silly.  But we can design a mechanism where
it such a "DMA agent" need only enforce a few very simple rules not the
whole protocol, and yet the guest doesn't know whether it's talking to
an agent or the host.

> > So we end up with an array of descriptors with next pointers, and two
> > ring buffers which refer to those descriptors: one for what descriptors
> > are pending, and one for what descriptors have been used (by the other
> > end).
> 
> That's certainly one way to do it. IOQ (coming from the "simple ordered
> event sequence" mindset) has one logically linear ring.  It uses a set
> of two "head/tail" indices ("valid" and "inuse") and an ownership flag
> (per descriptor) to essentially offer similar services as you mention.
> Producers "push" items at the index head, and consumers "pop" items from
> the index tail.  Only the guest side can manipulate the valid index.
> Only the producer can manipulate the inuse-head.  And only the consumer
> can manipulate the inuse-tail.  Either side can manipulate the ownership
> bit, but only in strict accordance with the production or consumption of
> data.

Well, for cache reasons you should really try to avoid having both sides
write to the same data.  Hence two separate cache-aligned regions is
better than one region and a flip bit.  And if you make them separate
pages, then this can also be inter-guest safe 8)

> One thing that is particularly cool about the IOQ design is that its
> possible to get to 0 IO events for certain circumstances.  For instance,
> if you look at the IOQNET driver, it has what I would call
> "bidirectional NAPI".  I think everyone here probably understands how
> standard NAPI disables RX interrupts after the first packet is received
> Well, IOQNET can also disable TX hypercalls after the first one goes
> down to the host.  Any subsequent writes will simply post to the queue
> until the host catches up and re-enables "interrupts".  Maybe all of
> these queue schemes typically do that...im not sure...but I thought it
> was pretty cool.

Yeah, I agree.  I'm not sure how important it is IRL, but it *feels*
clever 8)

> > (1) have the hypervisor be aware of the descriptor page format, location
> > and which guest can access it.
> > (2) have the descriptors themselves contains a type (read/write) and a
> > valid bit.
> > (3) have a "DMA" hypercall to copy to/from someone else's descriptors.
> > 
> > Note that this means we do a copy for the untrusted case which doesn't
> > exist for the trusted case.  In theory the hypervisor could do some
> > tricky copy-on-write page-sharing for very large well-aligned buffers,
> > but it remains to be seen if that is actually useful.
> 
> That sounds *somewhat* similar to what I was getting at above with the
> dma/loopback thingy.  Though you are talking about that "grant table"
> stuff and are scaring me ;)

Yeah, I fear grant tables too.  But in any scheme, the descriptors imply
permission, so with a little careful design and implementation it should
"just work"...

Cheers,
Rusty.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

  parent reply	other threads:[~2007-08-17  7:43 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 23:13 [PATCH 00/10] PV-IO v3 Gregory Haskins
     [not found] ` <20070816231357.8044.55943.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-16 23:14   ` [PATCH 01/10] IOQ: Adding basic definitions for IO-Queue logic Gregory Haskins
2007-08-16 23:14   ` [PATCH 02/10] PARAVIRTUALIZATION: Add support for a bus abstraction Gregory Haskins
2007-08-16 23:14   ` [PATCH 03/10] IOQ: Add an IOQ network driver Gregory Haskins
2007-08-16 23:14   ` [PATCH 04/10] IOQNET: Add a test harness infrastructure to IOQNET Gregory Haskins
2007-08-16 23:14   ` [PATCH 05/10] IRQ: Export create_irq/destroy_irq Gregory Haskins
2007-08-16 23:14   ` [PATCH 06/10] KVM: Add a guest side driver for IOQ Gregory Haskins
2007-08-16 23:14   ` [PATCH 07/10] KVM: Add a gpa_to_hva helper function Gregory Haskins
2007-08-16 23:14   ` [PATCH 08/10] KVM: Add support for IOQ Gregory Haskins
2007-08-16 23:14   ` [PATCH 09/10] KVM: Add PVBUS support to the KVM host Gregory Haskins
2007-08-16 23:14   ` [PATCH 10/10] KVM: Add an IOQNET backend driver Gregory Haskins
2007-08-17  1:25   ` [PATCH 00/10] PV-IO v3 Rusty Russell
     [not found]     ` <1187313953.6449.70.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-17  5:26       ` Gregory Haskins
     [not found]         ` <1187328402.4363.110.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-17  7:43           ` Rusty Russell [this message]
     [not found]             ` <1187336618.6449.106.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-17 13:50               ` Gregory Haskins
     [not found]                 ` <1187358614.4363.135.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-20 23:28                   ` Rusty Russell
     [not found]                     ` <1187652496.19435.141.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-21  7:33                       ` Dor Laor
     [not found]                         ` <64F9B87B6B770947A9F8391472E032160D464FEB-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-08-21  7:58                           ` Rusty Russell
     [not found]                             ` <1187683122.19435.171.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-21 12:00                               ` Gregory Haskins
     [not found]                                 ` <1187697638.4363.277.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-21 12:25                                   ` Avi Kivity
     [not found]                                     ` <46CAD9CC.6050209-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-21 13:11                                       ` Gregory Haskins
2007-08-21 13:47                                   ` Rusty Russell
     [not found]                                     ` <1187704038.19435.194.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-21 14:06                                       ` Gregory Haskins
     [not found]                                         ` <1187705162.4363.323.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-21 16:47                                           ` Gregory Haskins
     [not found]                                             ` <1187714864.4363.358.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-21 17:12                                               ` Avi Kivity
     [not found]                                                 ` <46CB1D06.1040005-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-21 17:17                                                   ` Gregory Haskins
2007-08-22  3:29                                               ` Rusty Russell
     [not found]                                                 ` <1187753365.6174.26.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-22  9:18                                                   ` Christian Borntraeger
     [not found]                                                     ` <200708221118.00990.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-08-22  9:26                                                       ` Dor Laor
     [not found]                                                         ` <64F9B87B6B770947A9F8391472E032160D503D81-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-08-22  9:30                                                           ` Christian Borntraeger
     [not found]                                                             ` <200708221130.17364.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-08-22 10:05                                                               ` Dor Laor
2007-08-22 10:40                                                           ` Rusty Russell
     [not found]                                                             ` <1187779205.6174.87.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-22 11:47                                                               ` Avi Kivity
2007-08-21 12:29                               ` Avi Kivity
2007-08-19  9:24       ` Avi Kivity
     [not found]         ` <46C80C5B.7070009-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-20 13:50           ` Gregory Haskins
2007-08-20 14:03             ` [kvm-devel] " Dor Laor
     [not found]               ` <64F9B87B6B770947A9F8391472E032160D4649E2-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-08-20 14:12                 ` Avi Kivity
     [not found]                   ` <46C9A150.60101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-20 23:24                     ` Rusty Russell
2007-08-20 14:17                 ` Gregory Haskins
     [not found]             ` <1187617806.4363.179.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-20 14:14               ` Avi Kivity

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=1187336618.6449.106.camel@localhost.localdomain \
    --to=rusty-8n+1lvoiyb80n/f98k4iww@public.gmane.org \
    --cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox