public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org
Cc: kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Subject: Re: virtio & hypercall interface?
Date: Sat, 15 Sep 2007 17:49:10 -0500	[thread overview]
Message-ID: <46EC6166.4010007@codemonkey.ws> (raw)
In-Reply-To: <46EC5515.2020004-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Dor Laor wrote:
>> Can you elaborate here?  Using a PCI discover mechanism, you've got 
>> your memory already.  Not point in reinventing PCI with hypercalls.
>>     
> In this case I agree that it should be done using pci/other_bus config 
> space.
>   
>>> 2. For other purposes such as a balloon driver, a deflate/inflate 
>>> hypercalls are needed.
>>>    Although for x86 mmio/pio can be used but this is not compatible 
>>> with other architectures.
>>>       
>> Isn't a balloon driver just another virtio device?  Rather, it might 
>> be interesting to build a simple RPC mechanism on top of virtio and do 
>> things like balloon on top of that.
>>     
> Currently the balloon driver is not a virtio device but it will become 
> one, nevertheless, not all devices must be virtio, and we cannot predict 
> all sort
> of usages. Even if a device can work over virtio it shouldn't be a 
> perquisite.
>
> I have another two new points in favor of userspace hypercall handling:
> 1. Hypercalls needed for pci pass through devices.
>     We have an home grown implementation for pci pass through devices 
> that will soon be merged.
>      It allows redirecting a physical pci device into a guest.
>      The guest kernel issues hypercalls to know whether a device is 
> physical or not. It's much more easy to let
>      userspace catch them since it is aware of all devices, unlike the 
> kernel.
>   

It's really hard to say here without seeing the code but if you really 
need to use a hypercall, then I think the better thing to do is define 
an higher level interface (like an exit reason) and do the translation 
from hypercall to this exit reason.  There's no performance difference 
doing this.

My thinking is that there will be other userspace other than QEMU.  The 
hypercall interface is static and needs to be treated as the host=>guest 
ABI.  By allowing hypercalls to be interpreted by userspace, you are now 
making the host=>guest ABI depend on userspace too instead of just 
kernel space.

The only argument I can see for passing through hypercalls:

1) you may want two separate userspaces to define the same hypercall 
number in two different ways

2) it's easier to just pass through the hypercall by default than it is 
to translate to a higher level exit reason

I think #1 is fundamentally a bad thing to do allow.  I think #2 is not 
justified because you're just making the hypercall interface part of the 
kernel/userspace interface anyway.

> 2. Vmexit speeds
>    Theoretically, vmcall should be faster than pio/mmio for the bare 
> hardware.
>    When implementing PV driver, the guest implementation is agnostic to 
> the host implementation. For maximum performance
>    the host side will use kernel modules while for flexibility a 
> userspace implementation will do the job.
>    So although vmcall efficiency is neglectable comparing to context 
> switch to user, there will be occasions were the host has a PV driver 
> backend.
>   

Whether to use hypercalls vs. PIO is a separate issue from whether 
hypercalls should be handled in userspace.  I think we should always 
handle hypercalls in kernel space and that the hypercall interface ought 
to be defined within the kernel.  Now, this doesn't mean that the result 
of a hypercall can't be dropping down to userspace but I don't think we 
should do it blindly.

> Does it help changing your minds?
>   

No, but I'm hoping that I can change yours :-)

Regards,

Anthony Liguori

> Dor
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  parent reply	other threads:[~2007-09-15 22:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-13  6:21 virtio & hypercall interface? Rusty Russell
     [not found] ` <1189664514.32322.14.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-09-13 19:21   ` Anthony Liguori
     [not found]     ` <46E98DC0.3050509-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-13 21:26       ` Rusty Russell
     [not found]         ` <1189718818.32322.41.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-09-13 21:41           ` Anthony Liguori
2007-09-13 20:33   ` Dor Laor
     [not found]     ` <64F9B87B6B770947A9F8391472E032160DA17EF2-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-09-13 20:45       ` Anthony Liguori
     [not found]         ` <46E9A17D.5040205-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-14 16:46           ` Avi Kivity
     [not found]             ` <46EABAD0.40300-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-14 22:31               ` Dor Laor
     [not found]                 ` <46EB0BD8.6040000-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-15  3:06                   ` Rusty Russell
     [not found]                     ` <1189825560.7262.77.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-09-15  8:05                       ` Avi Kivity
     [not found]                         ` <46EB9245.4010005-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-15  8:32                           ` Rusty Russell
     [not found]                             ` <1189845153.7262.94.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-09-15  9:38                               ` Avi Kivity
     [not found]                                 ` <46EBA806.6070507-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-16  7:50                                   ` Rusty Russell
     [not found]                                     ` <1189929012.7262.105.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-09-16  8:57                                       ` Avi Kivity
     [not found]                                         ` <46ECEFEE.6000208-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-16  9:35                                           ` Rusty Russell
     [not found]                                             ` <1189935324.7262.120.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-09-16  9:45                                               ` Avi Kivity
2007-09-15  7:59                   ` Avi Kivity
2007-09-15 17:31                   ` Anthony Liguori
     [not found]                     ` <46EC1709.2080803-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-15 21:56                       ` Dor Laor
     [not found]                         ` <46EC5515.2020004-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-15 22:49                           ` Anthony Liguori [this message]
2007-09-14 16:44   ` Avi Kivity
     [not found]     ` <46EABA59.10808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-14 16:49       ` 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=46EC6166.4010007@codemonkey.ws \
    --to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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