From: Penny Zheng <Penny.Zheng@amd.com>
To: <xen-devel@lists.xenproject.org>, <xen-devel@dornerworks.com>
Cc: <ray.huang@amd.com>, Penny Zheng <Penny.Zheng@amd.com>,
Nathan Studer <nathan.studer@dornerworks.com>,
Stewart Hildebrand <stewart@stew.dk>,
"Dario Faggioli" <dfaggioli@suse.com>,
Juergen Gross <jgross@suse.com>,
George Dunlap <gwd@xenproject.org>,
"Daniel P. Smith" <dpsmith@apertussolutions.com>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v4 15/20] xen/sysctl: wrap around XEN_SYSCTL_scheduler_op
Date: Wed, 28 May 2025 17:17:03 +0800 [thread overview]
Message-ID: <20250528091708.390767-16-Penny.Zheng@amd.com> (raw)
In-Reply-To: <20250528091708.390767-1-Penny.Zheng@amd.com>
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
---
v1 -> v2:
- no need to wrap declarations
- add transient #ifdef in sysctl.c for correct compilation
---
v2 -> v3:
- move #endif up ahead of the blank line
---
v3 -> v4:
- remove transient "#ifdef CONFIG_SYSCTL"
---
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/include/xsm/xsm.h | 4 ++++
xen/xsm/dummy.c | 2 ++
xen/xsm/flask/hooks.c | 4 ++++
8 files changed, 30 insertions(+)
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/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 45c12aa662..a7cb33a718 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 /* 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
--
2.34.1
next prev parent reply other threads:[~2025-05-28 9:21 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 9:16 [PATCH v4 00/20] xen: introduce CONFIG_SYSCTL Penny Zheng
2025-05-28 9:16 ` [PATCH v4 01/20] xen/pmstat: consolidate code into pmstat.c Penny Zheng
2025-06-11 11:47 ` Jan Beulich
2025-06-18 10:28 ` Jan Beulich
2025-05-28 9:16 ` [PATCH v4 02/20] xen: make avail_domheap_pages() inlined into get_outstanding_claims() Penny Zheng
2025-05-28 9:16 ` [PATCH v4 03/20] xen/x86: remove "depends on !PV_SHIM_EXCLUSIVE" Penny Zheng
2025-05-29 23:22 ` Stefano Stabellini
2025-06-10 13:00 ` Jan Beulich
2025-06-12 4:09 ` Penny, Zheng
2025-06-12 7:01 ` Jan Beulich
2025-06-12 8:52 ` Penny, Zheng
2025-06-12 9:27 ` Jan Beulich
2025-05-28 9:16 ` [PATCH v4 04/20] xen: introduce CONFIG_SYSCTL Penny Zheng
2025-06-10 13:05 ` Jan Beulich
2025-06-10 13:54 ` Jan Beulich
2025-06-12 4:35 ` Penny, Zheng
2025-06-12 7:13 ` Jan Beulich
2025-05-28 9:16 ` [PATCH v4 05/20] xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL Penny Zheng
2025-05-28 9:16 ` [PATCH v4 06/20] xen/sysctl: wrap around XEN_SYSCTL_readconsole Penny Zheng
2025-05-28 9:16 ` [PATCH v4 07/20] xen/sysctl: make CONFIG_TRACEBUFFER depend on CONFIG_SYSCTL Penny Zheng
2025-05-28 9:16 ` [PATCH v4 08/20] xen/sysctl: wrap around XEN_SYSCTL_sched_id Penny Zheng
2025-05-28 9:16 ` [PATCH v4 09/20] xen/sysctl: wrap around XEN_SYSCTL_perfc_op Penny Zheng
2025-05-28 9:16 ` [PATCH v4 10/20] xen/sysctl: wrap around XEN_SYSCTL_lockprof_op Penny Zheng
2025-05-28 9:16 ` [PATCH v4 11/20] xen/pmstat: introduce CONFIG_PM_OP Penny Zheng
2025-06-10 13:40 ` Jan Beulich
2025-06-12 7:00 ` Penny, Zheng
2025-06-12 7:22 ` Jan Beulich
2025-05-28 9:17 ` [PATCH v4 12/20] xen/sysctl: introduce CONFIG_PM_STATS Penny Zheng
2025-06-10 13:42 ` Jan Beulich
2025-05-28 9:17 ` [PATCH v4 13/20] xen/sysctl: wrap around XEN_SYSCTL_page_offline_op Penny Zheng
2025-05-28 9:17 ` [PATCH v4 14/20] xen/sysctl: wrap around XEN_SYSCTL_cpupool_op Penny Zheng
2025-05-28 9:17 ` Penny Zheng [this message]
2025-05-28 9:17 ` [PATCH v4 16/20] xen/sysctl: wrap around XEN_SYSCTL_physinfo Penny Zheng
2025-05-28 9:17 ` [PATCH v4 17/20] xen/sysctl: make CONFIG_COVERAGE depend on CONFIG_SYSCTL Penny Zheng
2025-06-10 13:47 ` Jan Beulich
2025-06-13 6:35 ` Penny, Zheng
2025-05-28 9:17 ` [PATCH v4 18/20] xen/sysctl: make CONFIG_LIVEPATCH " Penny Zheng
2025-05-28 9:17 ` [PATCH v4 19/20] xen/sysctl: wrap around arch-specific arch_do_sysctl Penny Zheng
2025-05-28 9:17 ` [PATCH v4 20/20] xen/sysctl: wrap around sysctl hypercall Penny Zheng
2025-06-10 13:53 ` Jan Beulich
2025-06-13 8:57 ` Penny, Zheng
2025-06-10 13:36 ` [PATCH v4 00/20] xen: introduce CONFIG_SYSCTL Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250528091708.390767-16-Penny.Zheng@amd.com \
--to=penny.zheng@amd.com \
--cc=dfaggioli@suse.com \
--cc=dpsmith@apertussolutions.com \
--cc=gwd@xenproject.org \
--cc=jgross@suse.com \
--cc=nathan.studer@dornerworks.com \
--cc=ray.huang@amd.com \
--cc=sstabellini@kernel.org \
--cc=stewart@stew.dk \
--cc=xen-devel@dornerworks.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.