OSDN Git Service

accel/tcg: Restrict cpu_handle_halt() to sysemu
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 12 Sep 2021 17:27:02 +0000 (19:27 +0200)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 22 Sep 2021 02:36:44 +0000 (19:36 -0700)
commit0596fa11f16c81d5237da64e59e8583a971dfe1c
treeeecf329bcd90a550a50a899fb1516b2a307ca095
parent8b1d5b3c3507d062d7611a64a81989e8903605ed
accel/tcg: Restrict cpu_handle_halt() to sysemu

Commit 372579427a5 ("tcg: enable thread-per-vCPU") added the following
comment describing EXCP_HALTED in qemu_tcg_cpu_thread_fn():

    case EXCP_HALTED:
         /* during start-up the vCPU is reset and the thread is
          * kicked several times. If we don't ensure we go back
          * to sleep in the halted state we won't cleanly
          * start-up when the vCPU is enabled.
          *
          * cpu->halted should ensure we sleep in wait_io_event
          */
         g_assert(cpu->halted);
         break;

qemu_wait_io_event() is sysemu-specific, so we can restrict the
cpu_handle_halt() call in cpu_exec() to system emulation.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210912172731.789788-2-f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/cpu-exec.c