@@ -13,7 +13,6 @@
/* kick MTTCG vCPU thread */
void mttcg_kick_vcpu_thread(CPUState *cpu);
-/* start an mttcg vCPU thread */
-void mttcg_start_vcpu_thread(CPUState *cpu);
+void *mttcg_cpu_thread_routine(void *arg);
#endif /* TCG_ACCEL_OPS_MTTCG_H */
@@ -61,7 +61,7 @@ static void mttcg_force_rcu(Notifier *notify, void *data)
* current CPUState for a given thread.
*/
-static void *mttcg_cpu_thread_fn(void *arg)
+void *mttcg_cpu_thread_routine(void *arg)
{
MttcgForceRcuNotifier force_rcu;
CPUState *cpu = arg;
@@ -128,17 +128,3 @@ void mttcg_kick_vcpu_thread(CPUState *cpu)
{
cpu_exit(cpu);
}
-
-void mttcg_start_vcpu_thread(CPUState *cpu)
-{
- char thread_name[VCPU_THREAD_NAME_SIZE];
-
- tcg_vcpu_thread_precreate(cpu);
-
- /* create a thread per vCPU with TCG (MTTCG) */
- snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",
- cpu->cpu_index);
-
- qemu_thread_create(cpu->thread, thread_name, mttcg_cpu_thread_fn,
- cpu, QEMU_THREAD_JOINABLE);
-}
@@ -210,7 +210,7 @@ static void tcg_accel_ops_init(AccelClass *ac)
AccelOpsClass *ops = ac->ops;
if (qemu_tcg_mttcg_enabled()) {
- ops->create_vcpu_thread = mttcg_start_vcpu_thread;
+ ops->cpu_thread_routine = mttcg_cpu_thread_routine;
ops->kick_vcpu_thread = mttcg_kick_vcpu_thread;
ops->handle_interrupt = tcg_handle_interrupt;
} else {
@@ -226,6 +226,7 @@ static void tcg_accel_ops_init(AccelClass *ac)
}
}
+ ops->thread_precreate = tcg_vcpu_thread_precreate;
ops->cpu_reset_hold = tcg_cpu_reset_hold;
ops->supports_guest_debug = tcg_supports_guest_debug;
ops->insert_breakpoint = tcg_insert_breakpoint;
By converting to AccelOpsClass::cpu_thread_routine we can let the common accel_create_vcpu_thread() create the thread. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/tcg/tcg-accel-ops-mttcg.h | 3 +-- accel/tcg/tcg-accel-ops-mttcg.c | 16 +--------------- accel/tcg/tcg-accel-ops.c | 3 ++- 3 files changed, 4 insertions(+), 18 deletions(-)