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

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

 



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@xxxxxxxxxx>
---
  cpu-common.c         | 2 --
  hw/core/cpu-common.c | 5 +++++
  2 files changed, 5 insertions(+), 2 deletions(-)

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

r~




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux