From: Mark Kanda <mark.kanda@oracle.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, richard.henderson@linaro.org
Subject: [PATCH 1/4] softmmu/cpus: Free cpu->thread in cpu_remove_sync()
Date: Wed, 26 Jan 2022 08:29:43 -0600 [thread overview]
Message-ID: <20220126142946.667782-2-mark.kanda@oracle.com> (raw)
In-Reply-To: <20220126142946.667782-1-mark.kanda@oracle.com>
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);
}
void cpus_register_accel(const AccelOpsClass *ops)
--
2.27.0
next prev parent reply other threads:[~2022-01-26 14:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 14:29 [PATCH 0/4] vCPU hotunplug related memory leaks Mark Kanda
2022-01-26 14:29 ` Mark Kanda [this message]
2022-02-22 17:15 ` [PATCH 1/4] softmmu/cpus: Free cpu->thread in cpu_remove_sync() Philippe Mathieu-Daudé
2022-01-26 14:29 ` [PATCH 2/4] softmmu/cpus: Free cpu->halt_cond " Mark Kanda
2022-01-26 14:29 ` [PATCH 3/4] cpu: Free cpu->cpu_ases in cpu_exec_unrealizefn() Mark Kanda
2022-01-26 14:29 ` [PATCH 4/4] i386/cpu: Free env->xsave_buf in x86_cpu_unrealizefn() Mark Kanda
2022-02-22 16:04 ` [PATCH 0/4] vCPU hotunplug related memory leaks Mark Kanda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220126142946.667782-2-mark.kanda@oracle.com \
--to=mark.kanda@oracle.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).