• Sean Christopherson's avatar
    KVM: Initialize IRQ FD after arch hardware setup · 5910ccf0
    Sean Christopherson authored
    Move initialization of KVM's IRQ FD workqueue below arch hardware setup
    as a step towards consolidating arch "init" and "hardware setup", and
    eventually towards dropping the hooks entirely.  There is no dependency
    on the workqueue being created before hardware setup, the workqueue is
    used only when destroying VMs, i.e. only needs to be created before
    /dev/kvm is exposed to userspace.
    
    Move the destruction of the workqueue before the arch hooks to maintain
    symmetry, and so that arch code can move away from the hooks without
    having to worry about ordering changes.
    
    Reword the comment about kvm_irqfd_init() needing to come after
    kvm_arch_init() to call out that kvm_arch_init() must come before common
    KVM does _anything_, as x86 very subtly relies on that behavior to deal
    with multiple calls to kvm_init(), e.g. if userspace attempts to load
    kvm_amd.ko and kvm_intel.ko.  Tag the code with a FIXME, as x86's subtle
    requirement is gross, and invoking an arch callback as the very first
    action in a helper that is called only from arch code is silly.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20221130230934.1014142-3-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    5910ccf0
kvm_main.c 153 KB