Skip to contentSkip to conversation

kvm: add detail error message when fail to add ioeventfd

PATCH Applied Amos Kong 3 participants 6 messages May 22, 2013 – Jun 3, 2013 KVM

lore
Share & tools
lore

Amos Kong

author
#0 lore raw

PATCH 1/1 kvm: add detail error message when fail to add ioeventfd

I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices.

It's better to add detail error here.

---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index 8222729..3d5f7b7 100644
@@ -813,6 +813,8 @@ static void kvm_mem_ioeventfd_add(MemoryListener *listener,
     r = kvm_set_ioeventfd_mmio(fd, section->offset_within_address_space,
                                data, true, section->size, match_data);
     if (r < 0) {
+        fprintf(stderr, "%s: error adding ioeventfd: %s\n",
+                __func__, strerror(-r));
         abort();
     }
 }
@@ -843,6 +845,8 @@ static void kvm_io_ioeventfd_add(MemoryListener *listener,
     r = kvm_set_ioeventfd_pio(fd, section->offset_within_address_space,
                               data, true, section->size, match_data);
     if (r < 0) {
+        fprintf(stderr, "%s: error adding ioeventfd: %s\n",
+                __func__, strerror(-r));
         abort();
     }
 }
Signature · 1 line
1.7.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Amos Kong

I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices.

It's better to add detail error here.

---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

It would be nice to make kvm bus scalable so that the hardcoded in-kernel I/O device limit can be lifted.

author
#2 lore raw
Quoted 7 lines · Stefan Hajnoczi
Quoted 6 lines · Amos Kong

I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices.

It's better to add detail error here.

Quoted 7 lines
Quoted 4 lines
---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

It would be nice to make kvm bus scalable so that the hardcoded in-kernel I/O device limit can be lifted.

I had increased kernel NR_IOBUS_DEVS to 1000 (a limitation is needed for security) in last Mar, and make resizing kvm_io_range array dynamical.

Quoted 1 line
Signature · 1 line
			Amos.
#3 lore raw
Quoted 13 lines · Amos Kong
Quoted 12 lines · Stefan Hajnoczi
Quoted 10 lines · Amos Kong

I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices.

It's better to add detail error here.

---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Quoted 5 lines
Quoted 2 lines

It would be nice to make kvm bus scalable so that the hardcoded in-kernel I/O device limit can be lifted.

I had increased kernel NR_IOBUS_DEVS to 1000 (a limitation is needed for security) in last Mar, and make resizing kvm_io_range array dynamical.

The maximum should not be hardcoded. File descriptor, maximum memory, etc are all controlled by rlimits. And since ioeventfds are file descriptors they are already limited by the maximum number of file descriptors.

Why is there a need to impose a hardcoded limit?

Stefan

author
#4 lore raw
Quoted 17 lines · Stefan Hajnoczi
Quoted 16 lines · Amos Kong
Quoted 14 lines · Stefan Hajnoczi
Quoted 10 lines · Amos Kong

I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices.

It's better to add detail error here.

---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

It would be nice to make kvm bus scalable so that the hardcoded in-kernel I/O device limit can be lifted.

Quoted 7 lines
Quoted 2 lines

I had increased kernel NR_IOBUS_DEVS to 1000 (a limitation is needed for security) in last Mar, and make resizing kvm_io_range array dynamical.

The maximum should not be hardcoded. File descriptor, maximum memory, etc are all controlled by rlimits. And since ioeventfds are file descriptors they are already limited by the maximum number of file descriptors.

For implement the dynamically resize the kvm_io_range array, I re-allocate new array (with new size) and free old array when the array flexes. The array is only resized when add/remove ioeventfds. It will not effect the perf.

Quoted 1 line

Why is there a need to impose a hardcoded limit?

I will send a patch to fix it.

Quoted 1 line

Stefan

Signature · 1 line
			Amos.
Applied
#5 lore raw
In reply to Amos Kong
Quoted 6 lines · Amos Kong

I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices.

It's better to add detail error here.

Applied, thanks.

Quoted 29 lines
---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index 8222729..3d5f7b7 100644
@@ -813,6 +813,8 @@ static void kvm_mem_ioeventfd_add(MemoryListener *listener,
     r = kvm_set_ioeventfd_mmio(fd, section->offset_within_address_space,
                                data, true, section->size, match_data);
     if (r < 0) {
+        fprintf(stderr, "%s: error adding ioeventfd: %s\n",
+                __func__, strerror(-r));
         abort();
     }
 }
@@ -843,6 +845,8 @@ static void kvm_io_ioeventfd_add(MemoryListener *listener,
     r = kvm_set_ioeventfd_pio(fd, section->offset_within_address_space,
                               data, true, section->size, match_data);
     if (r < 0) {
+        fprintf(stderr, "%s: error adding ioeventfd: %s\n",
+                __func__, strerror(-r));
         abort();
     }
 }
Signature · 1 line
1.7.1

--
Gleb.