mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/sysctl: wrap around XEN_SYSCTL_scheduler_op
Function sched_adjust_global is designed for XEN_SYSCTL_scheduler_op, so itself and its calling flow, like .adjust_global, shall all be wrapped. Signed-off-by: Penny Zheng <Penny.Zheng@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Acked-by: Stewart Hildebrand <stewart@stew.dk> #a653 Reviewed-by: Juergen Gross <jgross@suse.com> Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
This commit is contained in:
1 parent
9ca99150a1
commit
4493d39e68
8 files changed
+30
No files matched your search
@@ -220,6 +220,7 @@ static void update_schedule_units(const struct scheduler *ops)
|
||||
SCHED_PRIV(ops)->schedule[i].unit_id);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
/**
|
||||
* This function is called by the adjust_global scheduler hook to put
|
||||
* in place a new ARINC653 schedule.
|
||||
@@ -334,6 +335,7 @@ arinc653_sched_get(
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
/**************************************************************************
|
||||
* Scheduler callback functions *
|
||||
@@ -653,6 +655,7 @@ a653_switch_sched(struct scheduler *new_ops, unsigned int cpu,
|
||||
return &sr->_lock;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
/**
|
||||
* Xen scheduler callback function to perform a global (not domain-specific)
|
||||
* adjustment. It is used by the ARINC 653 scheduler to put in place a new
|
||||
@@ -692,6 +695,7 @@ a653sched_adjust_global(const struct scheduler *ops,
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
/**
|
||||
* This structure defines our scheduler for Xen.
|
||||
@@ -726,7 +730,9 @@ static const struct scheduler sched_arinc653_def = {
|
||||
.switch_sched = a653_switch_sched,
|
||||
|
||||
.adjust = NULL,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.adjust_global = a653sched_adjust_global,
|
||||
#endif
|
||||
|
||||
.dump_settings = NULL,
|
||||
.dump_cpu_state = NULL,
|
||||
|
||||
@@ -2112,6 +2112,7 @@ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
long sched_adjust_global(struct xen_sysctl_scheduler_op *op)
|
||||
{
|
||||
struct cpupool *pool;
|
||||
@@ -2140,6 +2141,7 @@ long sched_adjust_global(struct xen_sysctl_scheduler_op *op)
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
static void vcpu_periodic_timer_work_locked(struct vcpu *v)
|
||||
{
|
||||
|
||||
@@ -1256,6 +1256,7 @@ __csched_set_tslice(struct csched_private *prv, unsigned int timeslice_ms)
|
||||
prv->credit = prv->credits_per_tslice * prv->ncpus;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static int cf_check
|
||||
csched_sys_cntl(const struct scheduler *ops,
|
||||
struct xen_sysctl_scheduler_op *sc)
|
||||
@@ -1298,6 +1299,7 @@ csched_sys_cntl(const struct scheduler *ops,
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
static void *cf_check
|
||||
csched_alloc_domdata(const struct scheduler *ops, struct domain *dom)
|
||||
@@ -2288,7 +2290,9 @@ static const struct scheduler sched_credit_def = {
|
||||
|
||||
.adjust = csched_dom_cntl,
|
||||
.adjust_affinity= csched_aff_cntl,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.adjust_global = csched_sys_cntl,
|
||||
#endif
|
||||
|
||||
.pick_resource = csched_res_pick,
|
||||
.do_schedule = csched_schedule,
|
||||
|
||||
@@ -3131,6 +3131,7 @@ csched2_aff_cntl(const struct scheduler *ops, struct sched_unit *unit,
|
||||
__clear_bit(__CSFLAG_pinned, &svc->flags);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static int cf_check csched2_sys_cntl(
|
||||
const struct scheduler *ops, struct xen_sysctl_scheduler_op *sc)
|
||||
{
|
||||
@@ -3162,6 +3163,7 @@ static int cf_check csched2_sys_cntl(
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
static void *cf_check
|
||||
csched2_alloc_domdata(const struct scheduler *ops, struct domain *dom)
|
||||
@@ -4232,7 +4234,9 @@ static const struct scheduler sched_credit2_def = {
|
||||
|
||||
.adjust = csched2_dom_cntl,
|
||||
.adjust_affinity= csched2_aff_cntl,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.adjust_global = csched2_sys_cntl,
|
||||
#endif
|
||||
|
||||
.pick_resource = csched2_res_pick,
|
||||
.migrate = csched2_unit_migrate,
|
||||
|
||||
@@ -356,8 +356,10 @@ struct scheduler {
|
||||
struct sched_unit *unit,
|
||||
const struct cpumask *hard,
|
||||
const struct cpumask *soft);
|
||||
#ifdef CONFIG_SYSCTL
|
||||
int (*adjust_global) (const struct scheduler *ops,
|
||||
struct xen_sysctl_scheduler_op *sc);
|
||||
#endif
|
||||
void (*dump_settings) (const struct scheduler *ops);
|
||||
void (*dump_cpu_state) (const struct scheduler *ops, int cpu);
|
||||
void (*move_timers) (const struct scheduler *ops,
|
||||
@@ -510,11 +512,13 @@ static inline int sched_adjust_dom(const struct scheduler *s, struct domain *d,
|
||||
return s->adjust ? s->adjust(s, d, op) : 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static inline int sched_adjust_cpupool(const struct scheduler *s,
|
||||
struct xen_sysctl_scheduler_op *op)
|
||||
{
|
||||
return s->adjust_global ? s->adjust_global(s, op) : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void sched_move_timers(const struct scheduler *s,
|
||||
struct sched_resource *sr)
|
||||
|
||||
@@ -57,7 +57,9 @@ struct xsm_ops {
|
||||
int (*domain_create)(struct domain *d, uint32_t ssidref);
|
||||
int (*getdomaininfo)(struct domain *d);
|
||||
int (*domctl_scheduler_op)(struct domain *d, int op);
|
||||
#ifdef CONFIG_SYSCTL
|
||||
int (*sysctl_scheduler_op)(int op);
|
||||
#endif
|
||||
int (*set_target)(struct domain *d, struct domain *e);
|
||||
int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
|
||||
int (*sysctl)(int cmd);
|
||||
@@ -244,10 +246,12 @@ static inline int xsm_domctl_scheduler_op(
|
||||
return alternative_call(xsm_ops.domctl_scheduler_op, d, cmd);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static inline int xsm_sysctl_scheduler_op(xsm_default_t def, int cmd)
|
||||
{
|
||||
return alternative_call(xsm_ops.sysctl_scheduler_op, cmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int xsm_set_target(
|
||||
xsm_default_t def, struct domain *d, struct domain *e)
|
||||
|
||||
@@ -19,7 +19,9 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
|
||||
.domain_create = xsm_domain_create,
|
||||
.getdomaininfo = xsm_getdomaininfo,
|
||||
.domctl_scheduler_op = xsm_domctl_scheduler_op,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.sysctl_scheduler_op = xsm_sysctl_scheduler_op,
|
||||
#endif
|
||||
.set_target = xsm_set_target,
|
||||
.domctl = xsm_domctl,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
|
||||
@@ -626,6 +626,7 @@ static int cf_check flask_domctl_scheduler_op(struct domain *d, int op)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static int cf_check flask_sysctl_scheduler_op(int op)
|
||||
{
|
||||
switch ( op )
|
||||
@@ -640,6 +641,7 @@ static int cf_check flask_sysctl_scheduler_op(int op)
|
||||
return avc_unknown_permission("sysctl_scheduler_op", op);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
static int cf_check flask_set_target(struct domain *d, struct domain *t)
|
||||
{
|
||||
@@ -1887,7 +1889,9 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
|
||||
.domain_create = flask_domain_create,
|
||||
.getdomaininfo = flask_getdomaininfo,
|
||||
.domctl_scheduler_op = flask_domctl_scheduler_op,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.sysctl_scheduler_op = flask_sysctl_scheduler_op,
|
||||
#endif
|
||||
.set_target = flask_set_target,
|
||||
.domctl = flask_domctl,
|
||||
#ifdef CONFIG_SYSCTL
|
||||
|
||||