diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2018-01-30 16:28:49 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-02-07 14:09:25 +0100 |
commit | 9857c2d2f7fb09fe37d7a72b004b1f7bcf70248c (patch) | |
tree | 108ffd561fcb7bd7b758395560460db6e4075952 /cpus.c | |
parent | a40227911c4cac4ac2551c57058d220baae4e91f (diff) | |
download | qemu-9857c2d2f7fb09fe37d7a72b004b1f7bcf70248c.tar.gz |
cpus: hax: register/unregister thread with RCU, exit loop on unplug
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1473,6 +1473,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) CPUState *cpu = arg; int r; + rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); @@ -1484,7 +1485,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) hax_init_vcpu(cpu); qemu_cond_signal(&qemu_cpu_cond); - while (1) { + do { if (cpu_can_run(cpu)) { r = hax_smp_cpu_exec(cpu); if (r == EXCP_DEBUG) { @@ -1493,7 +1494,8 @@ static void *qemu_hax_cpu_thread_fn(void *arg) } qemu_wait_io_event(cpu); - } + } while (!cpu->unplug || cpu_can_run(cpu)); + rcu_unregister_thread(); return NULL; } |