From: Sean Christopherson Date: Thu, 22 May 2025 23:52:20 +0000 (-0700) Subject: KVM: Drop sanity check that per-VM list of irqfds is unique X-Git-Tag: v6.17-rc1~111^2~11^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b599d44a71f1aa1acff54b05e4c0e60ea82ed90c;p=thirdparty%2Fkernel%2Flinux.git KVM: Drop sanity check that per-VM list of irqfds is unique Now that the eventfd's waitqueue ensures it has at most one priority waiter, i.e. prevents KVM from binding multiple irqfds to one eventfd, drop KVM's sanity check that eventfds are unique for a single VM. Tested-by: K Prateek Nayak Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20250522235223.3178519-11-seanjc@google.com Signed-off-by: Sean Christopherson --- diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index ab9e3cfb81bfd..6b1133a6617f5 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -288,7 +288,6 @@ static void kvm_irqfd_register(struct file *file, wait_queue_head_t *wqh, { struct kvm_irqfd_pt *p = container_of(pt, struct kvm_irqfd_pt, pt); struct kvm_kernel_irqfd *irqfd = p->irqfd; - struct kvm_kernel_irqfd *tmp; struct kvm *kvm = p->kvm; /* @@ -328,16 +327,6 @@ static void kvm_irqfd_register(struct file *file, wait_queue_head_t *wqh, if (p->ret) goto out; - list_for_each_entry(tmp, &kvm->irqfds.items, list) { - if (irqfd->eventfd != tmp->eventfd) - continue; - - WARN_ON_ONCE(1); - /* This fd is used for another irq already. */ - p->ret = -EBUSY; - goto out; - } - list_add_tail(&irqfd->list, &kvm->irqfds.items); out: