public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gregory Haskins <ghaskins@novell.com>
To: Chris Wright <chrisw@sous-sol.org>
Cc: Gregory Haskins <gregory.haskins@gmail.com>,
	Avi Kivity <avi@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [RFC PATCH 0/3] generic hypercall support
Date: Tue, 05 May 2009 23:51:03 -0400	[thread overview]
Message-ID: <4A010927.6020207@novell.com> (raw)
In-Reply-To: <20090505231718.GT3036@sequoia.sous-sol.org>

[-- Attachment #1: Type: text/plain, Size: 4182 bytes --]

Chris Wright wrote:
> * Gregory Haskins (gregory.haskins@gmail.com) wrote:
>   
>> So you would never have someone making a generic
>> hypercall(KVM_HC_MMU_OP).  I agree.
>>     
>
> Which is why I think the interface proposal you've made is wrong.

I respectfully disagree.  Its only wrong in that the name chosen for the
interface was perhaps too broad/vague.  I still believe the concept is
sound, and the general layering is appropriate. 

>   There's
> already hypercall interfaces w/ specific ABI and semantic meaning (which
> are typically called directly/indirectly from an existing pv op hook).
>   

Yes, these are different, thus the new interface.

> But a free-form hypercall(unsigned long nr, unsigned long *args, size_t count)
> means hypercall number and arg list must be the same in order for code
> to call hypercall() in a hypervisor agnostic way.
>   

Yes, and that is exactly the intention.  I think its perhaps the point
you are missing.

I am well aware that historically the things we do over a hypercall
interface would inherently have meaning only to a specific hypervisor
(e.g. KVM_HC_MMU_OPS (vector 2) via kvm_hypercall()).  However, this
doesn't in any way infer that it is the only use for the general
concept.  Its just the only way they have been exploited to date.

While I acknowledge that the hypervisor certainly must be coordinated
with their use, in their essence hypercalls are just another form of IO
joining the ranks of things like MMIO and PIO.  This is an attempt to
bring them out of the bowels of CONFIG_PARAVIRT to make them a first
class citizen. 

The thing I am building here is really not a general hypercall in the
broad sense.  Rather, its a subset of the hypercall vector namespace. 
It is designed specifically for dynamic binding a synchronous call()
interface to things like virtual devices, and it is therefore these
virtual device models that define the particular ABI within that
namespace.  Thus the ABI in question is explicitly independent of the
underlying hypervisor.  I therefore stand by the proposed design to have
this interface described above the hypervisor support layer (i.e.
pv_ops) (albeit with perhaps a better name like "dynamic hypercall" as
per my later discussion with Avi).

Consider PIO: The hypervisor (or hardware) and OS negotiate a port
address, but the two end-points are the driver and the device-model (or
real device).  The driver doesnt have to say:

if (kvm)
   kvm_iowrite32(addr, ..);
else if (lguest)
   lguest_iowrite32(addr, ...);
else
   native_iowrite32(addr, ...);

Instead, it just says "iowrite32(addr, ...);" and the address is used to
route the message appropriately by the platform.  The ABI of that
message, however, is specific to the driver/device and is not
interpreted by kvm/lguest/native-hw infrastructure on the way.

Today, there is no equivelent of a platform agnostic "iowrite32()" for
hypercalls so the driver would look like the pseudocode above except
substitute with kvm_hypercall(), lguest_hypercall(), etc.  The proposal
is to allow the hypervisor to assign a dynamic vector to resources in
the backend and convey this vector to the guest (such as in PCI
config-space as mentioned in my example use-case).  The provides the
"address negotiation" function that would normally be done for something
like a pio port-address.   The hypervisor agnostic driver can then use
this globally recognized address-token coupled with other device-private
ABI parameters to communicate with the device.  This can all occur
without the core hypervisor needing to understand the details beyond the
addressing.

What this means to our interface design is that the only thing the
hypervisor really cares about is the first "nr" parameter.  This acts as
our address-token.  The optional/variable list of args is just payload
as far as the core infrastructure is concerned and are coupled only to
our device ABI.  They were chosen to be an array of ulongs (vs something
like vargs) to reflect the fact that hypercalls are typically passed by
packing registers.

Hope this helps,
-Greg



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]

  reply	other threads:[~2009-05-06  3:51 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-05 13:24 [RFC PATCH 0/3] generic hypercall support Gregory Haskins
2009-05-05 13:24 ` [RFC PATCH 1/3] add " Gregory Haskins
2009-05-05 17:03   ` Hollis Blanchard
2009-05-06 13:52   ` Anthony Liguori
2009-05-06 15:16     ` Gregory Haskins
2009-05-06 16:52       ` Arnd Bergmann
2009-05-05 13:24 ` [RFC PATCH 2/3] x86: " Gregory Haskins
2009-05-05 13:24 ` [RFC PATCH 3/3] kvm: add pv_cpu_ops.hypercall support to the guest Gregory Haskins
2009-05-05 13:36 ` [RFC PATCH 0/3] generic hypercall support Avi Kivity
2009-05-05 13:40   ` Gregory Haskins
2009-05-05 14:00     ` Avi Kivity
2009-05-05 14:14       ` Gregory Haskins
2009-05-05 14:21         ` Gregory Haskins
2009-05-05 15:02         ` Avi Kivity
2009-05-05 23:17         ` Chris Wright
2009-05-06  3:51           ` Gregory Haskins [this message]
2009-05-06  7:22             ` Chris Wright
2009-05-06 13:17               ` Gregory Haskins
2009-05-06 16:07                 ` Chris Wright
2009-05-07 17:03                   ` Gregory Haskins
2009-05-07 18:05                     ` Avi Kivity
2009-05-07 18:08                       ` Gregory Haskins
2009-05-07 18:12                         ` Avi Kivity
2009-05-07 18:16                           ` Gregory Haskins
2009-05-07 18:24                             ` Avi Kivity
2009-05-07 18:37                               ` Gregory Haskins
2009-05-07 19:00                                 ` Avi Kivity
2009-05-07 19:05                                   ` Gregory Haskins
2009-05-07 19:43                                     ` Avi Kivity
2009-05-07 20:07                                       ` Gregory Haskins
2009-05-07 20:15                                         ` Avi Kivity
2009-05-07 20:26                                           ` Gregory Haskins
2009-05-08  8:35                                             ` Avi Kivity
2009-05-08 11:29                                               ` Gregory Haskins
2009-05-07 19:07                                   ` Chris Wright
2009-05-07 19:12                                     ` Gregory Haskins
2009-05-07 19:21                                       ` Chris Wright
2009-05-07 19:26                                         ` Avi Kivity
2009-05-07 19:44                                           ` Avi Kivity
2009-05-07 19:29                                         ` Gregory Haskins
2009-05-07 20:25                                           ` Chris Wright
2009-05-07 20:34                                             ` Gregory Haskins
2009-05-07 20:54                                           ` Arnd Bergmann
2009-05-07 21:13                                             ` Gregory Haskins
2009-05-07 21:57                                               ` Chris Wright
2009-05-07 22:11                                                 ` Arnd Bergmann
2009-05-08 22:33                                                   ` Benjamin Herrenschmidt
2009-05-11 13:01                                                     ` Arnd Bergmann
2009-05-11 13:04                                                       ` Gregory Haskins
2009-05-07 20:00                             ` Arnd Bergmann
2009-05-07 20:31                               ` Gregory Haskins
2009-05-07 20:42                                 ` Arnd Bergmann
2009-05-07 20:47                                   ` Arnd Bergmann
2009-05-07 20:50                                 ` Chris Wright
2009-05-07 23:35                     ` Marcelo Tosatti
2009-05-07 23:43                       ` Marcelo Tosatti
2009-05-08  3:17                         ` Gregory Haskins
2009-05-08  7:55                         ` Avi Kivity
     [not found]                           ` <20090508103253.GC3011@amt.cnet>
2009-05-08 11:37                             ` Avi Kivity
2009-05-08  3:13                       ` Gregory Haskins
2009-05-08  7:59                       ` Avi Kivity
2009-05-08 11:09                         ` Gregory Haskins
     [not found]                         ` <20090508104228.GD3011@amt.cnet>
2009-05-08 12:43                           ` Gregory Haskins
2009-05-08 15:33                             ` Marcelo Tosatti
2009-05-08 19:02                               ` Avi Kivity
2009-05-08 16:48                             ` Paul E. McKenney
2009-05-08 19:55                               ` Gregory Haskins
2009-05-08 14:15                       ` Gregory Haskins
2009-05-08 14:53                         ` Anthony Liguori
2009-05-08 18:50                           ` Avi Kivity
2009-05-08 19:02                             ` Anthony Liguori
2009-05-08 19:06                               ` Avi Kivity
2009-05-11 16:37                               ` Jeremy Fitzhardinge
2009-05-07 12:29                 ` Avi Kivity
2009-05-08 14:59                   ` Anthony Liguori
2009-05-09 12:01                     ` Gregory Haskins
2009-05-10 18:38                       ` Anthony Liguori
2009-05-11 13:14                         ` Gregory Haskins
2009-05-11 16:35                           ` Hollis Blanchard
2009-05-11 17:06                             ` Avi Kivity
2009-05-11 17:29                               ` Gregory Haskins
2009-05-11 17:53                                 ` Avi Kivity
2009-05-11 17:51                               ` Anthony Liguori
2009-05-11 18:02                                 ` Avi Kivity
2009-05-11 18:18                                   ` Anthony Liguori
2009-05-11 17:31                           ` Anthony Liguori
2009-05-13 10:53                             ` Gregory Haskins
2009-05-13 14:45                             ` Gregory Haskins
2009-05-11 16:44                         ` Hollis Blanchard
2009-05-11 17:54                           ` Anthony Liguori
2009-05-11 19:24                             ` PowerPC page faults Hollis Blanchard
2009-05-11 22:17                               ` Anthony Liguori
2009-05-12  5:46                                 ` Liu Yu-B13201
2009-05-12 14:50                                 ` Hollis Blanchard
2009-05-06 13:56             ` [RFC PATCH 0/3] generic hypercall support Anthony Liguori
2009-05-06 16:03               ` Gregory Haskins
2009-05-08  8:17                 ` Avi Kivity
2009-05-08 15:20                   ` Gregory Haskins
2009-05-08 17:00                     ` Avi Kivity
2009-05-08 18:55                       ` Gregory Haskins
2009-05-08 19:05                         ` Anthony Liguori
2009-05-08 19:12                         ` Avi Kivity
2009-05-08 19:59                           ` Gregory Haskins
2009-05-10  9:59                             ` 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=4A010927.6020207@novell.com \
    --to=ghaskins@novell.com \
    --cc=avi@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=gregory.haskins@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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