Skip to contentSkip to conversation

pci_bridge: manually destroy memory regions within PCIBridgeWindows

PATCH Applied Paolo Bonzini 3 participants 6 messages Aug 20, 2014 – Aug 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci_bridge: manually destroy memory regions within PCIBridgeWindows

The regions are destroyed and recreated on configuration space accesses. We need to destroy them before the containing PCIBridgeWindows object is freed.

---
 hw/pci/pci_bridge.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/pci_bridge.c +6 -0
index 1307265..40c97b1 100644
@@ -219,6 +219,12 @@ static void pci_bridge_region_del(PCIBridge *br, PCIBridgeWindows *w)
 
 static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
 {
+    object_unparent(OBJECT(&w->alias_io));
+    object_unparent(OBJECT(&w->alias_mem));
+    object_unparent(OBJECT(&w->alias_pref_mem));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_LO]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_HI]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_MEM]));
     g_free(w);
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 7 lines · Paolo Bonzini

The regions are destroyed and recreated on configuration space accesses. We need to destroy them before the containing PCIBridgeWindows object is freed.

Regression in 2.1? Cc stable?

Quoted 23 lines
---
 hw/pci/pci_bridge.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/pci_bridge.c +6 -0
index 1307265..40c97b1 100644
@@ -219,6 +219,12 @@ static void pci_bridge_region_del(PCIBridge *br, PCIBridgeWindows *w)
 
 static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
 {
+    object_unparent(OBJECT(&w->alias_io));
+    object_unparent(OBJECT(&w->alias_mem));
+    object_unparent(OBJECT(&w->alias_pref_mem));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_LO]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_HI]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_MEM]));
     g_free(w);
 }
 
Signature · 1 line
1.8.3.1
#2 lore raw

Il 20/08/2014 21:17, Michael S. Tsirkin ha scritto:

Quoted 33 lines · Paolo Bonzini
Quoted 7 lines

The regions are destroyed and recreated on configuration space accesses. We need to destroy them before the containing PCIBridgeWindows object is freed.

Regression in 2.1? Cc stable?

Quoted 21 lines
---
 hw/pci/pci_bridge.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/pci_bridge.c +6 -0
index 1307265..40c97b1 100644
@@ -219,6 +219,12 @@ static void pci_bridge_region_del(PCIBridge *br, PCIBridgeWindows *w)
 
 static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
 {
+    object_unparent(OBJECT(&w->alias_io));
+    object_unparent(OBJECT(&w->alias_mem));
+    object_unparent(OBJECT(&w->alias_pref_mem));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_LO]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_HI]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_MEM]));
     g_free(w);
 }
 
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
1.8.3.1

No, regression from yesterday.

Paolo

#3 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini

The regions are destroyed and recreated on configuration space accesses. We need to destroy them before the containing PCIBridgeWindows object is freed.

Applied, thanks!

Quoted 23 lines
---
 hw/pci/pci_bridge.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/pci_bridge.c +6 -0
index 1307265..40c97b1 100644
@@ -219,6 +219,12 @@ static void pci_bridge_region_del(PCIBridge *br, PCIBridgeWindows *w)
 
 static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
 {
+    object_unparent(OBJECT(&w->alias_io));
+    object_unparent(OBJECT(&w->alias_mem));
+    object_unparent(OBJECT(&w->alias_pref_mem));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_LO]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_HI]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_MEM]));
     g_free(w);
 }
 
Signature · 1 line
1.8.3.1
Tested-by on v1 1/1
#4 lore raw
In reply to Paolo Bonzini
Quoted 40 lines

-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Wednesday, August 20, 2014 11:50 PM
To: [email protected]
Cc: [email protected]; Gonglei (Arei); [email protected]; [email protected]
Subject: [PATCH] pci_bridge: manually destroy memory regions within PCIBridgeWindows

The regions are destroyed and recreated on configuration space accesses. We need to destroy them before the containing PCIBridgeWindows object is freed.

---
 hw/pci/pci_bridge.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/pci_bridge.c +6 -1
index 1307265..40c97b1 100644
@@ -219,6 +219,12 @@ static void pci_bridge_region_del(PCIBridge *br,
 PCIBridgeWindows *w)
 
 static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
 {
+    object_unparent(OBJECT(&w->alias_io));
+    object_unparent(OBJECT(&w->alias_mem));
+    object_unparent(OBJECT(&w->alias_pref_mem));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_LO]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_HI]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_MEM]));
     g_free(w);
 }
 
--
Quoted 1 line

1.8.3.1

Best regards,
-Gonglei

#5 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini

The regions are destroyed and recreated on configuration space accesses. We need to destroy them before the containing PCIBridgeWindows object is freed.

Applied in my tree.

Quoted 23 lines
---
 hw/pci/pci_bridge.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/pci_bridge.c +6 -0
index 1307265..40c97b1 100644
@@ -219,6 +219,12 @@ static void pci_bridge_region_del(PCIBridge *br, PCIBridgeWindows *w)
 
 static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
 {
+    object_unparent(OBJECT(&w->alias_io));
+    object_unparent(OBJECT(&w->alias_mem));
+    object_unparent(OBJECT(&w->alias_pref_mem));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_LO]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_IO_HI]));
+    object_unparent(OBJECT(&w->alias_vga[QEMU_PCI_VGA_MEM]));
     g_free(w);
 }
 
Signature · 1 line
1.8.3.1