From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2] kvm: Disable MSI/MSI-X in assigned device reset path Date: Sun, 08 Apr 2012 17:01:36 +0300 Message-ID: <4F819A40.1010806@redhat.com> References: <20120405033450.25661.68810.stgit@bling.home> <4F818F35.7010905@redhat.com> <20120408131710.GA13997@redhat.com> <4F819025.30407@redhat.com> <20120408132126.GD13997@redhat.com> <4F81917B.5050805@redhat.com> <20120408133016.GA14136@redhat.com> <4F819587.5050103@redhat.com> <20120408135324.GA14166@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Alex Williamson , kvm@vger.kernel.org, jan.kiszka@siemens.com, jbaron@redhat.com To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46363 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755454Ab2DHOBl (ORCPT ); Sun, 8 Apr 2012 10:01:41 -0400 In-Reply-To: <20120408135324.GA14166@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/08/2012 04:53 PM, Michael S. Tsirkin wrote: > On Sun, Apr 08, 2012 at 04:41:27PM +0300, Avi Kivity wrote: > > On 04/08/2012 04:30 PM, Michael S. Tsirkin wrote: > > > On Sun, Apr 08, 2012 at 04:24:11PM +0300, Avi Kivity wrote: > > > > On 04/08/2012 04:21 PM, Michael S. Tsirkin wrote: > > > > > On Sun, Apr 08, 2012 at 04:18:29PM +0300, Avi Kivity wrote: > > > > > > On 04/08/2012 04:17 PM, Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > Don't we FLR the device, which ought to disable MSI on the real device? > > > > > > > > > > > > > > AFAIK we call pci_reset, which saves device state, does an FLR > > > > > > > and then restores the state. I think this might include msi as well. > > > > > > > > > > > > > > > > > > > > > > > > > > Then that is wrong as well, no? > > > > > > > > > > Not as such assuming we disable msi/msix first :) > > > > > > > > I think we need to fix both, no? > > > > > > Isn't this what this patch does? > > > > If we change pci_reset() (or a variant that we call) to reset MSI, and > > update qemu to synchronize from the device after pci_reset(), then we > > achieve the same result, in a different way. > > MSI vectors are set up by kvm in the host. So we should not > abruptly drop that by a sysfs write: would need to > synchronise with kvm. Once we do, there's nothing left > for pci_reset to do. I'm thinking about this flow: FLR the device for each emulated register read it from the hardware if different from emulated register: update the internal model (for example, disabling MSI in kvm if needed) set emulated register to hardware value > > Since reset can change other config space registers, we achieve > > correctness for more of them. > > Which other registers do you have in mind? BARs for example. We may have our own reset for this, but isn't copying the hardware values more trustworthy? -- error compiling committee.c: too many arguments to function