[Devel] [PATCH RHEL7 COMMIT] ms/kvm/eventfd: avoid loop inside irqfd_update()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Feb 16 01:50:12 PST 2016


The commit is pushed to "branch-rh7-3.10.0-327.4.5.vz7.11.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.4.5.vz7.11.2
------>
commit 852572af5f9dcb2a426f5f69952441ce9b4138d3
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date:   Tue Feb 16 13:50:12 2016 +0400

    ms/kvm/eventfd: avoid loop inside irqfd_update()
    
    The loop(for) inside irqfd_update() is unnecessary
    because any other value for irq_entry.type will just trigger
    schedule_work(&irqfd->inject) in irqfd_wakeup.
    
    ms commit 351dc6477cd35136ce4668401b1b1332a62908a8.
    
    Signed-off-by: Andrey Smetanin <asmetanin at virtuozzo.com>
    
    Reviewed-by: Roman Kagan <rkagan at virtuozzo.com>
    Signed-off-by: Denis V. Lunev <den at openvz.org>
    CC: Vitaly Kuznetsov <vkuznets at redhat.com>
    CC: "K. Y. Srinivasan" <kys at microsoft.com>
    CC: Gleb Natapov <gleb at kernel.org>
    CC: Paolo Bonzini <pbonzini at redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 virt/kvm/eventfd.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 148b239..f3a34f0 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -283,20 +283,17 @@ static void irqfd_update(struct kvm *kvm, struct _irqfd *irqfd)
 {
 	struct kvm_kernel_irq_routing_entry *e;
 	struct kvm_kernel_irq_routing_entry entries[KVM_NR_IRQCHIPS];
-	int i, n_entries;
+	int n_entries;
 
 	n_entries = kvm_irq_map_gsi(kvm, entries, irqfd->gsi);
 
 	write_seqcount_begin(&irqfd->irq_entry_sc);
 
-	irqfd->irq_entry.type = 0;
-
 	e = entries;
-	for (i = 0; i < n_entries; ++i, ++e) {
-		/* Only fast-path MSI. */
-		if (e->type == KVM_IRQ_ROUTING_MSI)
-			irqfd->irq_entry = *e;
-	}
+	if (n_entries == 1)
+		irqfd->irq_entry = *e;
+	else
+		irqfd->irq_entry.type = 0;
 
 	write_seqcount_end(&irqfd->irq_entry_sc);
 }


More information about the Devel mailing list