KVM: Register /dev/kvm as the _very_ last thing during initialization
authorSean Christopherson <seanjc@google.com>
Wed, 30 Nov 2022 23:08:45 +0000 (23:08 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 29 Dec 2022 20:40:42 +0000 (15:40 -0500)
commit2b01281273738bf2d6551da48d65db2df3f28998
tree6ee703c204f8bccf0e53400215076754921d72ff
parentfc471e831016c1741f3e8042997969ace0b5a013
KVM: Register /dev/kvm as the _very_ last thing during initialization

Register /dev/kvm, i.e. expose KVM to userspace, only after all other
setup has completed.  Once /dev/kvm is exposed, userspace can start
invoking KVM ioctls, creating VMs, etc...  If userspace creates a VM
before KVM is done with its configuration, bad things may happen, e.g.
KVM will fail to properly migrate vCPU state if a VM is created before
KVM has registered preemption notifiers.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221130230934.1014142-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c