]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
sched: fix a potential issue with core scheduling
authorJuergen Gross <jgross@suse.com>
Tue, 12 Nov 2019 10:09:11 +0000 (11:09 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Nov 2019 10:09:11 +0000 (11:09 +0100)
cpupool_online_cpumask() is used by credit and rt scheduler. It returns
all the cpus of a cpupool or all online cpus in case no cpupool is
specified.

The "no cpupool" case can be dropped, as no scheduler other than the
init scheduler will ever work on cpus not associated with any cpupool.

As the individual schedulers should only ever work on scheduling
resources instead of individual cpus, their cpupool_online_cpumask()
use should be replaced by cpupool->res_valid.

Note that only with core scheduling active this might result in
potential problems, as with cpu scheduling both masks are identical.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/common/sched_credit.c
xen/common/sched_rt.c
xen/include/xen/sched-if.h

index fbffcf39965866111f0a3df0bfb9daa0b50a2029..645cdc5e9ab5f31745bae5dab96e46533fcb4883 100644 (file)
@@ -1684,12 +1684,11 @@ csched_load_balance(struct csched_private *prv, int cpu,
     struct cpupool *c = get_sched_res(cpu)->cpupool;
     struct csched_unit *speer;
     cpumask_t workers;
-    cpumask_t *online;
+    cpumask_t *online = c->res_valid;
     int peer_cpu, first_cpu, peer_node, bstep;
     int node = cpu_to_node(cpu);
 
     BUG_ON(get_sched_res(cpu) != snext->unit->res);
-    online = cpupool_online_cpumask(c);
 
     /*
      * If this CPU is going offline, or is not (yet) part of any cpupool
index 6e93e50acbac608b30fc1a341deeaf18311200de..b2b29481f3645e5dbf79ce9c6a33138a5578948b 100644 (file)
@@ -774,8 +774,8 @@ rt_deinit_pdata(const struct scheduler *ops, void *pcpu, int cpu)
 
     if ( prv->repl_timer.cpu == cpu )
     {
-        struct cpupool *c = get_sched_res(cpu)->cpupool;
-        unsigned int new_cpu = cpumask_cycle(cpu, cpupool_online_cpumask(c));
+        cpumask_t *online = get_sched_res(cpu)->cpupool->res_valid;
+        unsigned int new_cpu = cpumask_cycle(cpu, online);
 
         /*
          * Make sure the timer run on one of the cpus that are still available
index 29715652bcce1c9b7fe740c49fd0f5a500e5582a..b0ac54e63de7ded061b7f9216dfb5184e8457274 100644 (file)
@@ -545,9 +545,6 @@ struct cpupool
     enum sched_gran  gran;
 };
 
-#define cpupool_online_cpumask(_pool) \
-    (((_pool) == NULL) ? &cpu_online_map : (_pool)->cpu_valid)
-
 static inline cpumask_t *cpupool_domain_master_cpumask(const struct domain *d)
 {
     /*