Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- 2011-10-18.orig/xen/arch/x86/domain_build.c 2011-10-20 14:46:19.000000000
+0200
+++ 2011-10-18/xen/arch/x86/domain_build.c 2011-10-19 14:50:42.000000000
+0200
@@ -885,10 +885,10 @@ int __init construct_dom0(
printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
- cpu = first_cpu(cpupool0->cpu_valid);
+ cpu = cpumask_first(cpupool0->cpu_valid);
for ( i = 1; i < opt_dom0_max_vcpus; i++ )
{
- cpu = cycle_cpu(cpu, cpupool0->cpu_valid);
+ cpu = cpumask_cycle(cpu, cpupool0->cpu_valid);
(void)alloc_vcpu(d, i, cpu);
}
--- 2011-10-18.orig/xen/arch/x86/smpboot.c 2011-10-18 15:41:44.000000000
+0200
+++ 2011-10-18/xen/arch/x86/smpboot.c 2011-10-19 14:49:30.000000000 +0200
@@ -850,8 +850,8 @@ void __cpu_disable(void)
remove_siblinginfo(cpu);
/* It's now safe to remove this processor from the online map */
- cpu_clear(cpu, cpupool0->cpu_valid);
- cpu_clear(cpu, cpu_online_map);
+ cpumask_clear_cpu(cpu, cpupool0->cpu_valid);
+ cpumask_clear_cpu(cpu, &cpu_online_map);
fixup_irqs();
if ( cpu_disable_scheduler(cpu) )
--- 2011-10-18.orig/xen/common/cpupool.c 2011-10-12 09:02:23.000000000
+0200
+++ 2011-10-18/xen/common/cpupool.c 2011-10-19 14:54:34.000000000 +0200
@@ -39,11 +39,18 @@ DEFINE_PER_CPU(struct cpupool *, cpupool
static struct cpupool *alloc_cpupool_struct(void)
{
- return xzalloc(struct cpupool);
+ struct cpupool *c = xzalloc(struct cpupool);
+
+ if ( c && zalloc_cpumask_var(&c->cpu_valid) )
+ return c;
+ xfree(c);
+ return NULL;
}
static void free_cpupool_struct(struct cpupool *c)
{
+ if ( c )
+ free_cpumask_var(c->cpu_valid);
xfree(c);
}
@@ -191,7 +198,7 @@ static int cpupool_destroy(struct cpupoo
spin_unlock(&cpupool_lock);
return -ENOENT;
}
- if ( (c->n_dom != 0) || cpus_weight(c->cpu_valid) )
+ if ( (c->n_dom != 0) || cpumask_weight(c->cpu_valid) )
{
spin_unlock(&cpupool_lock);
return -EBUSY;
@@ -232,7 +239,7 @@ static int cpupool_assign_cpu_locked(str
cpupool_put(cpupool_cpu_moving);
cpupool_cpu_moving = NULL;
}
- cpu_set(cpu, c->cpu_valid);
+ cpumask_set_cpu(cpu, c->cpu_valid);
return 0;
}
@@ -296,10 +303,10 @@ int cpupool_unassign_cpu(struct cpupool
goto out;
ret = 0;
- if ( !cpu_isset(cpu, c->cpu_valid) && (cpu != cpupool_moving_cpu) )
+ if ( !cpumask_test_cpu(cpu, c->cpu_valid) && (cpu != cpupool_moving_cpu) )
goto out;
- if ( (c->n_dom > 0) && (cpus_weight(c->cpu_valid) == 1) &&
+ if ( (c->n_dom > 0) && (cpumask_weight(c->cpu_valid) == 1) &&
(cpu != cpupool_moving_cpu) )
{
for_each_domain(d)
@@ -326,15 +333,15 @@ int cpupool_unassign_cpu(struct cpupool
cpupool_moving_cpu = cpu;
atomic_inc(&c->refcnt);
cpupool_cpu_moving = c;
- cpu_clear(cpu, c->cpu_valid);
+ cpumask_clear_cpu(cpu, c->cpu_valid);
spin_unlock(&cpupool_lock);
work_cpu = smp_processor_id();
if ( work_cpu == cpu )
{
- work_cpu = first_cpu(cpupool0->cpu_valid);
+ work_cpu = cpumask_first(cpupool0->cpu_valid);
if ( work_cpu == cpu )
- work_cpu = next_cpu(cpu, cpupool0->cpu_valid);
+ work_cpu = cpumask_next(cpu, cpupool0->cpu_valid);
}
return continue_hypercall_on_cpu(work_cpu, cpupool_unassign_cpu_helper, c);
@@ -361,7 +368,7 @@ int cpupool_add_domain(struct domain *d,
return 0;
spin_lock(&cpupool_lock);
c = cpupool_find_by_id(poolid);
- if ( (c != NULL) && cpus_weight(c->cpu_valid) )
+ if ( (c != NULL) && cpumask_weight(c->cpu_valid) )
{
c->n_dom++;
n_dom = c->n_dom;
@@ -418,7 +425,7 @@ static int cpupool_cpu_remove(unsigned i
int ret = 0;
spin_lock(&cpupool_lock);
- if ( !cpu_isset(cpu, cpupool0->cpu_valid))
+ if ( !cpumask_test_cpu(cpu, cpupool0->cpu_valid))
ret = -EBUSY;
else
cpu_set(cpu, cpupool_locked_cpus);
@@ -473,7 +480,7 @@ int cpupool_do_sysctl(struct xen_sysctl_
op->cpupool_id = c->cpupool_id;
op->sched_id = c->sched->sched_id;
op->n_dom = c->n_dom;
- ret = cpumask_to_xenctl_cpumap(&op->cpumap, &c->cpu_valid);
+ ret = cpumask_to_xenctl_cpumap(&op->cpumap, c->cpu_valid);
cpupool_put(c);
}
break;
@@ -516,7 +523,7 @@ int cpupool_do_sysctl(struct xen_sysctl_
break;
cpu = op->cpu;
if ( cpu == XEN_SYSCTL_CPUPOOL_PAR_ANY )
- cpu = last_cpu(c->cpu_valid);
+ cpu = cpumask_last(c->cpu_valid);
ret = (cpu < nr_cpu_ids) ? cpupool_unassign_cpu(c, cpu) : -EINVAL;
cpupool_put(c);
}
@@ -550,7 +557,7 @@ int cpupool_do_sysctl(struct xen_sysctl_
ret = -ENOENT;
spin_lock(&cpupool_lock);
c = cpupool_find_by_id(op->cpupool_id);
- if ( (c != NULL) && cpus_weight(c->cpu_valid) )
+ if ( (c != NULL) && cpumask_weight(c->cpu_valid) )
{
d->cpupool->n_dom--;
ret = sched_move_domain(d, c);
--- 2011-10-18.orig/xen/common/domctl.c 2011-10-18 13:41:58.000000000 +0200
+++ 2011-10-18/xen/common/domctl.c 2011-10-19 14:51:14.000000000 +0200
@@ -502,7 +502,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
goto maxvcpu_out;
ret = -ENOMEM;
- online = (d->cpupool == NULL) ? &cpu_online_map :
&d->cpupool->cpu_valid;
+ online = (d->cpupool == NULL) ? &cpu_online_map :
d->cpupool->cpu_valid;
if ( max > d->max_vcpus )
{
struct vcpu **vcpus;
--- 2011-10-18.orig/xen/common/sched_credit.c 2011-10-14 16:01:03.000000000
+0200
+++ 2011-10-18/xen/common/sched_credit.c 2011-10-19 14:51:53.000000000
+0200
@@ -73,7 +73,7 @@
#define CSCHED_DOM(_dom) ((struct csched_dom *) (_dom)->sched_priv)
#define RUNQ(_cpu) (&(CSCHED_PCPU(_cpu)->runq))
#define CSCHED_CPUONLINE(_pool) \
- (((_pool) == NULL) ? &cpupool_free_cpus : &(_pool)->cpu_valid)
+ (((_pool) == NULL) ? &cpupool_free_cpus : (_pool)->cpu_valid)
/*
--- 2011-10-18.orig/xen/common/sched_credit2.c 2011-10-14 15:46:58.000000000
+0200
+++ 2011-10-18/xen/common/sched_credit2.c 2011-10-19 14:52:06.000000000
+0200
@@ -176,7 +176,7 @@ integer_param("sched_credit2_migrate_res
#define CSCHED_VCPU(_vcpu) ((struct csched_vcpu *) (_vcpu)->sched_priv)
#define CSCHED_DOM(_dom) ((struct csched_dom *) (_dom)->sched_priv)
#define CSCHED_CPUONLINE(_pool) \
- (((_pool) == NULL) ? &cpupool_free_cpus : &(_pool)->cpu_valid)
+ (((_pool) == NULL) ? &cpupool_free_cpus : (_pool)->cpu_valid)
/* CPU to runq_id macro */
#define c2r(_ops, _cpu) (CSCHED_PRIV(_ops)->runq_map[(_cpu)])
/* CPU to runqueue struct macro */
--- 2011-10-18.orig/xen/common/sched_sedf.c 2011-10-07 09:18:14.000000000
+0200
+++ 2011-10-18/xen/common/sched_sedf.c 2011-10-19 14:52:35.000000000 +0200
@@ -22,7 +22,7 @@
} while ( 0 )
#define SEDF_CPUONLINE(_pool) \
- (((_pool) == NULL) ? &cpupool_free_cpus : &(_pool)->cpu_valid)
+ (((_pool) == NULL) ? &cpupool_free_cpus : (_pool)->cpu_valid)
#ifndef NDEBUG
#define SEDF_STATS
--- 2011-10-18.orig/xen/common/schedule.c 2011-10-11 17:56:50.000000000
+0200
+++ 2011-10-18/xen/common/schedule.c 2011-10-19 14:54:07.000000000 +0200
@@ -74,7 +74,7 @@ static struct scheduler __read_mostly op
#define VCPU2OP(_v) (DOM2OP((_v)->domain))
#define VCPU2ONLINE(_v) \
(((_v)->domain->cpupool == NULL) ? &cpu_online_map \
- : &(_v)->domain->cpupool->cpu_valid)
+ : (_v)->domain->cpupool->cpu_valid)
static inline void trace_runstate_change(struct vcpu *v, int new_state)
{
@@ -258,7 +258,7 @@ int sched_move_domain(struct domain *d,
domain_pause(d);
- new_p = first_cpu(c->cpu_valid);
+ new_p = cpumask_first(c->cpu_valid);
for_each_vcpu ( d, v )
{
migrate_timer(&v->periodic_timer, new_p);
@@ -273,7 +273,7 @@ int sched_move_domain(struct domain *d,
v->sched_priv = vcpu_priv[v->vcpu_id];
evtchn_move_pirqs(v);
- new_p = cycle_cpu(new_p, c->cpu_valid);
+ new_p = cpumask_cycle(new_p, c->cpu_valid);
SCHED_OP(VCPU2OP(v), insert_vcpu, v);
}
@@ -431,13 +431,13 @@ static void vcpu_migrate(struct vcpu *v)
if ( pick_called &&
(new_lock == per_cpu(schedule_data, new_cpu).schedule_lock) &&
cpumask_test_cpu(new_cpu, v->cpu_affinity) &&
- cpu_isset(new_cpu, v->domain->cpupool->cpu_valid) )
+ cpumask_test_cpu(new_cpu, v->domain->cpupool->cpu_valid) )
break;
/* Select a new CPU. */
new_cpu = SCHED_OP(VCPU2OP(v), pick_cpu, v);
if ( (new_lock == per_cpu(schedule_data, new_cpu).schedule_lock) &&
- cpu_isset(new_cpu, v->domain->cpupool->cpu_valid) )
+ cpumask_test_cpu(new_cpu, v->domain->cpupool->cpu_valid) )
break;
pick_called = 1;
}
@@ -549,7 +549,7 @@ int cpu_disable_scheduler(unsigned int c
{
vcpu_schedule_lock_irq(v);
- cpumask_and(&online_affinity, v->cpu_affinity, &c->cpu_valid);
+ cpumask_and(&online_affinity, v->cpu_affinity, c->cpu_valid);
if ( cpus_empty(online_affinity) &&
cpumask_test_cpu(cpu, v->cpu_affinity) )
{
@@ -1446,7 +1446,7 @@ void schedule_dump(struct cpupool *c)
cpumask_t *cpus;
sched = (c == NULL) ? &ops : c->sched;
- cpus = (c == NULL) ? &cpupool_free_cpus : &c->cpu_valid;
+ cpus = (c == NULL) ? &cpupool_free_cpus : c->cpu_valid;
printk("Scheduler: %s (%s)\n", sched->name, sched->opt_name);
SCHED_OP(sched, dump_settings);
--- 2011-10-18.orig/xen/include/xen/sched-if.h 2011-10-20 14:46:19.000000000
+0200
+++ 2011-10-18/xen/include/xen/sched-if.h 2011-10-19 14:44:34.000000000
+0200
@@ -192,7 +192,7 @@ extern const struct scheduler sched_arin
struct cpupool
{
int cpupool_id;
- cpumask_t cpu_valid; /* all cpus assigned to pool */
+ cpumask_var_t cpu_valid; /* all cpus assigned to pool */
struct cpupool *next;
unsigned int n_dom;
struct scheduler *sched;
--- 2011-10-18.orig/xen/include/xen/sched.h 2011-10-20 14:46:20.000000000
+0200
+++ 2011-10-18/xen/include/xen/sched.h 2011-10-20 14:47:57.000000000 +0200
@@ -664,7 +664,7 @@ int cpupool_do_sysctl(struct xen_sysctl_
void schedule_dump(struct cpupool *c);
extern void dump_runq(unsigned char key);
-#define num_cpupool_cpus(c) (cpus_weight((c)->cpu_valid))
+#define num_cpupool_cpus(c) cpumask_weight((c)->cpu_valid)
#endif /* __SCHED_H__ */
cpupool-cpu-valid-alloc.patch
Description: Text document
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|