Fix two issues for CPU online/offline.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 8 Apr 2010 14:31:52 +0000 (15:31 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 8 Apr 2010 14:31:52 +0000 (15:31 +0100)
Firstly, we should return if we fail to get spin lock in cpu_down.
Secondly, in credit scheduler, the idlers need be limited only to
online map.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
xen/arch/x86/smpboot.c
xen/common/sched_credit.c

index 96db89fc54ee3a0ca392179bd3869da548d1901c..00c430023187158e22b18f2c3804189a5163408d 100644 (file)
@@ -1343,10 +1343,8 @@ int cpu_down(unsigned int cpu)
        int err = 0;
 
        /* spin_trylock() avoids deadlock with stop_machine_run(). */
-       if (!spin_trylock(&cpu_add_remove_lock)) {
-               err = -EBUSY;
-               goto out;
-       }
+       if (!spin_trylock(&cpu_add_remove_lock))
+               return -EBUSY;
 
        if (num_online_cpus() == 1) {
                err = -EBUSY;
index 11d26421e0e7c58292bdabcfd54e01ba8c3204a1..e09e03da683389bc0c8560068d03014de548edfb 100644 (file)
@@ -428,7 +428,7 @@ _csched_cpu_pick(struct vcpu *vc, bool_t commit)
      * like run two VCPUs on co-hyperthreads while there are idle cores
      * or sockets.
      */
-    idlers = csched_priv.idlers;
+    cpus_and(idlers, cpu_online_map, csched_priv.idlers);
     cpu_set(cpu, idlers);
     cpus_and(cpus, cpus, idlers);
     cpu_clear(cpu, cpus);