Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- virt/kvm/eventfd.c | 44 ++++++++++++++++++++++++--------------------
- 1 file changed, 24 insertions(+), 20 deletions(-)
+ virt/kvm/eventfd.c | 34 ++++++++++++++--------------------
+ 1 file changed, 14 insertions(+), 20 deletions(-)
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
-@@ -147,21 +147,28 @@ irqfd_shutdown(struct work_struct *work)
+@@ -147,21 +147,18 @@ irqfd_shutdown(struct work_struct *work)
}
-irqfd_is_active(struct kvm_kernel_irqfd *irqfd)
+static bool irqfd_is_active(struct kvm_kernel_irqfd *irqfd)
{
-+ /*
-+ * Assert that either irqfds.lock or SRCU is held, as irqfds.lock must
-+ * be held to prevent false positives (on the irqfd being active), and
-+ * while false negatives are impossible as irqfds are never added back
-+ * to the list once they're deactivated, the caller must at least hold
-+ * SRCU to guard against routing changes if the irqfd is deactivated.
-+ */
-+ lockdep_assert_once(lockdep_is_held(&irqfd->kvm->irqfds.lock) ||
-+ srcu_read_lock_held(&irqfd->kvm->irq_srcu));
-+
return list_empty(&irqfd->list) ? false : true;
}
BUG_ON(!irqfd_is_active(irqfd));
list_del_init(&irqfd->list);
-@@ -198,8 +205,15 @@ irqfd_wakeup(wait_queue_entry_t *wait, u
+@@ -198,8 +195,15 @@ irqfd_wakeup(wait_queue_entry_t *wait, u
seq = read_seqcount_begin(&irqfd->irq_entry_sc);
irq = irqfd->irq_entry;
} while (read_seqcount_retry(&irqfd->irq_entry_sc, seq));
KVM_USERSPACE_IRQ_SOURCE_ID, 1,
false) == -EWOULDBLOCK)
schedule_work(&irqfd->inject);
-@@ -536,18 +550,8 @@ kvm_irqfd_deassign(struct kvm *kvm, stru
+@@ -536,18 +540,8 @@ kvm_irqfd_deassign(struct kvm *kvm, stru
spin_lock_irq(&kvm->irqfds.lock);
list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) {