Bläddra i källkod

cpus: ignore ESRCH in qemu_cpu_kick_thread()

We can have a race condition between qemu_cpu_kick_thread() and
qemu_kvm_cpu_thread_fn() when we hotunplug a CPU. In this case,
qemu_cpu_kick_thread() can try to kick a thread that is exiting.
pthread_kill() returns an error and qemu is stopped by an exit(1).

   qemu:qemu_cpu_kick_thread: No such process

We can ignore safely this error.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Laurent Vivier 6 år sedan
förälder
incheckning
d455ebc4f8
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      cpus.c

+ 1 - 1
cpus.c

@@ -1778,7 +1778,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
     }
     }
     cpu->thread_kicked = true;
     cpu->thread_kicked = true;
     err = pthread_kill(cpu->thread->thread, SIG_IPI);
     err = pthread_kill(cpu->thread->thread, SIG_IPI);
-    if (err) {
+    if (err && err != ESRCH) {
         fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
         fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
         exit(1);
         exit(1);
     }
     }