From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAdhI-0002Vm-So for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:02:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAdhE-0007El-6h for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:02:16 -0500 Received: from mga14.intel.com ([192.55.52.115]:37455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAdhE-0007Dv-2Y for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:02:12 -0500 From: "Tian, Kevin" Date: Mon, 12 Jan 2015 12:02:05 +0000 Message-ID: References: <1419411417-23354-1-git-send-email-liang.z.li@intel.com> In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Qemu-devel] [Xen-devel] [PATCH] xen-pt: Fix PCI devices re-attach failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini , "Li, Liang Z" Cc: "xen-devel@lists.xensource.com" , "mst@redhat.com" , "mtosatti@redhat.com" , "qemu-devel@nongnu.org" , "aliguori@amazon.com" , "pbonzini@redhat.com" , "Zhang, Yang Z" , "Hu, Robert" , "rth@twiddle.net" > From: Stefano Stabellini > Sent: Monday, January 12, 2015 7:36 PM >=20 > On Wed, 24 Dec 2014, Liang Li wrote: > > Use the 'xl pci-attach $DomU $BDF' command to attach more then > > one PCI devices to the guest, then detach the devices with > > 'xl pci-detach $DomU $BDF', after that, re-attach these PCI > > devices again, an error message will be reported like following: > > > > libxl: error: libxl_qmp.c:287:qmp_handle_error_response: receive > > an error message from QMP server: Duplicate ID 'pci-pt-03_10.1' > > for device. > > > > The count of calling xen_pt_region_add and xen_pt_region_del are > > not the same will cause the XenPCIPassthroughState and it's related > > QemuOpts object not be released properly. >=20 > Thanks for the patch! >=20 > From this description, I don't quite understand why the > memory_region_ref and memory_region_unref calls are wrong. What do > you > mean by "The count of calling xen_pt_region_add and xen_pt_region_del > are not the same"? >=20 > On unplug xen_pt_region_del does not get called? > Or the memory region argument is not exactly the same as the one > initially passed to xen_pt_region_add? >=20 agree. Liang, could you elaborate how the patch is associated with above=20 explanation? :-) >=20 > > Signed-off-by: Liang Li > > Reported-by: Longtao Pang > > --- > > hw/xen/xen_pt.c | 4 ---- > > 1 file changed, 4 deletions(-) > > > > diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c > > index c1bf357..523b8a2 100644 > > --- a/hw/xen/xen_pt.c > > +++ b/hw/xen/xen_pt.c > > @@ -588,7 +588,6 @@ static void xen_pt_region_add(MemoryListener *l, > MemoryRegionSection *sec) > > XenPCIPassthroughState *s =3D container_of(l, XenPCIPassthroughSta= te, > > memory_listener); > > > > - memory_region_ref(sec->mr); > > xen_pt_region_update(s, sec, true); > > } > > > > @@ -598,7 +597,6 @@ static void xen_pt_region_del(MemoryListener *l, > MemoryRegionSection *sec) > > memory_listener); > > > > xen_pt_region_update(s, sec, false); > > - memory_region_unref(sec->mr); > > } > > > > static void xen_pt_io_region_add(MemoryListener *l, > MemoryRegionSection *sec) > > @@ -606,7 +604,6 @@ static void xen_pt_io_region_add(MemoryListener > *l, MemoryRegionSection *sec) > > XenPCIPassthroughState *s =3D container_of(l, XenPCIPassthroughSta= te, > > io_listener); > > > > - memory_region_ref(sec->mr); > > xen_pt_region_update(s, sec, true); > > } > > > > @@ -616,7 +613,6 @@ static void xen_pt_io_region_del(MemoryListener *l, > MemoryRegionSection *sec) > > io_listener); > > > > xen_pt_region_update(s, sec, false); > > - memory_region_unref(sec->mr); > > } > > > > static const MemoryListener xen_pt_memory_listener =3D { > > -- > > 1.9.1 > > >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tian, Kevin" Subject: Re: [PATCH] xen-pt: Fix PCI devices re-attach failed Date: Mon, 12 Jan 2015 12:02:05 +0000 Message-ID: References: <1419411417-23354-1-git-send-email-liang.z.li@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , "Li, Liang Z" Cc: "xen-devel@lists.xensource.com" , "mst@redhat.com" , "mtosatti@redhat.com" , "qemu-devel@nongnu.org" , "aliguori@amazon.com" , "pbonzini@redhat.com" , "Zhang, Yang Z" , "Hu, Robert" , "rth@twiddle.net" List-Id: xen-devel@lists.xenproject.org > From: Stefano Stabellini > Sent: Monday, January 12, 2015 7:36 PM > > On Wed, 24 Dec 2014, Liang Li wrote: > > Use the 'xl pci-attach $DomU $BDF' command to attach more then > > one PCI devices to the guest, then detach the devices with > > 'xl pci-detach $DomU $BDF', after that, re-attach these PCI > > devices again, an error message will be reported like following: > > > > libxl: error: libxl_qmp.c:287:qmp_handle_error_response: receive > > an error message from QMP server: Duplicate ID 'pci-pt-03_10.1' > > for device. > > > > The count of calling xen_pt_region_add and xen_pt_region_del are > > not the same will cause the XenPCIPassthroughState and it's related > > QemuOpts object not be released properly. > > Thanks for the patch! > > From this description, I don't quite understand why the > memory_region_ref and memory_region_unref calls are wrong. What do > you > mean by "The count of calling xen_pt_region_add and xen_pt_region_del > are not the same"? > > On unplug xen_pt_region_del does not get called? > Or the memory region argument is not exactly the same as the one > initially passed to xen_pt_region_add? > agree. Liang, could you elaborate how the patch is associated with above explanation? :-) > > > Signed-off-by: Liang Li > > Reported-by: Longtao Pang > > --- > > hw/xen/xen_pt.c | 4 ---- > > 1 file changed, 4 deletions(-) > > > > diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c > > index c1bf357..523b8a2 100644 > > --- a/hw/xen/xen_pt.c > > +++ b/hw/xen/xen_pt.c > > @@ -588,7 +588,6 @@ static void xen_pt_region_add(MemoryListener *l, > MemoryRegionSection *sec) > > XenPCIPassthroughState *s = container_of(l, XenPCIPassthroughState, > > memory_listener); > > > > - memory_region_ref(sec->mr); > > xen_pt_region_update(s, sec, true); > > } > > > > @@ -598,7 +597,6 @@ static void xen_pt_region_del(MemoryListener *l, > MemoryRegionSection *sec) > > memory_listener); > > > > xen_pt_region_update(s, sec, false); > > - memory_region_unref(sec->mr); > > } > > > > static void xen_pt_io_region_add(MemoryListener *l, > MemoryRegionSection *sec) > > @@ -606,7 +604,6 @@ static void xen_pt_io_region_add(MemoryListener > *l, MemoryRegionSection *sec) > > XenPCIPassthroughState *s = container_of(l, XenPCIPassthroughState, > > io_listener); > > > > - memory_region_ref(sec->mr); > > xen_pt_region_update(s, sec, true); > > } > > > > @@ -616,7 +613,6 @@ static void xen_pt_io_region_del(MemoryListener *l, > MemoryRegionSection *sec) > > io_listener); > > > > xen_pt_region_update(s, sec, false); > > - memory_region_unref(sec->mr); > > } > > > > static const MemoryListener xen_pt_memory_listener = { > > -- > > 1.9.1 > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel