diff mbox series

[1/3] KVM: doc: Fix incorrect word ordering regarding supported use of APIs

Message ID 20190215204840.20070-2-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM: Fix device ioctl bug and update docs | expand

Commit Message

Sean Christopherson Feb. 15, 2019, 8:48 p.m. UTC
Per Paolo[1], instantiating multiple VMs in a single process is legal;
but this conflicts with KVM's API documentation, which states:

  The only supported use is one virtual machine per process, and one
  vcpu per thread.

However, an earlier section in the documentation states:

   Only run VM ioctls from the same process (address space) that was used
   to create the VM.

and:

   Only run vcpu ioctls from the same thread that was used to create the
   vcpu.

This suggests that the conflicting documentation is simply an incorrect
ordering of of words, i.e. what's really meant is that a virtual machine
can't be shared across multiple processes and a vCPU can't be shared
across multiple threads.

Tweak the blurb on issuing ioctls to use a more assertive tone, and
rewrite the "supported use" sentence to reference said blurb instead of
poorly restating it in different terms.

Opportunistically add missing punctuation.

[1] https://lkml.kernel.org/r/f23265d4-528e-3bd4-011f-4d7b8f3281db@redhat.com

Fixes: 9c1b96e34717 ("KVM: Document basic API")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 Documentation/virtual/kvm/api.txt | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Comments

Paolo Bonzini Feb. 22, 2019, 5:29 p.m. UTC | #1
On 15/02/19 21:48, Sean Christopherson wrote:
> Per Paolo[1], instantiating multiple VMs in a single process is legal;
> but this conflicts with KVM's API documentation, which states:
> 
>   The only supported use is one virtual machine per process, and one
>   vcpu per thread.

Which really was intended to be "one process per virtual machine" and
"one thread per vcpu" as you say below.

(In fact, very early versions of KVM support for upstream QEMU, back
when qemu-kvm was a thing, ran all vCPUs in the same thread with time
sharing...).

Paolo

> However, an earlier section in the documentation states:
> 
>    Only run VM ioctls from the same process (address space) that was used
>    to create the VM.
> 
> and:
> 
>    Only run vcpu ioctls from the same thread that was used to create the
>    vcpu.
> 
> This suggests that the conflicting documentation is simply an incorrect
> ordering of of words, i.e. what's really meant is that a virtual machine
> can't be shared across multiple processes and a vCPU can't be shared
> across multiple threads.
> 
> Tweak the blurb on issuing ioctls to use a more assertive tone, and
> rewrite the "supported use" sentence to reference said blurb instead of
> poorly restating it in different terms.
Paolo Bonzini Feb. 22, 2019, 5:30 p.m. UTC | #2
On 15/02/19 21:48, Sean Christopherson wrote:
> -   Only run vcpu ioctls from the same thread that was used to create the
> -   vcpu.
> +   vcpu ioctls ust be issued from the same thread that was used to create
> +   the vcpu.

This actually can be a bit more lenient.  Switching thread can have a
big performance impact, but it is not invalid.  Since I have to correct
that "ust" I'll clarify.

Paolo
Sean Christopherson Feb. 22, 2019, 5:44 p.m. UTC | #3
On Fri, Feb 22, 2019 at 06:30:51PM +0100, Paolo Bonzini wrote:
> On 15/02/19 21:48, Sean Christopherson wrote:
> > -   Only run vcpu ioctls from the same thread that was used to create the
> > -   vcpu.
> > +   vcpu ioctls ust be issued from the same thread that was used to create
> > +   the vcpu.
> 
> This actually can be a bit more lenient.  Switching thread can have a
> big performance impact, but it is not invalid.  Since I have to correct
> that "ust" I'll clarify.

I suspected as much but obviously wasn't confident enough to make the
change :-)
diff mbox series

Patch

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 356156f5c52d..aefd55e142fd 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -5,24 +5,24 @@  The Definitive KVM (Kernel-based Virtual Machine) API Documentation
 ----------------------
 
 The kvm API is a set of ioctls that are issued to control various aspects
-of a virtual machine.  The ioctls belong to three classes
+of a virtual machine.  The ioctls belong to three classes:
 
  - System ioctls: These query and set global attributes which affect the
    whole kvm subsystem.  In addition a system ioctl is used to create
-   virtual machines
+   virtual machines.
 
  - VM ioctls: These query and set attributes that affect an entire virtual
    machine, for example memory layout.  In addition a VM ioctl is used to
    create virtual cpus (vcpus).
 
-   Only run VM ioctls from the same process (address space) that was used
-   to create the VM.
+   VM ioctls must be issued from the same process (address space) that was
+   used to create the VM.
 
  - vcpu ioctls: These query and set attributes that control the operation
    of a single virtual cpu.
 
-   Only run vcpu ioctls from the same thread that was used to create the
-   vcpu.
+   vcpu ioctls ust be issued from the same thread that was used to create
+   the vcpu.
 
 
 2. File descriptors
@@ -41,9 +41,8 @@  In general file descriptors can be migrated among processes by means
 of fork() and the SCM_RIGHTS facility of unix domain socket.  These
 kinds of tricks are explicitly not supported by kvm.  While they will
 not cause harm to the host, their actual behavior is not guaranteed by
-the API.  The only supported use is one virtual machine per process,
-and one vcpu per thread.
-
+the API.  See "General description" for details on the ioctl usage
+model that is supported by KVM.
 
 3. Extensions
 -------------