[Bug 217379] Latency issues in irq_bypass_register_consumer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=217379

--- Comment #2 from zhuangel (zhuangel570@xxxxxxxxx) ---
Thanks for the suggestion, Sean.

Before we had a complete optimize for irq_bypass, do you think such kind of fix
is acceptable. We should provide VMM with the ability to turn off irq_bypass
feature for device not need irq_bypass:


diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 737318b1c1d9..a7a018ce954a 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1292,7 +1292,7 @@ struct kvm_xen_hvm_config {
 };
 #endif

-#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
+#define KVM_IRQFD_FLAG_DEASSIGN                (1 << 0)
 /*
  * Available with KVM_CAP_IRQFD_RESAMPLE
  *
@@ -1300,7 +1300,8 @@ struct kvm_xen_hvm_config {
  * the irqfd to operate in resampling mode for level triggered interrupt
  * emulation.  See Documentation/virt/kvm/api.rst.
  */
-#define KVM_IRQFD_FLAG_RESAMPLE (1 << 1)
+#define KVM_IRQFD_FLAG_RESAMPLE                (1 << 1)
+#define KVM_IRQFD_FLAG_NO_BYPASS       (1 << 2)

 struct kvm_irqfd {
        __u32 fd;
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index b0af834ffa95..90fa203d7ef3 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -425,7 +425,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
                schedule_work(&irqfd->inject);

 #ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
-       if (kvm_arch_has_irq_bypass()) {
+       if (!(args->flags & KVM_IRQFD_FLAG_NO_BYPASS) &&
kvm_arch_has_irq_bypass()) {
                irqfd->consumer.token = (void *)irqfd->eventfd;
                irqfd->consumer.add_producer =
kvm_arch_irq_bypass_add_producer;
                irqfd->consumer.del_producer =
kvm_arch_irq_bypass_del_producer;
@@ -587,7 +587,8 @@ kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args)
 int
 kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
 {
-       if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))
+       if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE
+                               | KVM_IRQFD_FLAG_NO_BYPASS))
                return -EINVAL;

        if (args->flags & KVM_IRQFD_FLAG_DEASSIGN)
--
2.31.1

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux