From: Mark Kanda <mark.kanda@oracle.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, richard.henderson@linaro.org
Subject: [PATCH 4/4] i386/cpu: Free env->xsave_buf in x86_cpu_unrealizefn()
Date: Wed, 26 Jan 2022 08:29:46 -0600 [thread overview]
Message-ID: <20220126142946.667782-5-mark.kanda@oracle.com> (raw)
In-Reply-To: <20220126142946.667782-1-mark.kanda@oracle.com>
vCPU hotunplug related leak reported by Valgrind:
==377357== 4,096 bytes in 1 blocks are definitely lost in loss record 8,354 of 8,471
==377357== at 0x4C3B15F: memalign (vg_replace_malloc.c:1265)
==377357== by 0x4C3B288: posix_memalign (vg_replace_malloc.c:1429)
==377357== by 0xAA4773: qemu_try_memalign (oslib-posix.c:222)
==377357== by 0xAA47E5: qemu_memalign (oslib-posix.c:238)
==377357== by 0x6C403D: kvm_arch_init_vcpu (kvm.c:1986)
==377357== by 0x8AEB01: kvm_init_vcpu (kvm-all.c:516)
==377357== by 0x8B59EA: kvm_vcpu_thread_fn (kvm-accel-ops.c:40)
==377357== by 0xAA72F0: qemu_thread_start (qemu-thread-posix.c:556)
==377357== by 0x8EE8159: start_thread (in /usr/lib64/libpthread-2.28.so)
==377357== by 0x91FCDD2: clone (in /usr/lib64/libc-2.28.so)
Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
---
target/i386/cpu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index aa9e636800..33405d245d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6487,6 +6487,7 @@ static void x86_cpu_unrealizefn(DeviceState *dev)
{
X86CPU *cpu = X86_CPU(dev);
X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
+ CPUX86State *env = &cpu->env;
#ifndef CONFIG_USER_ONLY
cpu_remove_sync(CPU(dev));
@@ -6499,6 +6500,7 @@ static void x86_cpu_unrealizefn(DeviceState *dev)
}
xcc->parent_unrealize(dev);
+ g_free(env->xsave_buf);
}
typedef struct BitProperty {
--
2.27.0
next prev parent reply other threads:[~2022-01-26 14:32 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 ` [PATCH 1/4] softmmu/cpus: Free cpu->thread in cpu_remove_sync() Mark Kanda
2022-02-22 17:15 ` 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 ` Mark Kanda [this message]
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-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.