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

[Xen-devel] [PATCH 3/4] Update vcpu hotplug logic



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Add vcpu online/offline check to avoid redundant SCI interrupt.

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>

Port from qemu-xen-traditionnal to qemu-xen.
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 hw/acpi_piix4.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index bc7b454..49c38d3 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -706,16 +706,24 @@ static int piix4_device_hotplug(DeviceState *qdev, 
PCIDevice *dev,
     return 0;
 }
 
-static void enable_processor(PIIX4PMState *g, int cpu)
+static int enable_processor(PIIX4PMState *g, int cpu)
 {
+    if (g->cpus_sts[cpu/8] & (1 << (cpu%8)))
+        return 0;
+
     g->ar.gpe.sts[0] |= 4;
     g->cpus_sts[cpu/8] |= (1 << (cpu%8));
+    return 1;
 }
 
-static void disable_processor(PIIX4PMState *g, int cpu)
+static int disable_processor(PIIX4PMState *g, int cpu)
 {
+    if (!(g->cpus_sts[cpu/8] & (1 << (cpu%8))))
+        return 0;
+
     g->ar.gpe.sts[0] |= 4;
     g->cpus_sts[cpu/8] &= ~(1 << (cpu%8));
+    return 1;
 }
 
 void qemu_cpu_add_remove(int cpu, int state)
@@ -725,10 +733,15 @@ void qemu_cpu_add_remove(int cpu, int state)
         return;
     }
 
-    if (state)
-        enable_processor(acpi_state, cpu);
-    else
-        disable_processor(acpi_state, cpu);
+    if (state) {
+        if (!enable_processor(acpi_state, cpu)) {
+            return;
+        }
+    } else {
+        if (!disable_processor(acpi_state, cpu)) {
+            return;
+        }
+    }
 
     pm_update_sci(acpi_state);
 }
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.