public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 1/10] Trivial: /dev/kvm interface is no longer experimental.
Date: Wed, 18 Jul 2007 12:31:23 +0300	[thread overview]
Message-ID: <469DDDEB.9070009@qumranet.com> (raw)
In-Reply-To: <200707171835.53092.arnd-r2nGTMty4D4@public.gmane.org>

Arnd Bergmann wrote:
> The equivalent of the current set of ioctls comes down to roughtly this
> set of syscalls:
>
> int kvm_create_vm(void);
> int kvm_get_msr_index_list(int fd, sttuct kvm_msr_list);
> size_t kvm_get_vcpu_mmap_size(int fd);
> int kvm_set_memory_region(int fd, unsigned slot, unsigned flags,
> 	__u64 guest_phys_addr, __u64 size);
> int kvm_create_vcpu(int fd);
> int kvm_get_dirty_log(int fd, unsigned slot, void *dirty_bitmap);
> int kvm_get_memory_alias(int fd, struct kvm_memory_region *region);
> int kvm_run(int fd);
> int kvm_get_regs(int fd, struct kvm_regs *regs);
> int kvm_set_regs(int fd, const struct kvm_regs *regs);
> int kvm_get_sregs(int fd, struct kvm_sregs *sregs);
> int kvm_set_sregs(int fd, const struct kvm_sregs *sregs);
> int kvm_translate(int fd, __u64 linear_address, __u64 *physical_address,
> 		__u8  *valid, __u8 *writeable, __u8 *usemode);
> int kvm_interrupt(int fd, __u32 irq);
> int kvm_debug_guest(...);
> int kvm_get_msrs(...);
> int kvm_set_msrs(...);
> int kvm_set_cpuid(...);
> int kvm_set_signal_mask(...);
> int kvm_get_fpu(...);
> int kvm_set_fpu(...);
>
> That's a lot of system calls! The only ioctl calls that can immediately
> go away are KVM_GET_API_VERSION and KVM_CHECK_EXTENSION, if the API
> is fixed.
>   

Many can be merged (set_fpu, set_regs, set_sregs).  We will need
CHECK_EXTENSION as long as we are unable to predict the future (well,
for syscalls that are intended to be invoked on initialization only we
can use ENOSYS).

> Before moving to the final syscall interface, I'd wait for the memory
> model to have moved to using a region of the host process address instead
> of a separate address range. As I understood Carsten, that's what was
> discussed in Ottawa anyway. It can probably remove a few of the
> existing ioctl calls.
>   

We will also wait until we get most ports working, so we get a chance to
test it in real life.

> Some more can be saved by changing the interface for the kvm_get/set_*
> calls. One way I can see this done at the syscall level is to replace
> kvm_get_regs() with
>
> regsfd = openat(vcpu, "regs", O_RDWR);
> (void)read(regsfs, &regs, sizeof (regs);
>
> Some of the others can also be done with files like this, e.g. writing
> to an "interrupt" file. Of course, you would keep the file descriptors
> open for the life time of the guest.
>   

Once we're back to using fds, we might as well use ioctls.  If anything,
an ioctl has an explicit mention of the structure it manipulates in its
definition.  I don't care that it came in last in the last 15 annual
kernel beauty contests.

For me, the difference between syscalls and ioctls is whether the vcpu
is bound to a task (and the vm bound to the mm) rather than whether the
names are spelled in lowercase or uppercase.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-07-18  9:31 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 13:12 [PATCH 1/10] Trivial: /dev/kvm interface is no longer experimental Rusty Russell
     [not found] ` <1184677946.10380.4.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:14   ` [PATCH 2/10] Trivial: Remove KVM_IRQ_BITMAP macro Rusty Russell
     [not found]     ` <1184678060.10380.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:15       ` [PATCH 3/10] Trivial: Remove unused struct cpu_user_regs declaration Rusty Russell
     [not found]         ` <1184678129.10380.10.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:16           ` [PATCH 4/10] Trivial: Make decode_register() static Rusty Russell
     [not found]             ` <1184678171.10380.12.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:16               ` [PATCH 5/10] Trivial: Comment spelling may escape grep Rusty Russell
     [not found]                 ` <1184678216.10380.14.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:17                   ` [PATCH 6/10] Trivial: Avoid hardware_disable predeclaration Rusty Russell
     [not found]                     ` <1184678275.10380.16.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:19                       ` [PATCH 7/10] Trivial: Use standard CR0 flags macros from asm/cpu-features.h Rusty Russell
     [not found]                         ` <1184678348.10380.19.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:32                           ` [PATCH 8/10] Use standard CR3 flags, tighten checking Rusty Russell
     [not found]                             ` <1184679175.10380.25.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:34                               ` [PATCH 9/10] Use standard CR4 " Rusty Russell
     [not found]                                 ` <1184679256.10380.27.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:37                                   ` [PATCH 10/10] Use standard CR8 flags, and fix TPR definition Rusty Russell
     [not found]                                     ` <1184679437.10380.31.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-17 13:44                                       ` Avi Kivity
     [not found]                                         ` <469CC7CC.7050102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-17 16:01                                           ` H. Peter Anvin
2007-07-17 16:00                                       ` H. Peter Anvin
     [not found]                                         ` <469CE79D.7030001-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2007-07-18 18:09                                           ` Avi Kivity
2007-07-17 13:40                                   ` [PATCH 9/10] Use standard CR4 flags, tighten checking Avi Kivity
2007-07-17 13:36                               ` [PATCH 8/10] Use standard CR3 " Avi Kivity
2007-07-17 13:33                           ` [PATCH 7/10] Trivial: Use standard CR0 flags macros from asm/cpu-features.h Avi Kivity
2007-07-17 13:32                       ` [PATCH 6/10] Trivial: Avoid hardware_disable predeclaration Avi Kivity
2007-07-17 13:29                   ` [PATCH 5/10] Trivial: Comment spelling may escape grep Avi Kivity
2007-07-17 13:29               ` [PATCH 4/10] Trivial: Make decode_register() static Avi Kivity
2007-07-17 13:28           ` [PATCH 3/10] Trivial: Remove unused struct cpu_user_regs declaration Avi Kivity
2007-07-17 13:25       ` [PATCH 2/10] Trivial: Remove KVM_IRQ_BITMAP macro Avi Kivity
     [not found]         ` <469CC367.1000107-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-18  3:05           ` Rusty Russell
     [not found]             ` <1184727958.10380.54.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-18  9:12               ` Avi Kivity
2007-07-17 13:28   ` [PATCH 1/10] Trivial: /dev/kvm interface is no longer experimental Avi Kivity
2007-07-17 16:35   ` Arnd Bergmann
     [not found]     ` <200707171835.53092.arnd-r2nGTMty4D4@public.gmane.org>
2007-07-17 23:49       ` Rusty Russell
     [not found]         ` <1184716197.10380.45.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-18  9:23           ` Avi Kivity
2007-07-18  9:31       ` Avi Kivity [this message]
     [not found]         ` <469DDDEB.9070009-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-18 23:43           ` Arnd Bergmann

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=469DDDEB.9070009@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@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