diff mbox series

[v6,69/73] cpu: rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle

Message ID 20190130004811.27372-70-cota@braap.org (mailing list archive)
State New, archived
Headers show
Series per-CPU locks | expand

Commit Message

Emilio Cota Jan. 30, 2019, 12:48 a.m. UTC
This function is only called from TCG rr mode, so add
a prefix to mark this as well as an assertion.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 cpus.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Alex Bennée Feb. 8, 2019, 11:34 a.m. UTC | #1
Emilio G. Cota <cota@braap.org> writes:

> This function is only called from TCG rr mode, so add
> a prefix to mark this as well as an assertion.
>
> Signed-off-by: Emilio G. Cota <cota@braap.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  cpus.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index aee129c0b3..0d255c2655 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -211,10 +211,12 @@ static bool cpu_thread_is_idle(CPUState *cpu)
>      return true;
>  }
>
> -static bool all_cpu_threads_idle(void)
> +static bool qemu_tcg_rr_all_cpu_threads_idle(void)
>  {
>      CPUState *cpu;
>
> +    g_assert(qemu_is_tcg_rr());
> +
>      CPU_FOREACH(cpu) {
>          if (!cpu_thread_is_idle(cpu)) {
>              return false;
> @@ -692,7 +694,7 @@ void qemu_start_warp_timer(void)
>      }
>
>      if (replay_mode != REPLAY_MODE_PLAY) {
> -        if (!all_cpu_threads_idle()) {
> +        if (!qemu_tcg_rr_all_cpu_threads_idle()) {
>              return;
>          }
>
> @@ -1325,7 +1327,7 @@ static void qemu_tcg_rr_wait_io_event(void)
>  {
>      CPUState *cpu;
>
> -    while (all_cpu_threads_idle()) {
> +    while (qemu_tcg_rr_all_cpu_threads_idle()) {
>          stop_tcg_kick_timer();
>          qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex);
>      }
> @@ -1659,7 +1661,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
>              atomic_mb_set(&cpu->exit_request, 0);
>          }
>
> -        if (use_icount && all_cpu_threads_idle()) {
> +        if (use_icount && qemu_tcg_rr_all_cpu_threads_idle()) {
>              /*
>               * When all cpus are sleeping (e.g in WFI), to avoid a deadlock
>               * in the main_loop, wake it up in order to start the warp timer.


--
Alex Bennée
Richard Henderson Feb. 20, 2019, 5:01 p.m. UTC | #2
On 1/29/19 4:48 PM, Emilio G. Cota wrote:
> This function is only called from TCG rr mode, so add
> a prefix to mark this as well as an assertion.
> 
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  cpus.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/cpus.c b/cpus.c
index aee129c0b3..0d255c2655 100644
--- a/cpus.c
+++ b/cpus.c
@@ -211,10 +211,12 @@  static bool cpu_thread_is_idle(CPUState *cpu)
     return true;
 }
 
-static bool all_cpu_threads_idle(void)
+static bool qemu_tcg_rr_all_cpu_threads_idle(void)
 {
     CPUState *cpu;
 
+    g_assert(qemu_is_tcg_rr());
+
     CPU_FOREACH(cpu) {
         if (!cpu_thread_is_idle(cpu)) {
             return false;
@@ -692,7 +694,7 @@  void qemu_start_warp_timer(void)
     }
 
     if (replay_mode != REPLAY_MODE_PLAY) {
-        if (!all_cpu_threads_idle()) {
+        if (!qemu_tcg_rr_all_cpu_threads_idle()) {
             return;
         }
 
@@ -1325,7 +1327,7 @@  static void qemu_tcg_rr_wait_io_event(void)
 {
     CPUState *cpu;
 
-    while (all_cpu_threads_idle()) {
+    while (qemu_tcg_rr_all_cpu_threads_idle()) {
         stop_tcg_kick_timer();
         qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex);
     }
@@ -1659,7 +1661,7 @@  static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
             atomic_mb_set(&cpu->exit_request, 0);
         }
 
-        if (use_icount && all_cpu_threads_idle()) {
+        if (use_icount && qemu_tcg_rr_all_cpu_threads_idle()) {
             /*
              * When all cpus are sleeping (e.g in WFI), to avoid a deadlock
              * in the main_loop, wake it up in order to start the warp timer.