Skip to contentSkip to conversation

KVM: ioeventfd cookies

PATCH In review Cornelia Huck 3 participants 11 messages Jul 3, 2013 – Jul 15, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover KVM: ioeventfd cookies

Hi,

fourth version of this patch set.

Changes:
- make the cookie-less read/write function return 0 again on success and drop the changes at the callsites

Cornelia Huck (2):
KVM: kvm-io: support cookies
KVM: s390: use cookies for ioeventfd

 arch/s390/kvm/diag.c     |  15 +++++--
 include/linux/kvm_host.h |   4 ++
 virt/kvm/kvm_main.c      | 106 ++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 107 insertions(+), 18 deletions(-)
Signature · 1 line
1.8.2.2
#1 lore raw

PATCH v4 1/2 KVM: kvm-io: support cookies

Add new functions kvm_io_bus_{read,write}_cookie() that allows users of the kvm io infrastructure to use a cookie value to speed up lookup of a device on an io bus.

---
 include/linux/kvm_host.h |   4 ++
 virt/kvm/kvm_main.c      | 106 ++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 95 insertions(+), 15 deletions(-)
include/linux/kvm_host.h +4 -0
index e3aae6d..60e261c9 100644
@@ -159,8 +159,12 @@ enum kvm_bus {
 
 int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 		     int len, const void *val);
+int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
+			    int len, const void *val, long cookie);
 int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
 		    void *val);
+int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
+			   int len, void *val, long cookie);
 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 			    int len, struct kvm_io_device *dev);
 int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
virt/kvm/kvm_main.c +91 -15

143 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#3 lore raw

PATCH v4 2/2 KVM: s390: use cookies for ioeventfd

In reply to Cornelia Huck

Make use of cookies for the virtio ccw notification hypercall to speed up lookup of devices on the io bus.

---
 arch/s390/kvm/diag.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
arch/s390/kvm/diag.c +12 -3
index 3074475..e88c76e 100644
@@ -119,11 +119,20 @@ static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu)
 	 * The layout is as follows:
 	 * - gpr 2 contains the subchannel id (passed as addr)
 	 * - gpr 3 contains the virtqueue index (passed as datamatch)
+	 * - gpr 4 contains the index on the bus (optionally)
 	 */
-	ret = kvm_io_bus_write(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS,
-				vcpu->run->s.regs.gprs[2],
-				8, &vcpu->run->s.regs.gprs[3]);
+	ret = kvm_io_bus_write_cookie(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS,
+				      vcpu->run->s.regs.gprs[2],
+				      8, &vcpu->run->s.regs.gprs[3],
+				      vcpu->run->s.regs.gprs[4]);
 	srcu_read_unlock(&vcpu->kvm->srcu, idx);
+
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;
 	/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */
 	return ret < 0 ? ret : 0;
 }
Signature · 1 line
1.8.2.2
#2 lore raw

Re: [PATCH v4 1/2] KVM: kvm-io: support cookies

In reply to Cornelia Huck
Quoted 5 lines · Cornelia Huck

Add new functions kvm_io_bus_{read,write}_cookie() that allows users of the kvm io infrastructure to use a cookie value to speed up lookup of a device on an io bus.

Looks good to me now.

Quoted 175 lines
---
 include/linux/kvm_host.h |   4 ++
 virt/kvm/kvm_main.c      | 106 ++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 95 insertions(+), 15 deletions(-)
include/linux/kvm_host.h +4 -0
index e3aae6d..60e261c9 100644
@@ -159,8 +159,12 @@ enum kvm_bus {
 
 int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 		     int len, const void *val);
+int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
+			    int len, const void *val, long cookie);
 int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
 		    void *val);
+int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
+			   int len, void *val, long cookie);
 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 			    int len, struct kvm_io_device *dev);
 int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
virt/kvm/kvm_main.c +91 -15
index 1580dd4..c7f5355 100644
@@ -2863,11 +2863,48 @@ static int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
 	return off;
 }
 
+static int __kvm_io_bus_write(struct kvm_io_bus *bus,
+			      struct kvm_io_range *range, const void *val)
+{
+	int idx;
+
+	idx = kvm_io_bus_get_first_dev(bus, range->addr, range->len);
+	if (idx < 0)
+		return -EOPNOTSUPP;
+
+	while (idx < bus->dev_count &&
+		kvm_io_bus_sort_cmp(range, &bus->range[idx]) == 0) {
+		if (!kvm_iodevice_write(bus->range[idx].dev, range->addr,
+					range->len, val))
+			return idx;
+		idx++;
+	}
+
+	return -EOPNOTSUPP;
+}
+
 /* kvm_io_bus_write - called under kvm->slots_lock */
 int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 		     int len, const void *val)
 {
-	int idx;
+	struct kvm_io_bus *bus;
+	struct kvm_io_range range;
+	int r;
+
+	range = (struct kvm_io_range) {
+		.addr = addr,
+		.len = len,
+	};
+
+	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
+	r = __kvm_io_bus_write(bus, &range, val);
+	return r < 0 ? r : 0;
+}
+
+/* kvm_io_bus_write_cookie - called under kvm->slots_lock */
+int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
+			    int len, const void *val, long cookie)
+{
 	struct kvm_io_bus *bus;
 	struct kvm_io_range range;
 
@@ -2877,14 +2914,35 @@ int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	};
 
 	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
