File cpupools-core-fixup.patch of Package xen

- fix tasklet_schedule_cpu() when invoked from the tasklet's handler
  (and rename to tasklet_schedule_on_cpu() to match upstream)
- properly balance (un-)pausing in continue_hypercall_on_cpu() code
  paths
- bump domctl interface version (due to the addition of the "cpupool"
  member to struct xen_domctl_getdomaininfo)
- move and rename csched_priv to make sure eventual backported
  upstream patches using the variable get correctly adjusted (i.e.
  missing adjustments get detected at build time)
- remove boot time per-CPU pool assignment messages (bnc#572146)

Index: xen-4.0.2-testing/xen/arch/x86/domain.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/domain.c
+++ xen-4.0.2-testing/xen/arch/x86/domain.c
@@ -1585,6 +1585,7 @@ int continue_hypercall_on_cpu(int cpu, v
 
         v->arch.schedule_tail = continue_hypercall_on_cpu_helper;
         v->arch.continue_info = info;
+        vcpu_pause_nosync(v);
     }
     else
     {
@@ -1595,8 +1596,7 @@ int continue_hypercall_on_cpu(int cpu, v
     info->func = func;
     info->data = data;
 
-    vcpu_pause_nosync(v);
-    tasklet_schedule_cpu(&info->tasklet, cpu);
+    tasklet_schedule_on_cpu(&info->tasklet, cpu);
     raise_softirq(SCHEDULE_SOFTIRQ);
 
     /* Dummy return value will be overwritten by new schedule_tail. */
Index: xen-4.0.2-testing/xen/common/sched_credit.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/sched_credit.c
+++ xen-4.0.2-testing/xen/common/sched_credit.c
@@ -176,7 +176,6 @@ struct csched_private {
 /*
  * Global variables
  */
-static struct csched_private csched_priv;
 static struct csched_private *csched_priv0 = NULL;
 
 static void csched_tick(void *_cpu);
@@ -1527,11 +1526,13 @@ static void csched_tick_resume(struct sc
     }
 }
 
+static struct csched_private _csched_priv;
+
 struct scheduler sched_credit_def = {
     .name           = "SMP Credit Scheduler",
     .opt_name       = "credit",
     .sched_id       = XEN_SCHEDULER_CREDIT,
-    .sched_data     = &csched_priv,
+    .sched_data     = &_csched_priv,
 
     .init_domain    = csched_dom_init,
     .destroy_domain = csched_dom_destroy,
Index: xen-4.0.2-testing/xen/common/softirq.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/softirq.c
+++ xen-4.0.2-testing/xen/common/softirq.c
@@ -114,12 +114,15 @@ static void tasklet_schedule_list(struct
         {
             BUG_ON(!list_empty(&t->list));
             list_add_tail(&t->list, tlist);
+            t->scheduled_on = NR_CPUS;
         }
         t->is_scheduled = 1;
         if ( cpu == smp_processor_id() )
             raise_softirq(TASKLET_SOFTIRQ);
-        else
+        else if ( !t->is_running )
             cpu_raise_softirq(cpu, TASKLET_SOFTIRQ);
+        else
+            t->scheduled_on = cpu;
     }
 
     spin_unlock_irqrestore(&tasklet_lock, flags);
@@ -130,7 +133,7 @@ void tasklet_schedule(struct tasklet *t)
     tasklet_schedule_list(t, &tasklet_list, smp_processor_id());
 }
 
-void tasklet_schedule_cpu(struct tasklet *t, int cpu)
+void tasklet_schedule_on_cpu(struct tasklet *t, int cpu)
 {
     tasklet_schedule_list(t, &per_cpu(tasklet_list_pcpu, cpu), cpu);
 }
@@ -166,7 +169,15 @@ static void tasklet_action(void)
     if ( t->is_scheduled )
     {
         BUG_ON(t->is_dead || !list_empty(&t->list));
-        list_add_tail(&t->list, tlist);
+        if ( t->scheduled_on >= NR_CPUS )
+            list_add_tail(&t->list, tlist);
+        else
+        {
+            unsigned int cpu = t->scheduled_on;
+
+            list_add_tail(&t->list, &per_cpu(tasklet_list_pcpu, cpu));
+            cpu_raise_softirq(cpu, TASKLET_SOFTIRQ);
+        }
     }
 
     /*
Index: xen-4.0.2-testing/xen/include/public/domctl.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/public/domctl.h
+++ xen-4.0.2-testing/xen/include/public/domctl.h
@@ -35,7 +35,7 @@
 #include "xen.h"
 #include "grant_table.h"
 
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000006
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007
 
 struct xenctl_cpumap {
     XEN_GUEST_HANDLE_64(uint8) bitmap;
Index: xen-4.0.2-testing/xen/include/xen/softirq.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/softirq.h
+++ xen-4.0.2-testing/xen/include/xen/softirq.h
@@ -52,15 +52,17 @@ struct tasklet
     bool_t is_scheduled;
     bool_t is_running;
     bool_t is_dead;
+    unsigned int scheduled_on;
     void (*func)(unsigned long);
     unsigned long data;
 };
 
 #define DECLARE_TASKLET(name, func, data) \
-    struct tasklet name = { LIST_HEAD_INIT(name.list), 0, 0, 0, func, data }
+    struct tasklet name = { LIST_HEAD_INIT(name.list), 0, 0, 0, NR_CPUS, \
+                            func, data }
 
 void tasklet_schedule(struct tasklet *t);
-void tasklet_schedule_cpu(struct tasklet *t, int cpu);
+void tasklet_schedule_on_cpu(struct tasklet *t, int cpu);
 void tasklet_kill(struct tasklet *t);
 void tasklet_init(
     struct tasklet *t, void (*func)(unsigned long), unsigned long data);
openSUSE Build Service is sponsored by