From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amos Kong Subject: [RESEND PATCH v5 2/2] KVM: set upper bounds for iobus dev to limit userspace Date: Wed, 07 Mar 2012 21:20:21 +0800 Message-ID: <20120307132021.27621.61167.stgit@dhcp-8-167.nay.redhat.com> References: <20120307131807.27621.19355.stgit@dhcp-8-167.nay.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: jasowang@redhat.com, mtosatti@redhat.com, alex.williamson@redhat.com, kvm@vger.kernel.org, levinsasha928@gmail.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:8589 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756471Ab2CGNUX (ORCPT ); Wed, 7 Mar 2012 08:20:23 -0500 In-Reply-To: <20120307131807.27621.19355.stgit@dhcp-8-167.nay.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: kvm_io_bus devices are used for ioevent, pit, pic, ioapic, coalesced_mmio. Currently Qemu only emulates one PCI bus, it contains 32 slots, one slot contains 8 functions, maximum of supported PCI devices: 1 * 32 * 8 = 256. One virtio-blk takes one iobus device, one virtio-net(vhost=on) takes two iobus devices. The maximum of coalesced mmio zone is 100, each zone has an iobus devices. So 300 io_bus devices are not enough. Set an upper bounds for kvm_io_range to limit userspace. 1000 is a very large limit and not bloat the typical user. Signed-off-by: Amos Kong --- include/linux/kvm_host.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index e20dc8d..24ee2db 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -67,7 +67,7 @@ struct kvm_io_range { struct kvm_io_device *dev; }; -#define NR_IOBUS_DEVS 300 +#define NR_IOBUS_DEVS 1000 struct kvm_io_bus { int dev_count;