-	idx = kvm_io_bus_get_first_dev(bus, addr, len);
+
+	/* First try the device referenced by cookie. */
+	if ((cookie >= 0) && (cookie < bus->dev_count) &&
+	    (kvm_io_bus_sort_cmp(&range, &bus->range[cookie]) == 0))
+		if (!kvm_iodevice_write(bus->range[cookie].dev, addr, len,
+					val))
+			return cookie;
+
+	/*
+	 * cookie contained garbage; fall back to search and return the
+	 * correct cookie value.
+	 */
+	return __kvm_io_bus_write(bus, &range, val);
+}
+
+static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range,
+			     void *val)
+{
+	int idx;
+
+	idx = kvm_io_bus_get_first_dev(bus, range->addr, range->len);
 	if (idx < 0)
 		return -EOPNOTSUPP;
 
 	while (idx < bus->dev_count &&
 		kvm_io_bus_sort_cmp(&range, &bus->range[idx]) == 0) {
-		if (!kvm_iodevice_write(bus->range[idx].dev, addr, len, val))
-			return 0;
+		if (!kvm_iodevice_read(bus->range[idx].dev, range->addr,
+				       range->len, val))
+			return idx;
 		idx++;
 	}
 
@@ -2895,9 +2953,9 @@ int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 		    int len, void *val)
 {
-	int idx;
 	struct kvm_io_bus *bus;
 	struct kvm_io_range range;
+	int r;
 
 	range = (struct kvm_io_range) {
 		.addr = addr,
@@ -2905,18 +2963,36 @@ int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	};
 
 	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
-	idx = kvm_io_bus_get_first_dev(bus, addr, len);
-	if (idx < 0)
-		return -EOPNOTSUPP;
+	r = __kvm_io_bus_read(bus, &range, val);
+	return r < 0 ? r : 0;
+}
 
-	while (idx < bus->dev_count &&
-		kvm_io_bus_sort_cmp(&range, &bus->range[idx]) == 0) {
-		if (!kvm_iodevice_read(bus->range[idx].dev, addr, len, val))
-			return 0;
-		idx++;
-	}
+/* kvm_io_bus_read_cookie - called under kvm->slots_lock */
+int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
+			   int len, void *val, long cookie)
+{
+	struct kvm_io_bus *bus;
+	struct kvm_io_range range;
 
-	return -EOPNOTSUPP;
+	range = (struct kvm_io_range) {
+		.addr = addr,
+		.len = len,
+	};
+
+	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
+
+	/* First try the device referenced by cookie. */
+	if ((cookie >= 0) && (cookie < bus->dev_count) &&
+	    (kvm_io_bus_sort_cmp(&range, &bus->range[cookie]) == 0))
+		if (!kvm_iodevice_read(bus->range[cookie].dev, addr, len,
+				       val))
+			return cookie;
+
+	/*
+	 * cookie contained garbage; fall back to search and return the
+	 * correct cookie value.
+	 */
+	return __kvm_io_bus_read(bus, &range, val);
 }
 
 /* Caller must hold slots_lock. */
Signature · 1 line
1.8.2.2

--
Gleb.

maintainer
#4 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

In reply to Cornelia Huck

Il 03/07/2013 16:30, Cornelia Huck ha scritto:

arch/s390/kvm/diag.c static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) · line 135

Quoted 6 lines
arch/s390/kvm/diag.c +6 -0
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;

I think this should now be "if (ret >= 0)".

Quoted 1 line

/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */

The comment is now obsolete.

Quoted 1 line

return ret < 0 ? ret : 0;

Otherwise looks good, thanks!

Paolo

#5 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

Quoted 9 lines · On Wed, 03 Jul 2013 17:30:40 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/07/2013 16:30, Cornelia Huck ha scritto:

arch/s390/kvm/diag.c static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) · line 135

Quoted 6 lines
arch/s390/kvm/diag.c +6 -0
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;

I think this should now be "if (ret >= 0)".

Hm, we don't want to kill gpr 2's old contents if userspace will do something, which means -EOPNOTSUPP.

