qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 7/9] cpus: Only expose REALIZED vCPUs to global &cpus_que


From: Richard Henderson
Subject: Re: [RFC PATCH 7/9] cpus: Only expose REALIZED vCPUs to global &cpus_queue
Date: Tue, 28 Jan 2025 12:53:51 -0800
User-agent: Mozilla Thunderbird

On 1/28/25 06:21, Philippe Mathieu-Daudé wrote:
cpu_list_add() was doing 2 distinct things:
- assign some index to vCPU
- add unrealized (thus in inconsistent state) vcpu to &cpus_queue

Code using CPU_FOREACH() macro would iterate over possibly
unrealized vCPUs, often dealt with special casing.

In order to avoid that, we move the addition of vCPU to global queue
to the DeviceWire handler, which is called just before switching the
vCPU to REALIZED state. This ensure all &cpus_queue users (like via
&first_cpu or CPU_FOREACH) get a realized vCPU in consistent state.

Similarly we remove it from the global queue at DeviceUnwire phase,
just after marking the vCPU UNREALIZED.

Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
---
  cpu-common.c         | 2 --
  hw/core/cpu-common.c | 5 +++++
  2 files changed, 5 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]