Commit 63d04348 authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: x86: move kvm_create_vcpu_debugfs after last failure point

The placement of kvm_create_vcpu_debugfs is more or less irrelevant, since
it cannot fail and userspace should not care about the debugfs entries until
it knows the vcpu has been created.  Moving it after the last failure
point removes the need to remove the directory when unwinding the creation.
Reviewed-by: default avatarEmanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20200331224222.393439-1-pbonzini@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 1c164cb3
...@@ -3031,8 +3031,6 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) ...@@ -3031,8 +3031,6 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id)
if (r) if (r)
goto vcpu_free_run_page; goto vcpu_free_run_page;
kvm_create_vcpu_debugfs(vcpu);
mutex_lock(&kvm->lock); mutex_lock(&kvm->lock);
if (kvm_get_vcpu_by_id(kvm, id)) { if (kvm_get_vcpu_by_id(kvm, id)) {
r = -EEXIST; r = -EEXIST;
...@@ -3061,11 +3059,11 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) ...@@ -3061,11 +3059,11 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id)
mutex_unlock(&kvm->lock); mutex_unlock(&kvm->lock);
kvm_arch_vcpu_postcreate(vcpu); kvm_arch_vcpu_postcreate(vcpu);
kvm_create_vcpu_debugfs(vcpu);
return r; return r;
unlock_vcpu_destroy: unlock_vcpu_destroy:
mutex_unlock(&kvm->lock); mutex_unlock(&kvm->lock);
debugfs_remove_recursive(vcpu->debugfs_dentry);
kvm_arch_vcpu_destroy(vcpu); kvm_arch_vcpu_destroy(vcpu);
vcpu_free_run_page: vcpu_free_run_page:
free_page((unsigned long)vcpu->run); free_page((unsigned long)vcpu->run);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment