From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v4] kvm: Use a bitmap for tracking used GSIs Date: Sun, 17 May 2009 23:47:53 +0300 Message-ID: <4A1077F9.8040604@redhat.com> References: <20090512220142.5663.72948.stgit@dl380g6-3.ned.telco.ned.telco> <20090513043835.6696.27384.stgit@dl380g6-3.ned.telco.ned.telco> <4A0A973A.9020502@redhat.com> <1242217702.4786.59.camel@2710p.home> <4A0ABEA8.6030103@redhat.com> <1242219343.4786.66.camel@2710p.home> <4A0AC453.2000907@redhat.com> <1242220276.4786.67.camel@2710p.home> <20090513135502.GA1405@redhat.com> <1242224129.9456.6.camel@lappy> <1242225238.9456.9.camel@lappy> <1242256055.9456.326.camel@lappy> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, sheng.yang@intel.com To: Alex Williamson Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33854 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbZEQUr6 (ORCPT ); Sun, 17 May 2009 16:47:58 -0400 In-Reply-To: <1242256055.9456.326.camel@lappy> Sender: kvm-owner@vger.kernel.org List-ID: Alex Williamson wrote: > On Wed, 2009-05-13 at 08:33 -0600, Alex Williamson wrote: > >> On Wed, 2009-05-13 at 08:15 -0600, Alex Williamson wrote: >> >>> On Wed, 2009-05-13 at 16:55 +0300, Michael S. Tsirkin wrote: >>> >>>> Very surprising: I haven't seen any driver disable MSI expect on device >>>> destructor path. Is this a linux guest? >>>> >>> Yes, Debian 2.6.26 kernel. I'll check it it behaves the same on newer >>> upstream kernels and try to figure out why it's doing it. >>> >> Updating the guest to 2.6.29 seems to fix the interrupt toggling. So >> it's either something in older kernels or something debian introduced, >> but that seems unlikely. >> > > For the curious, this was fixed prior to 2.6.27-rc1 by this: > > commit ce6fce4295ba727b36fdc73040e444bd1aae64cd > Author: Matthew Wilcox > Date: Fri Jul 25 15:42:58 2008 -0600 > > PCI MSI: Don't disable MSIs if the mask bit isn't supported > > David Vrabel has a device which generates an interrupt storm on the INTx > pin if we disable MSI interrupts altogether. Masking interrupts is only > a performance optimisation, so we can ignore the request to mask the > interrupt. > > It looks like without the maskbit attribute on MSI, the default way to > mask an MSI interrupt was to toggle the MSI enable bit. This was > introduced in 58e0543e8f355b32f0778a18858b255adb7402ae, so it's lifespan > was probably 2.6.21 - 2.6.26. > > On the other hand, if the host device supports this maskbit attribute, we might want to support it. I'm not sure exactly how though. If we trap msi entry writes, we're inviting the guest to exit every time it wants to disable interrupts. If we don't, we're inviting spurious interrupts, which will cause unwanted exits and injections. Maybe we ought to let the guest write to the msi tables without trapping, and in the injection logic do something like msi_entry = *msi_entry_ptr; mb(); if (msi_entry != msi->last_msi_entry) msi_reconfigure(); if (msi_enabled(msi_entry)) insert_the_needle(); -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.