From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/8] KVM: Handle device assignment to guests Date: Thu, 17 Jul 2008 11:31:29 +0300 Message-ID: <487F0361.1050106@qumranet.com> References: <1216214225-18030-1-git-send-email-benami@il.ibm.com> <1216214225-18030-2-git-send-email-benami@il.ibm.com> <1216214225-18030-3-git-send-email-benami@il.ibm.com> <1216214225-18030-4-git-send-email-benami@il.ibm.com> <487E0E10.4000009@qumranet.com> <0122C7C995D32147B66BF4F440D30163015DC7E7@pdsmsx415.ccr.corp.intel.com> <487EE078.8020001@qumranet.com> <1216283021.31546.325.camel@cluwyn.haifa.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "Han, Weidong" , amit.shah@qumranet.com, kvm@vger.kernel.org, Muli Ben-Yehuda , anthony@codemonkey.ws To: Ben-Ami Yassour Return-path: Received: from il.qumranet.com ([212.179.150.194]:44148 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756189AbYGQIbc (ORCPT ); Thu, 17 Jul 2008 04:31:32 -0400 In-Reply-To: <1216283021.31546.325.camel@cluwyn.haifa.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Ben-Ami Yassour wrote: >>>>> + >>>>> +/* FIXME: Implement the OR logic needed to make shared interrupt= s >>>>> on + * this line behave properly + */ >>>>> >>>>> =20 >>>>> =20 >>>> Isn't this a showstopper? There is no easy way for a user to avoi= d >>>> sharing, especially as we have only three pci irqs at present. >>>> =20 > What do you mean by only 3 (for passthrough we use whatever interrupt > the host is using for that device)? > > =20 There are two issue: - shared host interrupts - shared guest interrupts =46or shared host interrupts, I don't think there's a cost-effective=20 solution, especially as hosts are transitioning to MSI. But the proble= m=20 the comment describes is shared guest interrupts, where the assigned=20 device's interrupt is shared with another device (assigned or virtual). And currently we only have three shareable interrupts: 5, 10, and 11. See qemu's pci_set_irq() for the logic used to share interrupts. >>>> =20 >>>> =20 >>> Currently it's not easy to avoid sharing. I think we can support MS= I for >>> assgined device to solve sharing problem.=20 >>> =20 >>> =20 >> MSI is definitely the right direction, but we also need to support >> the=20 >> OR logic for guests that do not support MSI. >> >> =20 > > The main problems that I am ware of with shared interrupt are as > follows: > > 1. Protection > A bad guest can keep the interrupt line up, and if its shared then it > interferes with other devices that might not be assigned to this gues= t. > > =EF=BB=BF2. Performance > The current implementation disables the irq when the interrupt is > received on the host and re-enables it when the guest acks the interr= upt > on the virtual ioapic. > > Clearly its not nice to do that when other devices uses the same irq.= =2E. > > When removing the enable-disable of the irq, it causes serious > performance degradation. > The throughput goes down from 700 to 400 Mb/sec. > The number of interrupts per second on the host (from the NIC) is 130= 000 > (compared to 22200 before). > > =20 These are all shared host interrupt problems. > Regardless, I think that the right way to go would be to merge the > current code (with the non-shared interrupt limitation) and then > continue to work on additional features like shared interrupts suppor= t.=20 > Do you agree? > =20 The current code will be incredibly easy to break; all you need is more= =20 than three pci devices. I think the sharing code can be easily added=20 (as a separate patch); all that's needed is to make sure the API is goo= d. --=20 error compiling committee.c: too many arguments to function