Message ID | 20220126142946.667782-2-mark.kanda@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vCPU hotunplug related memory leaks | expand |
On 26/1/22 15:29, Mark Kanda wrote: > vCPU hotunplug related leak reported by Valgrind: > > ==377357== 8 bytes in 1 blocks are definitely lost in loss record 1,029 of 8,471 > ==377357== at 0x4C3ADBB: calloc (vg_replace_malloc.c:1117) > ==377357== by 0x65C14CD: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.4) > ==377357== by 0x8B5AC8: kvm_start_vcpu_thread (kvm-accel-ops.c:68) > ==377357== by 0x7817AF: qemu_init_vcpu (cpus.c:634) > ==377357== by 0x7185A3: x86_cpu_realizefn (cpu.c:6447) > ==377357== by 0x8E46B7: device_set_realized (qdev.c:531) > ==377357== by 0x8EE36F: property_set_bool (object.c:2268) > ==377357== by 0x8EC3C5: object_property_set (object.c:1403) > ==377357== by 0x8F075D: object_property_set_qobject (qom-qobject.c:28) > ==377357== by 0x8EC72C: object_property_set_bool (object.c:1472) > ==377357== by 0x8E3F7F: qdev_realize (qdev.c:333) > ==377357== by 0x43F3A2: qdev_device_add_from_qdict (qdev-monitor.c:711) > > Signed-off-by: Mark Kanda <mark.kanda@oracle.com> > --- > softmmu/cpus.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/softmmu/cpus.c b/softmmu/cpus.c > index 23bca46b07..1d8380d4aa 100644 > --- a/softmmu/cpus.c > +++ b/softmmu/cpus.c > @@ -603,6 +603,7 @@ void cpu_remove_sync(CPUState *cpu) > qemu_mutex_unlock_iothread(); > qemu_thread_join(cpu->thread); > qemu_mutex_lock_iothread(); > + g_free(cpu->thread); Shouldn't we free that in a dedicated AccelOpsClass::destroy_vcpu_thread handler instead? (Similarly to free CPUState::halt_cond, next patch). > }
diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 23bca46b07..1d8380d4aa 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -603,6 +603,7 @@ void cpu_remove_sync(CPUState *cpu) qemu_mutex_unlock_iothread(); qemu_thread_join(cpu->thread); qemu_mutex_lock_iothread(); + g_free(cpu->thread); } void cpus_register_accel(const AccelOpsClass *ops)
vCPU hotunplug related leak reported by Valgrind: ==377357== 8 bytes in 1 blocks are definitely lost in loss record 1,029 of 8,471 ==377357== at 0x4C3ADBB: calloc (vg_replace_malloc.c:1117) ==377357== by 0x65C14CD: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.4) ==377357== by 0x8B5AC8: kvm_start_vcpu_thread (kvm-accel-ops.c:68) ==377357== by 0x7817AF: qemu_init_vcpu (cpus.c:634) ==377357== by 0x7185A3: x86_cpu_realizefn (cpu.c:6447) ==377357== by 0x8E46B7: device_set_realized (qdev.c:531) ==377357== by 0x8EE36F: property_set_bool (object.c:2268) ==377357== by 0x8EC3C5: object_property_set (object.c:1403) ==377357== by 0x8F075D: object_property_set_qobject (qom-qobject.c:28) ==377357== by 0x8EC72C: object_property_set_bool (object.c:1472) ==377357== by 0x8E3F7F: qdev_realize (qdev.c:333) ==377357== by 0x43F3A2: qdev_device_add_from_qdict (qdev-monitor.c:711) Signed-off-by: Mark Kanda <mark.kanda@oracle.com> --- softmmu/cpus.c | 1 + 1 file changed, 1 insertion(+)