Message ID | 20220215101551.23101-3-luca.fancellu@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Boot time cpupools | expand |
On 15.02.22 11:15, Luca Fancellu wrote: > Create new public function to create cpupools, it checks for pool id > uniqueness before creating the pool and can take a scheduler id or > a negative value that means the default Xen scheduler will be used. > > Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Juergen Gross <jgross@suse.com> with one further question: you are allowing to use another scheduler, but what if someone wants to set non-standard scheduling parameters (e.g. another time slice)? Juergen
> On 15 Feb 2022, at 10:38, Juergen Gross <jgross@suse.com> wrote: > > On 15.02.22 11:15, Luca Fancellu wrote: >> Create new public function to create cpupools, it checks for pool id >> uniqueness before creating the pool and can take a scheduler id or >> a negative value that means the default Xen scheduler will be used. >> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> > > Reviewed-by: Juergen Gross <jgross@suse.com> > > with one further question: you are allowing to use another scheduler, > but what if someone wants to set non-standard scheduling parameters > (e.g. another time slice)? I guess for now parameters can be tuned only by xl tool, however it would be possible as future work to allow parameters in the device tree for each scheduler. Cheers, Luca > > > Juergen > <OpenPGP_0xB0DE9DD628BF132F.asc>
On 15.02.22 18:50, Luca Fancellu wrote: > > >> On 15 Feb 2022, at 10:38, Juergen Gross <jgross@suse.com> wrote: >> >> On 15.02.22 11:15, Luca Fancellu wrote: >>> Create new public function to create cpupools, it checks for pool id >>> uniqueness before creating the pool and can take a scheduler id or >>> a negative value that means the default Xen scheduler will be used. >>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> >> >> Reviewed-by: Juergen Gross <jgross@suse.com> >> >> with one further question: you are allowing to use another scheduler, >> but what if someone wants to set non-standard scheduling parameters >> (e.g. another time slice)? > > I guess for now parameters can be tuned only by xl tool, however it would > be possible as future work to allow parameters in the device tree for each > scheduler. That is basically my concern here: A true dom0less setup won't have the possibility to use xl... I don't mind this series not supporting that scheme, but the chosen syntax for the device tree should support that extension (I have not looked into that, as I have no detailed knowledge about that topic). Juergen
diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index 8c6e6eb9ccd5..4da12528d6b9 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -1218,6 +1218,32 @@ static void cpupool_hypfs_init(void) #endif /* CONFIG_HYPFS */ +struct cpupool *__init cpupool_create_pool(unsigned int pool_id, int sched_id) +{ + struct cpupool *pool; + + ASSERT(!spin_is_locked(&cpupool_lock)); + + spin_lock(&cpupool_lock); + /* Check if a cpupool with pool_id exists */ + pool = __cpupool_find_by_id(pool_id, true); + spin_unlock(&cpupool_lock); + + /* Pool exists, return an error */ + if ( pool ) + return NULL; + + if ( sched_id < 0 ) + sched_id = scheduler_get_default()->sched_id; + + pool = cpupool_create(pool_id, sched_id); + + BUG_ON(IS_ERR(pool)); + cpupool_put(pool); + + return pool; +} + static int __init cpupool_init(void) { unsigned int cpu; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 37f78cc4c4c9..a50df1bccdc0 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1145,6 +1145,23 @@ int cpupool_move_domain(struct domain *d, struct cpupool *c); int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op); unsigned int cpupool_get_id(const struct domain *d); const cpumask_t *cpupool_valid_cpus(const struct cpupool *pool); + +/* + * cpupool_create_pool - Creates a cpupool + * @pool_id: id of the pool to be created + * @sched_id: id of the scheduler to be used for the pool + * + * Creates a cpupool with pool_id id, the id must be unique and the function + * will return an error if the pool id exists. + * The sched_id parameter identifies the scheduler to be used, if it is + * negative, the default scheduler of Xen will be used. + * + * returns: + * pointer to the struct cpupool just created, on success + * NULL, on cpupool creation error + */ +struct cpupool *cpupool_create_pool(unsigned int pool_id, int sched_id); + extern void dump_runq(unsigned char key); void arch_do_physinfo(struct xen_sysctl_physinfo *pi);
Create new public function to create cpupools, it checks for pool id uniqueness before creating the pool and can take a scheduler id or a negative value that means the default Xen scheduler will be used. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> --- xen/common/sched/cpupool.c | 26 ++++++++++++++++++++++++++ xen/include/xen/sched.h | 17 +++++++++++++++++ 2 files changed, 43 insertions(+)