Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225273

Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy
Date 2015-09-15 17:10 +0200
Message-ID <q901P-8qX-15@gated-at.bofh.it> (permalink)
References <q8SdX-5qT-3@gated-at.bofh.it> <q8SdX-5qT-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 15/09/2015 08:41, Jason Wang wrote:
> +With KVM_CAP_FAST_MMIO, a zero length mmio eventfd is allowed for
> +kernel to ignore the length of guest write and get a possible faster
> +response. Note the speedup may only work on some specific
> +architectures and setups. Otherwise, it's as fast as wildcard mmio
> +eventfd.

I don't really like tying the capability to MMIO, especially since
zero length ioeventfd is already accepted for virtio-ccw.

What about the following?

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 7a3cb48a644d..247944071cc8 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1627,11 +1627,10 @@ to the registered address is equal to datamatch in struct kvm_ioeventfd.
 For virtio-ccw devices, addr contains the subchannel id and datamatch the
 virtqueue index.
 
-With KVM_CAP_FAST_MMIO, a zero length mmio eventfd is allowed for
-kernel to ignore the length of guest write and get a possible faster
-response. Note the speedup may only work on some specific
-architectures and setups. Otherwise, it's as fast as wildcard mmio
-eventfd.
+With KVM_CAP_IOEVENTFD_ANY_LENGTH, a zero length ioeventfd is allowed, and
+the kernel will ignore the length of guest write and get a faster vmexit.
+The speedup may only apply to specific architectures, but the ioeventfd will
+work anyway.
 
 4.60 KVM_DIRTY_TLB
 
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index b4f6aeaf94a6..03f3618612aa 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -830,7 +830,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_GUEST_DEBUG_HW_BPS 119
 #define KVM_CAP_GUEST_DEBUG_HW_WPS 120
 #define KVM_CAP_SPLIT_IRQCHIP 121
-#define KVM_CAP_FAST_MMIO 122
+#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 79db45336e3a..1dc8c45d2270 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -914,9 +914,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
 		return -EINVAL;
 
 	/* ioeventfd with no length can't be combined with DATAMATCH */
-	if (!args->len &&
-	    args->flags & (KVM_IOEVENTFD_FLAG_PIO |
-			   KVM_IOEVENTFD_FLAG_DATAMATCH))
+	if (!args->len && (args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH))
 		return -EINVAL;
 
 	ret = kvm_assign_ioeventfd_idx(kvm, bus_idx, args);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 0780d970d087..0b48aadedcee 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2717,7 +2717,7 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
 	case KVM_CAP_IRQFD:
 	case KVM_CAP_IRQFD_RESAMPLE:
 #endif
-	case KVM_CAP_FAST_MMIO:
+	case KVM_CAP_IOEVENTFD_ANY_LENGTH:
 	case KVM_CAP_CHECK_EXTENSION_VM:
 		return 1;
 #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING


Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V6 0/6] Fast mmio eventfd fixes Jason Wang <jasowang@redhat.com> - 2015-09-15 08:50 +0200
  [PATCH V6 6/6] kvm: add fast mmio capabilitiy Jason Wang <jasowang@redhat.com> - 2015-09-15 08:50 +0200
    Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy Paolo Bonzini <pbonzini@redhat.com> - 2015-09-15 17:10 +0200
      Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy Cornelia Huck <cornelia.huck@de.ibm.com> - 2015-09-15 18:20 +0200
        Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy Paolo Bonzini <pbonzini@redhat.com> - 2015-09-15 18:30 +0200
          Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy Cornelia Huck <cornelia.huck@de.ibm.com> - 2015-09-15 18:50 +0200
            Re: [PATCH V6 6/6] kvm: add fast mmio capabilitiy Paolo Bonzini <pbonzini@redhat.com> - 2015-09-15 18:50 +0200
  [PATCH V6 2/6] kvm: factor out core eventfd assign/deassign logic Jason Wang <jasowang@redhat.com> - 2015-09-15 08:50 +0200
    Re: [PATCH V6 2/6] kvm: factor out core eventfd assign/deassign  logic Cornelia Huck <cornelia.huck@de.ibm.com> - 2015-09-15 09:10 +0200
  [PATCH V6 3/6] kvm: fix double free for fast mmio eventfd Jason Wang <jasowang@redhat.com> - 2015-09-15 08:50 +0200
    Re: [PATCH V6 3/6] kvm: fix double free for fast mmio eventfd Cornelia Huck <cornelia.huck@de.ibm.com> - 2015-09-15 09:20 +0200
  Re: [PATCH V6 0/6] Fast mmio eventfd fixes Paolo Bonzini <pbonzini@redhat.com> - 2015-09-15 17:10 +0200
    Re: [PATCH V6 0/6] Fast mmio eventfd fixes "Michael S. Tsirkin" <mst@redhat.com> - 2015-09-15 21:30 +0200
      Re: [PATCH V6 0/6] Fast mmio eventfd fixes Paolo Bonzini <pbonzini@redhat.com> - 2015-09-16 11:10 +0200

csiph-web