Message ID | 20220323171751.78612-13-philippe.mathieu.daude@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | accel: Fix vCPU memory leaks | expand |
Thanks Philippe, In the patch subject, 'generic_destroy_vcpu_thread()' should be changed to 'common_vcpu_thread_destroy()'. Same goes for the next patch (Free cpu->halt_cond). Thanks/regards, -Mark On 3/23/2022 12:17 PM, Philippe Mathieu-Daudé wrote: > From: Mark Kanda <mark.kanda@oracle.com> > > Free cpu->thread in a new AccelOpsClass::destroy_vcpu_thread() handler > generic_destroy_vcpu_thread(). > > vCPU hotunplug related leak reported by Valgrind: > > ==102631== 8 bytes in 1 blocks are definitely lost in loss record 1,037 of 8,555 > ==102631== at 0x4C3ADBB: calloc (vg_replace_malloc.c:1117) > ==102631== by 0x69EE4CD: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.4) > ==102631== by 0x92443A: kvm_start_vcpu_thread (kvm-accel-ops.c:68) > ==102631== by 0x4505C2: qemu_init_vcpu (cpus.c:643) > ==102631== by 0x76B4D1: x86_cpu_realizefn (cpu.c:6520) > ==102631== by 0x9344A7: device_set_realized (qdev.c:531) > ==102631== by 0x93E329: property_set_bool (object.c:2273) > ==102631== by 0x93C2F8: object_property_set (object.c:1408) > ==102631== by 0x940796: object_property_set_qobject (qom-qobject.c:28) > ==102631== by 0x93C663: object_property_set_bool (object.c:1477) > ==102631== by 0x933D3B: qdev_realize (qdev.c:333) > ==102631== by 0x455EC4: qdev_device_add_from_qdict (qdev-monitor.c:713) > > Signed-off-by: Mark Kanda <mark.kanda@oracle.com> > Message-Id: <20220321141409.3112932-3-mark.kanda@oracle.com> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > softmmu/cpus.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/softmmu/cpus.c b/softmmu/cpus.c > index 37325b3b8d..efa8397f04 100644 > --- a/softmmu/cpus.c > +++ b/softmmu/cpus.c > @@ -619,6 +619,7 @@ static void common_vcpu_thread_create(CPUState *cpu) > > static void common_vcpu_thread_destroy(CPUState *cpu) > { > + g_free(cpu->thread); > } > > void cpu_remove_sync(CPUState *cpu)
On 3/23/22 10:17, Philippe Mathieu-Daudé wrote: > static void common_vcpu_thread_destroy(CPUState *cpu) > { > + g_free(cpu->thread); > } Missing free of halt_cond. r~
diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 37325b3b8d..efa8397f04 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -619,6 +619,7 @@ static void common_vcpu_thread_create(CPUState *cpu) static void common_vcpu_thread_destroy(CPUState *cpu) { + g_free(cpu->thread); } void cpu_remove_sync(CPUState *cpu)