Skip to contentSkip to conversation

spapr-cpu-core: Release ICPState object during CPU unrealization

PATCH Applied Bharata B Rao 3 participants 6 messages Apr 12, 2017 – Apr 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr-cpu-core: Release ICPState object during CPU unrealization

Recent commits that re-organized ICPState object missed to destroy the object when CPU is unrealized. Fix this so that CPU unplug doesn't abort QEMU.

---
 hw/ppc/spapr_cpu_core.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_cpu_core.c +1 -0
index 2e689b5..4389ef4 100644
@@ -127,6 +127,7 @@ static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
         PowerPCCPU *cpu = POWERPC_CPU(cs);
 
         spapr_cpu_destroy(cpu);
+        object_unparent(cpu->intc);
         cpu_remove_sync(cs);
         object_unparent(obj);
     }
Signature · 1 line
2.7.4
#1 lore raw

This should be considered for ppc-for-2.10 branch of dwg's tree.

Quoted 23 lines · Bharata B Rao

Recent commits that re-organized ICPState object missed to destroy the object when CPU is unrealized. Fix this so that CPU unplug doesn't abort QEMU.

---
 hw/ppc/spapr_cpu_core.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_cpu_core.c +1 -0
index 2e689b5..4389ef4 100644
@@ -127,6 +127,7 @@ static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
         PowerPCCPU *cpu = POWERPC_CPU(cs);
 
         spapr_cpu_destroy(cpu);
+        object_unparent(cpu->intc);
         cpu_remove_sync(cs);
         object_unparent(obj);
     }
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#2 lore raw
In reply to Bharata B Rao
Quoted 3 lines · Bharata B Rao

Recent commits that re-organized ICPState object missed to destroy the object when CPU is unrealized. Fix this so that CPU unplug doesn't abort QEMU.

Indeed.

Quoted 1 line

I am wondering if we should not be doing the unparent under spapr_cpu_destroy() or even xics_cpu_destroy(). Apart from that,

Thanks,

C.

Quoted 17 lines
---
 hw/ppc/spapr_cpu_core.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_cpu_core.c +1 -0
index 2e689b5..4389ef4 100644
@@ -127,6 +127,7 @@ static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
         PowerPCCPU *cpu = POWERPC_CPU(cs);
 
         spapr_cpu_destroy(cpu);
+        object_unparent(cpu->intc);
         cpu_remove_sync(cs);
         object_unparent(obj);
     }
#3 lore raw
Quoted 5 lines · Cédric Le Goater
Quoted 3 lines · Bharata B Rao

Recent commits that re-organized ICPState object missed to destroy the object when CPU is unrealized. Fix this so that CPU unplug doesn't abort QEMU.

Quoted 7 lines

Indeed.

Quoted 1 line

I am wondering if we should not be doing the unparent under spapr_cpu_destroy() or even xics_cpu_destroy(). Apart from that,

Thought so, but since object is created in realize routinte itself (and not in any of its callers), did the object destruction in unrealize to be symmetrical :)

Regards,
Bharata.

#4 lore raw
Quoted 10 lines · Bharata B Rao
Quoted 9 lines · Cédric Le Goater
Quoted 3 lines · Bharata B Rao

Recent commits that re-organized ICPState object missed to destroy the object when CPU is unrealized. Fix this so that CPU unplug doesn't abort QEMU.

Indeed.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I am wondering if we should not be doing the unparent under spapr_cpu_destroy() or even xics_cpu_destroy(). Apart from that,

Thought so, but since object is created in realize routinte itself (and not in any of its callers), did the object destruction in unrealize to be symmetrical :)

yes. I think it is a good pratice to unparent/free the object in the same file it was allocated.

Thanks,

C.

Applied
#5 lore raw
In reply to Bharata B Rao
Quoted 5 lines · Bharata B Rao

Recent commits that re-organized ICPState object missed to destroy the object when CPU is unrealized. Fix this so that CPU unplug doesn't abort QEMU.

Applied to ppc-for-2.10, thanks.

Quoted 16 lines
---
 hw/ppc/spapr_cpu_core.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_cpu_core.c +1 -0
index 2e689b5..4389ef4 100644
@@ -127,6 +127,7 @@ static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
         PowerPCCPU *cpu = POWERPC_CPU(cs);
 
         spapr_cpu_destroy(cpu);
+        object_unparent(cpu->intc);
         cpu_remove_sync(cs);
         object_unparent(obj);
     }
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson