• Oliver Upton's avatar
    KVM: Actually create debugfs in kvm_create_vm() · b74ed7a6
    Oliver Upton authored
    Doing debugfs creation after vm creation leaves things in a
    quasi-initialized state for a while. This is further complicated by the
    fact that we tear down debugfs from kvm_destroy_vm(). Align debugfs and
    stats init/destroy with the vm init/destroy pattern to avoid any
    headaches.
    
    Note the fix for a benign mistake in error handling for calls to
    kvm_arch_create_vm_debugfs() rolled in. Since all implementations of
    the function return 0 unconditionally it isn't actually a bug at
    the moment.
    
    Lastly, tear down debugfs/stats data in the kvm_create_vm_debugfs()
    error path. Previously it was safe to assume that kvm_destroy_vm() would
    take out the garbage, that is no longer the case.
    Signed-off-by: default avatarOliver Upton <oupton@google.com>
    Message-Id: <20220720092259.3491733-6-oliver.upton@linux.dev>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    b74ed7a6
kvm_main.c 150 KB