On 10/7/25 16:33, Peter Maydell wrote:
On Fri, 4 Jul 2025 at 14:25, Philippe Mathieu-Daudé <phi...@linaro.org> wrote:

Although unreachable, still unregister the RCU before exiting
the thread, as documented in "qemu/rcu.h":

  /*
   * Important !
   *
   * Each thread containing read-side critical sections must be registered
   * with rcu_register_thread() before calling rcu_read_lock().
   * rcu_unregister_thread() should be called before the thread exits.
   */

Unregister the RCU to be on par with what is done for other
accelerators.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Acked-by: Richard Henderson <richard.hender...@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
Reviewed-by: Zhao Liu <zhao1....@intel.com>
Message-Id: <20250702185332.43650-66-phi...@linaro.org>
---
  accel/tcg/tcg-accel-ops-rr.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index 6eec5c9eee9..a578698d071 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -302,6 +302,8 @@ static void *rr_cpu_thread_fn(void *arg)
          rr_deal_with_unplugged_cpus();
      }

+    rcu_unregister_thread();
+
      g_assert_not_reached();
  }

This has reintroduced CID 1547782 (unreachable code).

We can't get to this point, so why are we trying to call a
function here ? This is not a place where the thread can exit.

The goal is to unify accelerators vcpu thread logic and
eventually remove AccelOpsClass::create_vcpu_thread(), superseded
by AccelOpsClass::cpu_thread_routine(). I couldn't finish RR for
10.1 but squeezed this patch in. Let's revert it, and I'll
re-commit it later.

Reply via email to