On 1/24/24 17:41, Philippe Mathieu-Daudé wrote:
Replace the manual rcu_read_(un)lock calls by the
WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba
"docs/style: call out the use of GUARD macros").

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  accel/tcg/cpu-exec.c | 24 ++++++++++++------------
  1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 67eda9865e..6b3f66930e 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -1070,21 +1070,21 @@ int cpu_exec(CPUState *cpu)
          return EXCP_HALTED;
      }
- rcu_read_lock();
-    cpu_exec_enter(cpu);
+    WITH_RCU_READ_LOCK_GUARD() {
+        cpu_exec_enter(cpu);
- /*
-     * Calculate difference between guest clock and host clock.
-     * This delay includes the delay of the last cycle, so
-     * what we have to do is sleep until it is 0. As for the
-     * advance/delay we gain here, we try to fix it next time.
-     */
-    init_delay_params(&sc, cpu);
+        /*
+         * Calculate difference between guest clock and host clock.
+         * This delay includes the delay of the last cycle, so
+         * what we have to do is sleep until it is 0. As for the
+         * advance/delay we gain here, we try to fix it next time.
+         */
+        init_delay_params(&sc, cpu);
- ret = cpu_exec_setjmp(cpu, &sc);
+        ret = cpu_exec_setjmp(cpu, &sc);
- cpu_exec_exit(cpu);
-    rcu_read_unlock();
+        cpu_exec_exit(cpu);
+    };
return ret;
  }

I've tweaked this to use RCU_READ_LOCK_GUARD instead -- there's little point
in excluding the return from the block, and thus avoid the re-indent -- and queued this one patch to tcg-next.


r~


Reply via email to