[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 13/19] 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@xxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- v1 -> v2: - no need to wrap declarations - add transient #ifdef in sysctl.c for correct compilation --- xen/common/sched/arinc653.c | 6 ++++++ xen/common/sched/core.c | 2 ++ xen/common/sched/credit.c | 4 ++++ xen/common/sched/credit2.c | 4 ++++ xen/common/sched/private.h | 4 ++++ xen/common/sysctl.c | 2 +- xen/include/xsm/xsm.h | 4 ++++ xen/xsm/dummy.c | 2 ++ xen/xsm/flask/hooks.c | 4 ++++ 9 files changed, 31 insertions(+), 1 deletion(-) diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c index 432ccfe662..3c014c9934 100644 --- a/xen/common/sched/arinc653.c +++ b/xen/common/sched/arinc653.c @@ -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, diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 13fdf57e57..ea95dea65a 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -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) { diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index a6bb321e7d..6dcf6b2c8b 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -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, diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 0a83f23725..0b3b61df57 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -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, diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h index c0e7c96d24..d6884550cd 100644 --- a/xen/common/sched/private.h +++ b/xen/common/sched/private.h @@ -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) diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 0292233c7e..ccce7fe963 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -254,11 +254,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) ret = cpupool_do_sysctl(&op->u.cpupool_op); break; -#endif /* CONFIG_SYSCTL */ case XEN_SYSCTL_scheduler_op: ret = sched_adjust_global(&op->u.scheduler_op); break; +#endif /* CONFIG_SYSCTL */ case XEN_SYSCTL_physinfo: { struct xen_sysctl_physinfo *pi = &op->u.physinfo; diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 5ac99904c4..6e1789c314 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -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) diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index d46413ad8c..8d44f5bfb6 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -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 diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 39f8331207..64c9531346 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -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 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 -- 2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |