• Sean Christopherson's avatar
    KVM: VMX: Remove vCPU from PI wakeup list before updating PID.NV · baed82c8
    Sean Christopherson authored
    Remove the vCPU from the wakeup list before updating the notification
    vector in the posted interrupt post-block helper.  There is no need to
    wake the current vCPU as it is by definition not blocking.  Practically
    speaking this is a nop as it only shaves a few meager cycles in the
    unlikely case that the vCPU was migrated and the previous pCPU gets a
    wakeup IRQ right before PID.NV is updated.  The real motivation is to
    allow for more readable code in the future, when post-block is merged
    with vmx_vcpu_pi_load(), at which point removal from the list will be
    conditional on the old notification vector.
    
    Opportunistically add comments to document why KVM has a per-CPU spinlock
    that, at first glance, appears to be taken only on the owning CPU.
    Explicitly call out that the spinlock must be taken with IRQs disabled, a
    detail that was "lost" when KVM switched from spin_lock_irqsave() to
    spin_lock(), with IRQs disabled for the entirety of the relevant path.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20211009021236.4122790-29-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    baed82c8
posted_intr.c 9.5 KB