qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-9.2] accel/tcg: Remove dead code from rr_cpu_thread_fn()
@ 2024-08-15 14:36 Peter Maydell
  2024-08-15 22:13 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2024-08-15 14:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Richard Henderson

The main loop in rr_cpu_thread_fn() can never terminate, so the
code at the end of the function to clean up the RCU subsystem is
dead code. Replace it with g_assert_not_reached().

(This is different from the other cpu_thread_fn for e.g. MTTCG or
for the KVM accelerator -- those can exit, if the vCPU they
are responsible for is unplugged. But the RR cpu thread fn
handles all CPUs in the system in a round-robin way, so even
if one is unplugged it keeps looping.)

Resolves: Coverity CID 1547782
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 accel/tcg/tcg-accel-ops-rr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index 48c38714bd6..38ab16244e3 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -302,9 +302,7 @@ static void *rr_cpu_thread_fn(void *arg)
         rr_deal_with_unplugged_cpus();
     }
 
-    rcu_remove_force_rcu_notifier(&force_rcu);
-    rcu_unregister_thread();
-    return NULL;
+    g_assert_not_reached();
 }
 
 void rr_start_vcpu_thread(CPUState *cpu)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for-9.2] accel/tcg: Remove dead code from rr_cpu_thread_fn()
  2024-08-15 14:36 [PATCH for-9.2] accel/tcg: Remove dead code from rr_cpu_thread_fn() Peter Maydell
@ 2024-08-15 22:13 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2024-08-15 22:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Paolo Bonzini

On 8/16/24 00:36, Peter Maydell wrote:
> The main loop in rr_cpu_thread_fn() can never terminate, so the
> code at the end of the function to clean up the RCU subsystem is
> dead code. Replace it with g_assert_not_reached().
> 
> (This is different from the other cpu_thread_fn for e.g. MTTCG or
> for the KVM accelerator -- those can exit, if the vCPU they
> are responsible for is unplugged. But the RR cpu thread fn
> handles all CPUs in the system in a round-robin way, so even
> if one is unplugged it keeps looping.)
> 
> Resolves: Coverity CID 1547782
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   accel/tcg/tcg-accel-ops-rr.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
> index 48c38714bd6..38ab16244e3 100644
> --- a/accel/tcg/tcg-accel-ops-rr.c
> +++ b/accel/tcg/tcg-accel-ops-rr.c
> @@ -302,9 +302,7 @@ static void *rr_cpu_thread_fn(void *arg)
>           rr_deal_with_unplugged_cpus();
>       }
>   
> -    rcu_remove_force_rcu_notifier(&force_rcu);
> -    rcu_unregister_thread();
> -    return NULL;
> +    g_assert_not_reached();
>   }
>   
>   void rr_start_vcpu_thread(CPUState *cpu)

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


r~


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-15 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 14:36 [PATCH for-9.2] accel/tcg: Remove dead code from rr_cpu_thread_fn() Peter Maydell
2024-08-15 22:13 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).