From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] qemu-xen-trad: free all the pirqs for msi/msix when driver unloads Date: Mon, 4 Aug 2014 10:01:08 -0400 Message-ID: <20140804140108.GB18425@laptop.dumpdata.com> References: <1396975483-31442-1-git-send-email-konrad.wilk@oracle.com> <1396975483-31442-2-git-send-email-konrad.wilk@oracle.com> <21428.8198.371406.754367@mariner.uk.xensource.com> <53B4CA12.80709@oracle.com> <20140703175415.GB13710@konrad-lan.dumpdata.com> <53B60382.2070506@oracle.com> <20140707204010.GA17821@laptop.dumpdata.com> <53BB4587.2050106@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XEIpC-000827-8s for xen-devel@lists.xenproject.org; Mon, 04 Aug 2014 14:01:18 +0000 Content-Disposition: inline In-Reply-To: <53BB4587.2050106@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Zhenzhong Duan Cc: xen-devel@lists.xenproject.org, Ian Jackson , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, Jul 08, 2014 at 09:12:39AM +0800, Zhenzhong Duan wrote: > > On 2014-7-8 4:40, Konrad Rzeszutek Wilk wrote: > >On Fri, Jul 04, 2014 at 09:29:38AM +0800, Zhenzhong Duan wrote: > >>On 2014-7-4 1:54, Konrad Rzeszutek Wilk wrote: > >>>On Thu, Jul 03, 2014 at 11:12:18AM +0800, Zhenzhong Duan wrote: > >>>>There is a patch dependency missed. > >>>Is that one upstream as well? Or does it not need to be? > >>>If it is upstream, what is the title/commit id of that one? > >>> > >>>Thank you! > >>It's upstream, see detail below > > > >[konrad@build-external qemu-xen-dir]$ pwd > >/home/konrad/xtt-x86_64/xen/tools/qemu-xen-dir > >[konrad@build-external qemu-xen-dir]$ git show adf74189dd58014744a4b8c9d64407d629da5e2f > >fatal: bad object adf74189dd58014744a4b8c9d64407d629da5e2f > >[konrad@build-external qemu-xen-dir]$ git log --grep="clear all MSI" > >[konrad@build-external qemu-xen-dir]$ > > > >? > Sorry, I mean qemu-xen-traditional upstream git Ok, is that patch upstream? Should it be upstream? If so, had it been posted in the past? Thank you! > > zduan > >>>>commit adf74189dd58014744a4b8c9d64407d629da5e2f > >>>>Author: Stefano Stabellini > >>>>Date: Mon Dec 10 12:43:33 2012 +0000 > >>>> > >>>> qemu-xen-trad/pt_msi_disable: do not clear all MSI flags > >>>> > >>>> "qemu-xen-trad: fix msi_translate with PV event delivery" added a > >>>> pt_msi_disable() call into pt_msgctrl_reg_write, clearing the MSI flags > >>>> as a consequence. MSIs get enabled again soon after by calling > >>>> pt_msi_setup. > >>>> > >>>> However the MSI flags are only setup once in the pt_msgctrl_reg_init > >>>> function, so from the QEMU point of view the device has lost some > >>>> important properties, like for example PCI_MSI_FLAGS_64BIT. > >>>> > >>>> This patch fixes the bug by clearing only the MSI > >>>> enabled/mapped/initialized flags in pt_msi_disable. > >>>> > >>>> Signed-off-by: Stefano Stabellini > >>>> Tested-by: G.R. > >>>> Xen-devel: http://marc.info/?l=xen-devel&m=135489879503075 > >>>> > >>>>diff --git a/hw/pt-msi.c b/hw/pt-msi.c > >>>>index 73f737d..b03b989 100644 > >>>>--- a/hw/pt-msi.c > >>>>+++ b/hw/pt-msi.c > >>>>@@ -213,7 +213,7 @@ void pt_msi_disable(struct pt_dev *dev) > >>>> > >>>> out: > >>>> /* clear msi info */ > >>>>- dev->msi->flags = 0; > >>>>+ dev->msi->flags &= ~(MSI_FLAG_UNINIT | PT_MSI_MAPPED | > >>>>PCI_MSI_FLAGS_ENABLE); > >>>> dev->msi->pirq = -1; > >>>> dev->msi_trans_en = 0; > >>>> } > >>>> > >>>>On 2014-7-2 23:06, Ian Jackson wrote: > >>>>>Konrad Rzeszutek Wilk writes ("[Xen-devel] [PATCH] qemu-xen-trad: free all the pirqs for msi/msix when driver unloads"): > >>>>>>From: Zhenzhong Duan > >>>>>> > >>>>>>Pirqs are not freed when driver unloads, then new pirqs are allocated when > >>>>>>driver reloads. This could exhaust pirqs if do it in a loop. > >>>>>> > >>>>>>This patch fixes the bug by freeing pirqs when ENABLE bit is cleared in > >>>>>>msi/msix control reg. > >>>>>I have backported this to 4.4 and 4.3. It did not apply cleanly to > >>>>>4.2 (and I have not investgated why). > >>>>> > >>>>>Thanks, > >>>>>Ian. >