Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547AbbF2JGe (ORCPT ); Mon, 29 Jun 2015 05:06:34 -0400 Received: from 8bytes.org ([81.169.241.247]:35313 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753510AbbF2JGb (ORCPT ); Mon, 29 Jun 2015 05:06:31 -0400 Date: Mon, 29 Jun 2015 11:06:29 +0200 From: Joerg Roedel To: "Wu, Feng" Cc: Alex Williamson , Eric Auger , Avi Kivity , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "pbonzini@redhat.com" , "mtosatti@redhat.com" Subject: Re: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding Message-ID: <20150629090629.GH18569@8bytes.org> References: <1434123695.4927.304.camel@redhat.com> <557B2994.1070900@gmail.com> <1434135815.4927.308.camel@redhat.com> <557EFA7F.9010209@linaro.org> <1434386702.4927.391.camel@redhat.com> <1434657848.3700.83.camel@redhat.com> <20150624154616.GB18569@8bytes.org> <1435245112.3700.365.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435245112.3700.365.camel@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1451 Lines: 33 Hi Feng, On Thu, Jun 25, 2015 at 09:11:52AM -0600, Alex Williamson wrote: > So the trouble is that QEMU vfio updates a single MSI vector, but that > just updates a single entry within a whole table of routes, then the > whole table is pushed to KVM. But in kvm_set_irq_routing() we have > access to both the new and the old tables, so we do have the ability to > detect the change. We can therefore detect which GSI changed and > cross-reference that to KVMs irqfds. If we have an irqfd that matches > the GSI then we have all the information we need, right? We can use the > eventfd_ctx of the irqfd to call into the IRQ bypass manager if we need > to. If it's an irqfd that's already enabled for bypass then we may > already have the data we need to tweak the PI config. > > Yes, I agree it's more difficult, but it doesn't appear to be > impossible, right? Since this also doesn't happen very often, you could also just update _all_ PI data-structures from kvm_set_irq_routing, no? This would just resemble the way the API works anyway. You just need to be careful to update the data structures only when the function can't fail anymore, so that you don't have to roll back anything. Joerg -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/