Add comment explaining why while_ctx2 restarts from the last processed CPU.

Signed-off-by: Igor Mammedov <imamm...@redhat.com>
Reviewed-by: Laszlo Ersek <ler...@redhat.com>
Tested-by: Laszlo Ersek <ler...@redhat.com>
---
 hw/acpi/cpu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 1283972001..8dd4d8ebbf 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -601,6 +601,15 @@ void build_cpus_aml(Aml *table, MachineState *machine, 
CPUHotplugFeatures opts,
                     aml_append(while_ctx, aml_increment(cpu_idx));
                 }
                 aml_append(while_ctx2, while_ctx);
+                /*
+                 * If another batch is needed, then it will resume scanning
+                 * exactly at -- and not after -- the last CPU that's currently
+                 * in CPU_ADDED_LIST. In other words, the last CPU in
+                 * CPU_ADDED_LIST is going to be re-checked. That's OK: we've
+                 * just cleared the insert event for *all* CPUs in
+                 * CPU_ADDED_LIST, including the last one. So the scan will
+                 * simply seek past it.
+                 */
             }
             aml_append(method, while_ctx2);
             aml_append(method, aml_release(ctrl_lock));
-- 
2.27.0


Reply via email to