From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 0/2] virtio-pci: fix abort when fail to allocate ioeventfd Date: Wed, 14 Mar 2012 12:05:56 +0200 Message-ID: <4F606D84.8000807@redhat.com> References: <20120313103602.8741.71939.stgit@dhcp-8-167.nay.redhat.com> <4F606356.9080003@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Amos Kong , aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, kvm@vger.kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org To: Stefan Hajnoczi Return-path: Received: from mx1.redhat.com ([209.132.183.28]:29139 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760368Ab2CNKGJ (ORCPT ); Wed, 14 Mar 2012 06:06:09 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 03/14/2012 11:59 AM, Stefan Hajnoczi wrote: > On Wed, Mar 14, 2012 at 9:22 AM, Avi Kivity wrote: > > On 03/13/2012 12:42 PM, Amos Kong wrote: > >> Boot up guest with 232 virtio-blk disk, qemu will abort for fail to > >> allocate ioeventfd. This patchset changes kvm_has_many_ioeventfds(), > >> and check if available ioeventfd exists. If not, virtio-pci will > >> fallback to userspace, and don't use ioeventfd for io notification. > > > > How about an alternative way of solving this, within the memory core: > > trap those writes in qemu and write to the ioeventfd yourself. This way > > ioeventfds work even without kvm: > > > > > > core: create eventfd > > core: install handler for memory address that writes to ioeventfd > > kvm (optional): install kernel handler for ioeventfd > > > > even if the third step fails, the ioeventfd still works, it's just slower. > > That approach will penalize guests with large numbers of disks - they > see an extra switch to vcpu thread instead of kvm.ko -> iothread. It's only a failure path. The normal path is expected to have a kvm ioeventfd installed. > It > seems okay provided we can solve the limit in the kernel once and for > all by introducing a more dynamic data structure for in-kernel > devices. That way future kernels will never hit an arbitrary limit > below their file descriptor rlimit. > > Is there some reason why kvm.ko must use a fixed size array? Would it > be possible to use a tree (maybe with a cache for recent lookups)? It does use bsearch today IIRC. We'll expand the limit, but there must be a limit, and qemu must be prepared to deal with it. -- error compiling committee.c: too many arguments to function