From: Mark Kanda <mark.kanda@oracle.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, richard.henderson@linaro.org,
Philippe Mathieu-Daude <philippe.mathieu.daude@gmail.com>
Subject: [PATCH v2 1/5] accel: Introduce AccelOpsClass::destroy_vcpu_thread()
Date: Fri, 18 Mar 2022 10:15:51 -0500 [thread overview]
Message-ID: <20220318151555.381737-2-mark.kanda@oracle.com> (raw)
In-Reply-To: <20220318151555.381737-1-mark.kanda@oracle.com>
Add destroy_vcpu_thread() to AccelOps as a method for vcpu thread cleanup.
This will be used in subsequent patches.
Suggested-by: Philippe Mathieu-Daude <philippe.mathieu.daude@gmail.com>
Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
---
include/sysemu/accel-ops.h | 1 +
softmmu/cpus.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h
index 6013c9444c..e296b27b82 100644
--- a/include/sysemu/accel-ops.h
+++ b/include/sysemu/accel-ops.h
@@ -31,6 +31,7 @@ struct AccelOpsClass {
bool (*cpus_are_resettable)(void);
void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
+ void (*destroy_vcpu_thread)(CPUState *cpu);
void (*kick_vcpu_thread)(CPUState *cpu);
bool (*cpu_thread_is_idle)(CPUState *cpu);
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 7b75bb66d5..622f8b4608 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -609,6 +609,9 @@ void cpu_remove_sync(CPUState *cpu)
qemu_mutex_unlock_iothread();
qemu_thread_join(cpu->thread);
qemu_mutex_lock_iothread();
+ if (cpus_accel->destroy_vcpu_thread) {
+ cpus_accel->destroy_vcpu_thread(cpu);
+ }
}
void cpus_register_accel(const AccelOpsClass *ops)
--
2.27.0
next prev parent reply other threads:[~2022-03-18 15:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 15:15 [PATCH v2 0/5] vCPU hotunplug related memory leaks Mark Kanda
2022-03-18 15:15 ` Mark Kanda [this message]
2022-03-18 16:20 ` [PATCH v2 1/5] accel: Introduce AccelOpsClass::destroy_vcpu_thread() Philippe Mathieu-Daudé
2022-03-18 15:15 ` [PATCH v2 2/5] softmmu/cpus: Free cpu->thread in destroy_vcpu_thread_generic() Mark Kanda
2022-03-18 15:15 ` [PATCH v2 3/5] softmmu/cpus: Free cpu->halt_cond " Mark Kanda
2022-03-18 15:15 ` [PATCH v2 4/5] cpu: Free cpu->cpu_ases in cpu_exec_unrealizefn() Mark Kanda
2022-03-18 16:26 ` Philippe Mathieu-Daudé
2022-03-18 17:03 ` Mark Kanda
2022-03-18 15:15 ` [PATCH v2 5/5] i386/cpu: Free env->xsave_buf in x86_cpu_unrealizefn() Mark Kanda
2022-03-18 16:32 ` Philippe Mathieu-Daudé
2022-03-18 17:04 ` 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=20220318151555.381737-2-mark.kanda@oracle.com \
--to=mark.kanda@oracle.com \
--cc=pbonzini@redhat.com \
--cc=philippe.mathieu.daude@gmail.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).