kvm: exclude ioeventfd from counting kvm_io_range limit
authorAmos Kong <akong@redhat.com>
Fri, 24 May 2013 22:44:15 +0000 (06:44 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Jun 2017 22:47:11 +0000 (00:47 +0200)
commitd8abb8b8b7035e1c01a4630e71ab3aae619d774a
treeb9fe94a6af384c55e2335fbe31d02039b1939b55
parentdd8db8538c8aee325e08d65843d0824e4ee03938
kvm: exclude ioeventfd from counting kvm_io_range limit

commit 6ea34c9b78c10289846db0abeebd6b84d5aca084 upstream.

We can easily reach the 1000 limit by start VM with a couple
hundred I/O devices (multifunction=on). The hardcode limit
already been adjusted 3 times (6 ~ 200 ~ 300 ~ 1000).

In userspace, we already have maximum file descriptor to
limit ioeventfd count. But kvm_io_bus devices also are used
for pit, pic, ioapic, coalesced_mmio. They couldn't be limited
by maximum file descriptor.

Currently only ioeventfds take too much kvm_io_bus devices,
so just exclude it from counting kvm_io_range limit.

Also fixed one indent issue in kvm_host.h

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
[wt: next patch depends on this one]
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/linux/kvm_host.h
virt/kvm/eventfd.c
virt/kvm/kvm_main.c