Quoted 4 lines
Quoted 2 lines

/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */

The comment is now obsolete.

s/kvm_io_bus_write/kvm_io_bus_write_cookie/ ? Otherwise, this is still true.

Quoted 7 lines
Quoted 2 lines

return ret < 0 ? ret : 0;

Otherwise looks good, thanks!

Paolo

maintainer
#6 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

Il 03/07/2013 18:33, Cornelia Huck ha scritto:

Quoted 13 lines
Quoted 9 lines · On Wed, 03 Jul 2013 17:30:40 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/07/2013 16:30, Cornelia Huck ha scritto:

arch/s390/kvm/diag.c static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) · line 135

Quoted 6 lines
arch/s390/kvm/diag.c +6 -0
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;

I think this should now be "if (ret >= 0)".

Quoted 2 lines

Hm, we don't want to kill gpr 2's old contents if userspace will do something, which means -EOPNOTSUPP.

In the end kvm_io_bus_write_cookie only returns -EOPNOTSUPP if there is an error, so it works. But if this were to change, the code would break. That's why I suggested testing "ret >= 0" rather than "ret != -EOPNOTSUPP". But in the end it is the same.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */

The comment is now obsolete.

s/kvm_io_bus_write/kvm_io_bus_write_cookie/ ? Otherwise, this is still true.

True but somewhat misplaced, it is basically saying the same thing as the "Return cookie in gpr 2" comment just above.

Anyhow, these are very small details. I changed kvm_io_bus_write to kvm_io_bus_write_cookie in the comment and applied the patches to kvm-queue.

Paolo

Quoted 13 lines
Quoted 7 lines
Quoted 2 lines

return ret < 0 ? ret : 0;

Otherwise looks good, thanks!

Paolo

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

Quoted 27 lines · Paolo Bonzini

Il 03/07/2013 18:33, Cornelia Huck ha scritto:

Quoted 13 lines
Quoted 9 lines · On Wed, 03 Jul 2013 17:30:40 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/07/2013 16:30, Cornelia Huck ha scritto:

arch/s390/kvm/diag.c static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) · line 135

Quoted 6 lines
arch/s390/kvm/diag.c +6 -0
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;

I think this should now be "if (ret >= 0)".

Quoted 2 lines

Hm, we don't want to kill gpr 2's old contents if userspace will do something, which means -EOPNOTSUPP.

In the end kvm_io_bus_write_cookie only returns -EOPNOTSUPP if there is an error, so it works. But if this were to change, the code would break. That's why I suggested testing "ret >= 0" rather than "ret != -EOPNOTSUPP". But in the end it is the same.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */

The comment is now obsolete.

Quoted 9 lines
Quoted 2 lines

s/kvm_io_bus_write/kvm_io_bus_write_cookie/ ? Otherwise, this is still true.

True but somewhat misplaced, it is basically saying the same thing as the "Return cookie in gpr 2" comment just above.

Anyhow, these are very small details. I changed kvm_io_bus_write to kvm_io_bus_write_cookie in the comment and applied the patches to kvm-queue.

1/2 broke x86. QEMU prints "Invalid read from memory region kvm-pic" and guest hangs. Looks like IO is forwarded to userspace instead of in kernel device for some reason. Un-applying for now.

--
Gleb.

#8 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

Quoted 34 lines · Gleb Natapov
Quoted 33 lines · Paolo Bonzini

Il 03/07/2013 18:33, Cornelia Huck ha scritto:

Quoted 13 lines
Quoted 9 lines · On Wed, 03 Jul 2013 17:30:40 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/07/2013 16:30, Cornelia Huck ha scritto:

Review

Quoted 6 lines
(quoted diff) +6 -0
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;

I think this should now be "if (ret >= 0)".

Quoted 2 lines

Hm, we don't want to kill gpr 2's old contents if userspace will do something, which means -EOPNOTSUPP.

In the end kvm_io_bus_write_cookie only returns -EOPNOTSUPP if there is an error, so it works. But if this were to change, the code would break. That's why I suggested testing "ret >= 0" rather than "ret != -EOPNOTSUPP". But in the end it is the same.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */

The comment is now obsolete.

s/kvm_io_bus_write/kvm_io_bus_write_cookie/ ? Otherwise, this is still true.

True but somewhat misplaced, it is basically saying the same thing as the "Return cookie in gpr 2" comment just above.

Quoted 7 lines
Quoted 3 lines

Anyhow, these are very small details. I changed kvm_io_bus_write to kvm_io_bus_write_cookie in the comment and applied the patches to kvm-queue.

