From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Xu Subject: Re: [PATCH v3 5/6] vfio/quirks: ioeventfd quirk acceleration Date: Fri, 4 May 2018 10:17:22 +0800 Message-ID: <20180504021722.GI29580@xz-mi> References: <20180503213458.2749.28566.stgit@gimli.home> <20180503214505.2749.34062.stgit@gimli.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: eric.auger@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org To: Alex Williamson Return-path: Content-Disposition: inline In-Reply-To: <20180503214505.2749.34062.stgit@gimli.home> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org On Thu, May 03, 2018 at 03:45:05PM -0600, Alex Williamson wrote: > The NVIDIA BAR0 quirks virtualize the PCI config space mirrors found > in device MMIO space. Normally PCI config space is considered a slow > path and further optimization is unnecessary, however NVIDIA uses a > register here to enable the MSI interrupt to re-trigger. Exiting to > QEMU for this MSI-ACK handling can therefore rate limit our interrupt > handling. Fortunately the MSI-ACK write is easily detected since the > quirk MemoryRegion otherwise has very few accesses, so simply looking > for consecutive writes with the same data is sufficient, in this case > 10 consecutive writes with the same data and size is arbitrarily > chosen. We configure the KVM ioeventfd with data match, so there's > no risk of triggering for the wrong data or size, but we do risk that > pathological driver behavior might consume all of QEMU's file > descriptors, so we cap ourselves to 10 ioeventfds for this purpose. > > In support of the above, generic ioeventfd infrastructure is added > for vfio quirks. This automatically initializes an ioeventfd list > per quirk, disables and frees ioeventfds on exit, and allows > ioeventfds marked as dynamic to be dropped on device reset. The > rationale for this latter feature is that useful ioeventfds may > depend on specific driver behavior and since we necessarily place a > cap on our use of ioeventfds, a machine reset is a reasonable point > at which to assume a new driver and re-profile. > > Signed-off-by: Alex Williamson Reviewed-by: Peter Xu -- Peter Xu