Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
accel: Destroy HAX vCPU threads once done
When the vCPU thread finished its processing, destroy
it and signal its destruction to generic vCPU management
layer.

Add a sanity check for the vCPU accelerator context.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230624174121.11508-6-philmd@linaro.org>
  • Loading branch information
philmd committed Jun 28, 2023
1 parent 4347734 commit 83d0f7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions target/i386/hax/hax-accel-ops.c
Expand Up @@ -53,6 +53,8 @@ static void *hax_cpu_thread_fn(void *arg)

qemu_wait_io_event(cpu);
} while (!cpu->unplug || cpu_can_run(cpu));
hax_vcpu_destroy(cpu);
cpu_thread_signal_destroyed(cpu);
rcu_unregister_thread();
return NULL;
}
Expand All @@ -69,6 +71,7 @@ static void hax_start_vcpu_thread(CPUState *cpu)
cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, hax_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE);
assert(cpu->hax_vcpu);
#ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif
Expand Down
1 change: 1 addition & 0 deletions target/i386/hax/hax-all.c
Expand Up @@ -209,6 +209,7 @@ int hax_vcpu_destroy(CPUState *cpu)
CloseHandle(cpu->hThread);
#endif
g_free(vcpu);
cpu->hax_vcpu = NULL;
return 0;
}

Expand Down

0 comments on commit 83d0f7f

Please sign in to comment.