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

[Xen-changelog] [qemu-xen-unstable] Update vcpu hotplug logic



commit 376c64a4e068b3dc83f066b4050ed34d983a5c75
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Fri Apr 30 17:41:18 2010 +0100

    Update vcpu hotplug logic
    
    Add vcpu online/offline check to avoid redundant SCI interrupt.
    
    Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---
 hw/piix4acpi.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/hw/piix4acpi.c b/hw/piix4acpi.c
index fb905d1..3c52c4b 100644
--- a/hw/piix4acpi.c
+++ b/hw/piix4acpi.c
@@ -727,16 +727,24 @@ void i440fx_init_memory_mappings(PCIDevice *d) {
     /* our implementation doesn't need this */
 }
 
-static void enable_processor(GPEState *g, int cpu)
+static int enable_processor(GPEState *g, int cpu)
 {
+    if (g->cpus_sts[cpu/8] & (1 << (cpu%8)))
+        return 0;
+
     g->gpe0_sts[0] |= 4;
     g->cpus_sts[cpu/8] |= (1 << (cpu%8));
+    return 1;
 }
 
-static void disable_processor(GPEState *g, int cpu)
+static int disable_processor(GPEState *g, int cpu)
 {
+    if (!(g->cpus_sts[cpu/8] & (1 << (cpu%8))))
+        return 0;
+
     g->gpe0_sts[0] |= 4;
     g->cpus_sts[cpu/8] &= ~(1 << (cpu%8));
+    return 1;
 }
 
 void qemu_cpu_add_remove(int cpu, int state)
@@ -746,10 +754,13 @@ void qemu_cpu_add_remove(int cpu, int state)
         return;
     }
 
-    if (state)
-        enable_processor(&gpe_state, cpu);
-    else
-        disable_processor(&gpe_state, cpu);
+    if (state) {
+        if (!enable_processor(&gpe_state, cpu))
+            return;
+    } else {
+        if (!disable_processor(&gpe_state, cpu))
+            return;
+    }
 
     if (gpe_state.gpe0_en[0] & 4) {
         qemu_set_irq(sci_irq, 1);
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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