1/2 broke x86. QEMU prints "Invalid read from memory region kvm-pic" and guest hangs. Looks like IO is forwarded to userspace instead of in kernel device for some reason. Un-applying for now.

OK, stupid typo. Will amend the commit instead of dropping.

virt/kvm/kvm_main.c +1 -1
index 6cde6fa..a86735d 100644
@@ -2942,7 +2942,7 @@ static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range,
 		return -EOPNOTSUPP;
 
 	while (idx < bus->dev_count &&
-		kvm_io_bus_sort_cmp(&range, &bus->range[idx]) == 0) {
+		kvm_io_bus_sort_cmp(range, &bus->range[idx]) == 0) {
 		if (!kvm_iodevice_read(bus->range[idx].dev, range->addr,
 				       range->len, val))
 			return idx;

--
Gleb.

#9 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

Quoted 8 lines · On Sun, 14 Jul 2013 13:19:59 +0300 Gleb Natapov <[email protected]> wrote:
Quoted 4 lines · Gleb Natapov

1/2 broke x86. QEMU prints "Invalid read from memory region kvm-pic" and guest hangs. Looks like IO is forwarded to userspace instead of in kernel device for some reason. Un-applying for now.

OK, stupid typo. Will amend the commit instead of dropping.

Thanks for fixing.

Quoted 17 lines
virt/kvm/kvm_main.c +1 -2
index 6cde6fa..a86735d 100644
@@ -2942,7 +2942,7 @@ static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range,
 		return -EOPNOTSUPP;
 
 	while (idx < bus->dev_count &&
-		kvm_io_bus_sort_cmp(&range, &bus->range[idx]) == 0) {
+		kvm_io_bus_sort_cmp(range, &bus->range[idx]) == 0) {
 		if (!kvm_iodevice_read(bus->range[idx].dev, range->addr,
 				       range->len, val))
 			return idx;
--

Gleb.

maintainer
#10 lore raw

Re: [PATCH v4 2/2] KVM: s390: use cookies for ioeventfd

In reply to Gleb Natapov

Il 14/07/2013 12:19, Gleb Natapov ha scritto:

Quoted 59 lines · Gleb Natapov
Quoted 34 lines · Paolo Bonzini
Quoted 33 lines

Il 03/07/2013 18:33, Cornelia Huck ha scritto:

Quoted 13 lines
Quoted 9 lines · On Wed, 03 Jul 2013 17:30:40 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/07/2013 16:30, Cornelia Huck ha scritto:

Review

Quoted 6 lines
(quoted diff) +6 -0
+	/*
+	 * Return cookie in gpr 2, but don't overwrite the register if the
+	 * diagnose will be handled by userspace.
+	 */
+	if (ret != -EOPNOTSUPP)
+		vcpu->run->s.regs.gprs[2] = ret;

I think this should now be "if (ret >= 0)".

Quoted 2 lines

Hm, we don't want to kill gpr 2's old contents if userspace will do something, which means -EOPNOTSUPP.

In the end kvm_io_bus_write_cookie only returns -EOPNOTSUPP if there is an error, so it works. But if this were to change, the code would break. That's why I suggested testing "ret >= 0" rather than "ret != -EOPNOTSUPP". But in the end it is the same.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

/* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */

The comment is now obsolete.

s/kvm_io_bus_write/kvm_io_bus_write_cookie/ ? Otherwise, this is still true.

True but somewhat misplaced, it is basically saying the same thing as the "Return cookie in gpr 2" comment just above.

Quoted 7 lines
Quoted 3 lines

Anyhow, these are very small details. I changed kvm_io_bus_write to kvm_io_bus_write_cookie in the comment and applied the patches to kvm-queue.

1/2 broke x86. QEMU prints "Invalid read from memory region kvm-pic" and guest hangs. Looks like IO is forwarded to userspace instead of in kernel device for some reason. Un-applying for now.

OK, stupid typo. Will amend the commit instead of dropping.

virt/kvm/kvm_main.c +1 -2
index 6cde6fa..a86735d 100644
@@ -2942,7 +2942,7 @@ static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range,
 		return -EOPNOTSUPP;
 
 	while (idx < bus->dev_count &&
-		kvm_io_bus_sort_cmp(&range, &bus->range[idx]) == 0) {
+		kvm_io_bus_sort_cmp(range, &bus->range[idx]) == 0) {
 		if (!kvm_iodevice_read(bus->range[idx].dev, range->addr,
 				       range->len, val))
 			return idx;
--
Quoted 2 lines

Gleb.

We can introduce an

int __kvm_io_bus_sort_cmp(const struct kvm_io_range *p1, const struct kvm_io_range *p2)

function so that this kind of typo doesn't happen again in the future.

I'll post a patch later.

Paolo