From nobody Thu Aug 13 09:24:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1785822910; cv=none; d=zohomail.com; s=zohoarc; b=CSDOzldwSrGts/SjVvBDKEbbfnMyDNSx6cIjYBFLDGkBxI/MEf7nZmDXg3t18eit80O4UVQkPg9S2XZrUYY2Bx0nuWFe59Gf5OKPmloMuropH2HW/+XhCoE6diI0wnf1AAnDfJ1A71ctzpZConhyN0mzx7uC8aETJwtBSKnG+jw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785822910; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8ggoOmXMwyCogxzBnBzSfIP7aGxj9wPFdRUdL5Ji3Ko=; b=gAhAzvIVnQ3g7sRsif7pdq+dVwjQwU1iGy18VO60R0lDiRKkzi7DpTN3KPTB52VntlEFltkYQhGZGGPA1Dw1lf3gZL070IKzkw0WVJ4mElw3P323GlpJYgvfRZi7neJBB+8Psb/jkdbfEAioUJ8VolsumU/uTbi10q9TZc3yd2U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785822910442286.1962773438747; Mon, 3 Aug 2026 22:55:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1381883.1625333 (Exim 4.92) (envelope-from ) id 1wr86w-0000M4-RW; Tue, 04 Aug 2026 05:54:46 +0000 Received: by outflank-mailman (output) from mailman id 1381883.1625333; Tue, 04 Aug 2026 05:54:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wr86w-0000Lv-Nl; Tue, 04 Aug 2026 05:54:46 +0000 Received: by outflank-mailman (input) for mailman id 1381883; Tue, 04 Aug 2026 05:54:45 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wr86v-0000LU-71 for xen-devel@lists.xenproject.org; Tue, 04 Aug 2026 05:54:45 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wr86u-00DoJM-Gc for xen-devel@lists.xenproject.org; Tue, 04 Aug 2026 07:54:44 +0200 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a717e93-2eae-0a2a0a5409dd-0a2a4504e2c6-20 for ; Tue, 04 Aug 2026 07:54:44 +0200 Received: from [209.85.128.44] (helo=mail-wm1-f44.google.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a717ea4-b57f-0a2a45040019-d155802cb57b-3 for ; Tue, 04 Aug 2026 07:54:44 +0200 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49557167508so25172265e9.1 for ; Mon, 03 Aug 2026 22:54:44 -0700 (PDT) Received: from notebook.. ([78.173.117.189]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4994a100e14sm55453775e9.14.2026.08.03.22.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 22:54:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785822884; x=1786427684; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8ggoOmXMwyCogxzBnBzSfIP7aGxj9wPFdRUdL5Ji3Ko=; b=G60Am7tK6ST+k+DGPtB7LfQROY7sRE6nvpaBiOv67VWd3KMROhxZMNVQ6dlYOY/ufm AqYJIWfXpIuLlljql9PNPGQkP2QIzL1o8gqa0wwCnTgBmZoLy49nA4rLbjmzvQjeb4Fl KcuxSG+qYL/yuadwdFgOpa1LLW/J39l8XgkbItr/Qx8QNDhpNJBL7spssCHmqbDPFNRK DVOx6jXRiFd2YNCr2XVvwI5UIHgClQOECpx1/aPJqCe6mbwIqyjQw3msfjd/SzVLX0j6 1meQz0fNF0Ggwg5h4AXaZq7Vv/qvVpqR4w1gzPwg2Ml/PqSJBuH/skgfL3eq4jROm/gI 5bRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785822884; x=1786427684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=8ggoOmXMwyCogxzBnBzSfIP7aGxj9wPFdRUdL5Ji3Ko=; b=UY9UZuzQpzpV2+IMrjvPme7UR8i2jHA67YRWtVgcgEmqFs9Zsmx6epWmjxcbMc2AGe qKF3aAmjjCvAZPwMRPZ6B9kr9LPdDTiB5tg9UM76RUjVFE7WQSF2VtU9TRmGxjfVMbjk V+JSXY3glQVzFd87qxMsnA+mhrWMvl/0SJH6RrfhxRoM7tTracXKHXYfCobcRNLbd9X0 /V2s0hUS7uAVYvn5/zhNSLee0gA4j/rlTXrLBd1sbDFtzOPgPqdv8p/UyLD/jZ/gQUAv TH/rWgRCskyStS5AAw5OoQttoqI8O1Uw8+Fey2CccAfgoaVYfcLO2OidOLdG2Xwc4yqJ OEuA== X-Gm-Message-State: AOJu0Yw+zNhkp8LJw9CfChYbnJhIZ5S7j7MpPLfu3bka3vxhTMD8Nzeb 0LE/wRkqr+FQASy2txUEPLtryEbF06310ZjSnTnzHLoT8qZE5cQ6r0lS4H+O1g== X-Gm-Gg: AR+sD10Tg/Z4ddVzvSDYH8ti//09EmoXLg7h0XMKPxEiBOSBoQQaD8al6GCmGxEYm5A 3MoMkADvwqow6xrihmQhhmtLO3vAwFy1K/VEgDvx/FIVQhUMLPxSBu/pEEFOf3SQHPUgQ6xYb86 xNs65kIi/zajKcDxXc5FLPd3L0k8dstX55eVTg1RNKRFt5Yo0ZI5l9nGiwneAVJLsi8Wmqi/KLz WF54RJpfcY4wVWbp7vEYBdv2ZszNx2hyfumgM0q4URvE6S0ga9pSPgu6S0HENtI2jtUJwniKOFO drFof1mCOHQS2r9KcWo/dX2pnvTX7pp5/wm501pzBDccmHRbAiGvbdBNHaePnEY4i+pwOM23K2c G9cn/jPF/XPhziPAfko5AaohXUpS+Xo3WuuMipRV3cgjqfsU07EsmCMBUu9w9gs5zDcAMNbEmhd gv4SrvBYC3wc/5t5/eAafAP/6Y93khyStEeOU30Mwj95GuOjJ+5rRVoqYHQVXVt9+4OHaGL2ka X-Received: by 2002:a05:600c:4453:b0:495:6274:56c2 with SMTP id 5b1f17b1804b1-4980c649c6emr272532265e9.2.1785822883826; Mon, 03 Aug 2026 22:54:43 -0700 (PDT) From: Furkan Caliskan To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, jbeulich@suse.com, jgross@suse.com, gwd@xenproject.org, dfaggioli@suse.com, stewart.hildebrand@amd.com, nathan.studer@dornerworks.com, roger@xenproject.org, anthony.perard@vates.tech, julien@xen.org, sstabellini@kernel.org, michal.orzel@amd.com, bertrand.marquis@arm.com, Volodymyr_Babchuk@epam.com, teddy.astie@vates.tech, tpearson@raptorengineering.com, alistair.francis@wdc.com, connojdavis@gmail.com, Furkan Caliskan Subject: [PATCH v2 1/2] xen/sched: split scheduler vtable from struct scheduler Date: Tue, 4 Aug 2026 08:53:26 +0300 Message-Id: <20260804055327.22119-2-frn1furkan10@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260804055327.22119-1-frn1furkan10@gmail.com> References: <20260804055327.22119-1-frn1furkan10@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-ebf023/1785822884-506DAB50-A98A8F2D/0/0 X-purgate-type: clean X-purgate-size: 20100 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1785822912016158500 Content-Type: text/plain; charset="utf-8" struct scheduler currently serves two purposes: it is the static vtable a scheduler backend defines (name, opt_name, sched_id, and all its function pointers), and it is also the per-cpupool runtime object scheduler_alloc() allocates. Being the same type forces scheduler_alloc() to memcpy() the whole vtable into a fresh allocation per cpupool, duplicating identical function pointers across every cpupool using the same scheduler. Split the vtable out into its own type, struct sched_ops, so it can be shared by every cpupool using a given scheduler instead of copied per cpupool. struct scheduler is left holding only what is actually per-instance: a pointer to the shared sched_ops, plus sched_data and cpupool. scheduler_alloc() now stores a pointer to the matching sched_ops instance instead of copying its fields, and every accessor in private.h is updated from s->field to s->ops->field to match. Every in-tree scheduler backend (credit, credit2, rtds, arinc653, null) is converted from struct scheduler to struct sched_ops. A handful of call sites elsewhere read a scheduler's name, opt_name or sched_id directly and are updated to go through ->ops as well. Signed-off-by: Furkan Caliskan Acked-by: Stewart Hildebrand Reviewed-by: Juergen Gross --- xen/common/sched/arinc653.c | 9 +--- xen/common/sched/core.c | 52 +++++++++++--------- xen/common/sched/cpupool.c | 7 +-- xen/common/sched/credit.c | 3 +- xen/common/sched/credit2.c | 3 +- xen/common/sched/null.c | 3 +- xen/common/sched/private.h | 98 +++++++++++++++++++------------------ xen/common/sched/rt.c | 3 +- 8 files changed, 89 insertions(+), 89 deletions(-) diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c index 32c596a23c..746963806e 100644 --- a/xen/common/sched/arinc653.c +++ b/xen/common/sched/arinc653.c @@ -702,17 +702,10 @@ a653sched_adjust_global(const struct scheduler *ops, } #endif /* CONFIG_SYSCTL */ =20 -/** - * This structure defines our scheduler for Xen. - * The entries tell Xen where to find our scheduler-specific - * callback functions. - * The symbol must be visible to the rest of Xen at link time. - */ -static const struct scheduler sched_arinc653_def =3D { +static const struct sched_ops sched_arinc653_def =3D { .name =3D "ARINC 653 Scheduler", .opt_name =3D "arinc653", .sched_id =3D XEN_SCHEDULER_ARINC653, - .sched_data =3D NULL, =20 .init =3D a653sched_init, .deinit =3D a653sched_deinit, diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 9ccf5811bf..5cdae0415c 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -87,7 +87,7 @@ DEFINE_PER_CPU(cpumask_t, cpumask_scratch); /* How many urgent vcpus. */ DEFINE_PER_CPU(atomic_t, sched_urgent_count); =20 -extern const struct scheduler *__start_schedulers_array[], *__end_schedule= rs_array[]; +extern const struct sched_ops *__start_schedulers_array[], *__end_schedule= rs_array[]; #define NUM_SCHEDULERS (__end_schedulers_array - __start_schedulers_array) #define schedulers __start_schedulers_array =20 @@ -127,10 +127,9 @@ static void cf_check sched_idle_schedule( unit->next_task =3D sched_idle_unit(cpu); } =20 -static struct scheduler sched_idle_ops =3D { +static struct sched_ops sched_idle_sched_ops =3D { .name =3D "Idle Scheduler", .opt_name =3D "idle", - .sched_data =3D NULL, =20 .pick_resource =3D sched_idle_res_pick, .do_schedule =3D sched_idle_schedule, @@ -139,6 +138,11 @@ static struct scheduler sched_idle_ops =3D { .free_udata =3D sched_idle_free_udata, }; =20 +static struct scheduler sched_idle_ops =3D { + .ops =3D &sched_idle_sched_ops, + .sched_data =3D NULL, +}; + static inline struct vcpu *unit2vcpu_cpu(const struct sched_unit *unit, unsigned int cpu) { @@ -2081,7 +2085,7 @@ long do_set_timer_op(s_time_t timeout) /* scheduler_id - fetch ID of current scheduler */ int scheduler_id(void) { - return operations.sched_id; + return operations.ops->sched_id; } #endif =20 @@ -2090,7 +2094,7 @@ long sched_adjust(struct domain *d, struct xen_domctl= _scheduler_op *op) { long ret; =20 - if ( op->sched_id !=3D dom_scheduler(d)->sched_id ) + if ( op->sched_id !=3D dom_scheduler(d)->ops->sched_id ) return -EINVAL; =20 switch ( op->cmd ) @@ -2132,7 +2136,7 @@ long sched_adjust_global(struct xen_sysctl_scheduler_= op *op) =20 rcu_read_lock(&sched_res_rculock); =20 - rc =3D ((op->sched_id =3D=3D pool->sched->sched_id) + rc =3D ((op->sched_id =3D=3D pool->sched->ops->sched_id) ? sched_adjust_cpupool(pool->sched, op) : -EINVAL); =20 rcu_read_unlock(&sched_res_rculock); @@ -2299,7 +2303,7 @@ static struct sched_unit *do_schedule(struct sched_un= it *prev, s_time_t now, struct sched_unit *next; =20 /* get policy-specific decision on scheduling... */ - sched->do_schedule(sched, prev, now, sched_tasklet_check(cpu)); + sched->ops->do_schedule(sched, prev, now, sched_tasklet_check(cpu)); =20 next =3D prev->next_task; =20 @@ -2989,10 +2993,9 @@ void scheduler_enable(void) } =20 static inline -const struct scheduler *__init sched_get_by_name(const char *sched_name) +const struct sched_ops *__init sched_ops_get_by_name(const char* sched_nam= e) { unsigned int i; - for ( i =3D 0; i < NUM_SCHEDULERS; i++ ) if ( schedulers[i] && !strcmp(schedulers[i]->opt_name, sched_name)= ) return schedulers[i]; @@ -3002,16 +3005,15 @@ const struct scheduler *__init sched_get_by_name(co= nst char *sched_name) =20 int __init sched_get_id_by_name(const char *sched_name) { - const struct scheduler *scheduler =3D sched_get_by_name(sched_name); - - return scheduler ? scheduler->sched_id : -1; + const struct sched_ops *ops =3D sched_ops_get_by_name(sched_name); + return ops ? ops->sched_id : -1; } =20 /* Initialise the data structures. */ void __init scheduler_init(void) { struct domain *idle_domain; - const struct scheduler *scheduler; + const struct sched_ops *ops; int i; =20 scheduler_enable(); @@ -3044,21 +3046,23 @@ void __init scheduler_init(void) } } =20 - scheduler =3D sched_get_by_name(opt_sched); - if ( !scheduler ) + ops =3D sched_ops_get_by_name(opt_sched); + if ( !ops ) { printk("Could not find scheduler: %s\n", opt_sched); - scheduler =3D sched_get_by_name(CONFIG_SCHED_DEFAULT); - BUG_ON(!scheduler); - printk("Using '%s' (%s)\n", scheduler->name, scheduler->opt_name); + ops =3D sched_ops_get_by_name(CONFIG_SCHED_DEFAULT); + BUG_ON(!ops); + printk("Using '%s' (%s)\n", ops->name, ops->opt_name); } - operations =3D *scheduler; + + operations.ops =3D ops; =20 if ( cpu_schedule_up(0) ) BUG(); register_cpu_notifier(&cpu_schedule_nfb); =20 - printk("Using scheduler: %s (%s)\n", operations.name, operations.opt_n= ame); + printk("Using scheduler: %s (%s)\n", + operations.ops->name, operations.ops->opt_name); if ( sched_init(&operations) ) panic("scheduler returned error on init\n"); =20 @@ -3411,12 +3415,14 @@ struct scheduler *scheduler_alloc(unsigned int sche= d_id) for ( i =3D 0; i < NUM_SCHEDULERS; i++ ) if ( schedulers[i] && schedulers[i]->sched_id =3D=3D sched_id ) goto found; + return ERR_PTR(-ENOENT); =20 found: - if ( (sched =3D xmalloc(struct scheduler)) =3D=3D NULL ) + if ( (sched =3D xzalloc(struct scheduler)) =3D=3D NULL ) return ERR_PTR(-ENOMEM); - memcpy(sched, schedulers[i], sizeof(*sched)); + sched->ops =3D schedulers[i]; + if ( (ret =3D sched_init(sched)) !=3D 0 ) { xfree(sched); @@ -3447,7 +3453,7 @@ void schedule_dump(struct cpupool *c) { sched =3D c->sched; cpus =3D c->res_valid; - printk("Scheduler: %s (%s)\n", sched->name, sched->opt_name); + printk("Scheduler: %s (%s)\n", sched->ops->name, sched->ops->opt_n= ame); sched_dump_settings(sched); } else diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index 081e1053eb..640578201f 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -338,7 +338,8 @@ static struct cpupool *cpupool_create(unsigned int pool= id, spin_unlock(&cpupool_lock); =20 debugtrace_printk("Created cpupool %u with scheduler %s (%s)\n", - c->cpupool_id, c->sched->name, c->sched->opt_name); + c->cpupool_id, c->sched->ops->name, + c->sched->ops->opt_name); =20 return c; =20 @@ -862,7 +863,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) if ( c =3D=3D NULL ) break; op->cpupool_id =3D c->cpupool_id; - op->sched_id =3D c->sched->sched_id; + op->sched_id =3D c->sched->ops->sched_id; op->n_dom =3D c->n_dom; ret =3D cpumask_to_xenctl_bitmap(&op->cpumap, c->cpu_valid); cpupool_put(c); @@ -1294,7 +1295,7 @@ struct cpupool *__init cpupool_create_pool(unsigned i= nt pool_id, int sched_id) struct cpupool *pool; =20 if ( sched_id < 0 ) - sched_id =3D scheduler_get_default()->sched_id; + sched_id =3D scheduler_get_default()->ops->sched_id; =20 pool =3D cpupool_create(pool_id, sched_id); =20 diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index 4dde2ede12..8df746bf6b 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -2277,11 +2277,10 @@ csched_deinit(struct scheduler *ops) } } =20 -static const struct scheduler sched_credit_def =3D { +static const struct sched_ops sched_credit_def =3D { .name =3D "SMP Credit Scheduler", .opt_name =3D "credit", .sched_id =3D XEN_SCHEDULER_CREDIT, - .sched_data =3D NULL, =20 .global_init =3D csched_global_init, =20 diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 95946634d1..4949606881 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -4230,11 +4230,10 @@ csched2_deinit(struct scheduler *ops) xfree(prv); } =20 -static const struct scheduler sched_credit2_def =3D { +static const struct sched_ops sched_credit2_def =3D { .name =3D "SMP Credit Scheduler rev2", .opt_name =3D "credit2", .sched_id =3D XEN_SCHEDULER_CREDIT2, - .sched_data =3D NULL, =20 .global_init =3D csched2_global_init, =20 diff --git a/xen/common/sched/null.c b/xen/common/sched/null.c index 952bb47444..b3c6651fb1 100644 --- a/xen/common/sched/null.c +++ b/xen/common/sched/null.c @@ -1037,11 +1037,10 @@ static void cf_check null_dump(const struct schedul= er *ops) spin_unlock_irqrestore(&prv->lock, flags); } =20 -static const struct scheduler sched_null_def =3D { +static const struct sched_ops sched_null_def =3D { .name =3D "null Scheduler", .opt_name =3D "null", .sched_id =3D XEN_SCHEDULER_NULL, - .sched_data =3D NULL, =20 .init =3D null_init, .deinit =3D null_deinit, diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h index d6884550cd..0c5181891c 100644 --- a/xen/common/sched/private.h +++ b/xen/common/sched/private.h @@ -294,12 +294,10 @@ static inline spinlock_t *pcpu_schedule_trylock(unsig= ned int cpu) return NULL; } =20 -struct scheduler { - const char *name; /* full name for this scheduler */ - const char *opt_name; /* option name for this scheduler */ - unsigned int sched_id; /* ID for this scheduler */ - void *sched_data; /* global data pointer */ - struct cpupool *cpupool;/* points to this scheduler's pool */ +struct sched_ops { + const char *name; /* full name for this sched_ops */ + const char *opt_name; /* option name for this sched_ops */ + unsigned int sched_id; /* ID for this sched_ops */ =20 int (*global_init) (void); =20 @@ -366,127 +364,133 @@ struct scheduler { struct sched_resource *sr); }; =20 +struct scheduler { + const struct sched_ops *ops; /* shared, read-only dispatch table */ + void *sched_data; /* global data pointer */ + struct cpupool *cpupool; /* points to this scheduler's pool */ +}; + static inline int sched_init(struct scheduler *s) { - return s->init(s); + return s->ops->init(s); } =20 static inline void sched_deinit(struct scheduler *s) { - s->deinit(s); + s->ops->deinit(s); } =20 static inline spinlock_t *sched_switch_sched(struct scheduler *s, unsigned int cpu, void *pdata, void *vdata) { - return s->switch_sched(s, cpu, pdata, vdata); + return s->ops->switch_sched(s, cpu, pdata, vdata); } =20 static inline void sched_dump_settings(const struct scheduler *s) { - if ( s->dump_settings ) - s->dump_settings(s); + if ( s->ops->dump_settings ) + s->ops->dump_settings(s); } =20 static inline void sched_dump_cpu_state(const struct scheduler *s, int cpu) { - if ( s->dump_cpu_state ) - s->dump_cpu_state(s, cpu); + if ( s->ops->dump_cpu_state ) + s->ops->dump_cpu_state(s, cpu); } =20 static inline void *sched_alloc_domdata(const struct scheduler *s, struct domain *d) { - return s->alloc_domdata ? s->alloc_domdata(s, d) : NULL; + return s->ops->alloc_domdata ? s->ops->alloc_domdata(s, d) : NULL; } =20 static inline void sched_free_domdata(const struct scheduler *s, void *data) { - ASSERT(s->free_domdata || !data); - if ( s->free_domdata ) - s->free_domdata(s, data); + ASSERT(s->ops->free_domdata || !data); + if ( s->ops->free_domdata ) + s->ops->free_domdata(s, data); } =20 static inline void *sched_alloc_pdata(const struct scheduler *s, int cpu) { - return s->alloc_pdata ? s->alloc_pdata(s, cpu) : NULL; + return s->ops->alloc_pdata ? s->ops->alloc_pdata(s, cpu) : NULL; } =20 static inline void sched_free_pdata(const struct scheduler *s, void *data, int cpu) { - ASSERT(s->free_pdata || !data); - if ( s->free_pdata ) - s->free_pdata(s, data, cpu); + ASSERT(s->ops->free_pdata || !data); + if ( s->ops->free_pdata ) + s->ops->free_pdata(s, data, cpu); } =20 static inline void sched_deinit_pdata(const struct scheduler *s, void *dat= a, int cpu) { - if ( s->deinit_pdata ) - s->deinit_pdata(s, data, cpu); + if ( s->ops->deinit_pdata ) + s->ops->deinit_pdata(s, data, cpu); } =20 static inline void *sched_alloc_udata(const struct scheduler *s, struct sched_unit *unit, void *dom_d= ata) { - return s->alloc_udata(s, unit, dom_data); + return s->ops->alloc_udata(s, unit, dom_data); } =20 static inline void sched_free_udata(const struct scheduler *s, void *data) { - s->free_udata(s, data); + s->ops->free_udata(s, data); } =20 static inline void sched_insert_unit(const struct scheduler *s, struct sched_unit *unit) { - if ( s->insert_unit ) - s->insert_unit(s, unit); + if ( s->ops->insert_unit ) + s->ops->insert_unit(s, unit); } =20 static inline void sched_remove_unit(const struct scheduler *s, struct sched_unit *unit) { - if ( s->remove_unit ) - s->remove_unit(s, unit); + if ( s->ops->remove_unit ) + s->ops->remove_unit(s, unit); } =20 static inline void sched_sleep(const struct scheduler *s, struct sched_unit *unit) { - if ( s->sleep ) - s->sleep(s, unit); + if ( s->ops->sleep ) + s->ops->sleep(s, unit); } =20 static inline void sched_wake(const struct scheduler *s, struct sched_unit *unit) { - if ( s->wake ) - s->wake(s, unit); + if ( s->ops->wake ) + s->ops->wake(s, unit); } =20 static inline void sched_yield(const struct scheduler *s, struct sched_unit *unit) { - if ( s->yield ) - s->yield(s, unit); + if ( s->ops->yield ) + s->ops->yield(s, unit); } =20 static inline void sched_context_saved(const struct scheduler *s, struct sched_unit *unit) { - if ( s->context_saved ) - s->context_saved(s, unit); + if ( s->ops->context_saved ) + s->ops->context_saved(s, unit); } =20 static inline void sched_migrate(const struct scheduler *s, struct sched_unit *unit, unsigned int cpu) { - if ( s->migrate ) - s->migrate(s, unit, cpu); + if ( s->ops->migrate ) + s->ops->migrate(s, unit, cpu); else sched_set_res(unit, get_sched_res(cpu)); } @@ -494,7 +498,7 @@ static inline void sched_migrate(const struct scheduler= *s, static inline struct sched_resource *sched_pick_resource( const struct scheduler *s, const struct sched_unit *unit) { - return s->pick_resource(s, unit); + return s->ops->pick_resource(s, unit); } =20 static inline void sched_adjust_affinity(const struct scheduler *s, @@ -502,29 +506,29 @@ static inline void sched_adjust_affinity(const struct= scheduler *s, const cpumask_t *hard, const cpumask_t *soft) { - if ( s->adjust_affinity ) - s->adjust_affinity(s, unit, hard, soft); + if ( s->ops->adjust_affinity ) + s->ops->adjust_affinity(s, unit, hard, soft); } =20 static inline int sched_adjust_dom(const struct scheduler *s, struct domai= n *d, struct xen_domctl_scheduler_op *op) { - return s->adjust ? s->adjust(s, d, op) : 0; + return s->ops->adjust ? s->ops->adjust(s, d, op) : 0; } =20 #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; + return s->ops->adjust_global ? s->ops->adjust_global(s, op) : 0; } #endif =20 static inline void sched_move_timers(const struct scheduler *s, struct sched_resource *sr) { - if ( s->move_timers ) - s->move_timers(s, sr); + if ( s->ops->move_timers ) + s->ops->move_timers(s, sr); } =20 static inline void sched_unit_pause_nosync(const struct sched_unit *unit) @@ -543,7 +547,7 @@ static inline void sched_unit_unpause(const struct sche= d_unit *unit) vcpu_unpause(v); } =20 -#define REGISTER_SCHEDULER(x) static const struct scheduler *x##_entry \ +#define REGISTER_SCHEDULER(x) static const struct sched_ops *x##_entry \ __used_section(".data.schedulers") =3D &(x) =20 struct cpupool diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c index 744f214173..0e9f04ea72 100644 --- a/xen/common/sched/rt.c +++ b/xen/common/sched/rt.c @@ -1617,11 +1617,10 @@ static void cf_check repl_timer_handler(void *data) spin_unlock_irq(&prv->lock); } =20 -static const struct scheduler sched_rtds_def =3D { +static const struct sched_ops sched_rtds_def =3D { .name =3D "SMP RTDS Scheduler", .opt_name =3D "rtds", .sched_id =3D XEN_SCHEDULER_RTDS, - .sched_data =3D NULL, =20 .dump_cpu_state =3D rt_dump_pcpu, .dump_settings =3D rt_dump, --=20 2.34.1 From nobody Thu Aug 13 09:24:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1785822914; cv=none; d=zohomail.com; s=zohoarc; b=NNf3VCabmpF77zR9w+zKn5j1844NGErVGU/3n9aGd8lfH0bE5T4EKabQ6ytcf9/+kJbEtDYppWrauweI33dq9M8dTf8Lii1tAK3zsaEF7twisWKyZB7DnwNRKwvYAPmI6AtzNEemJ3yIsjP9WjRerp7JBQFB0rEDKZxOSCG/YfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785822914; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p6vxw/6ES4G2VqIbltqaKS0hNP1qFgjai3ORZHffXN8=; b=OPwYgjmMlTA+Sqz3F7mFq2g7m9NVlF7hC07Vj1XovdwtTeadi1/pxc5vkbUwFhpbcrhNu8cFIDhALwzCCGzssduy7X+bmcKBXgbYTxKjGGx6ahEddYpHq23N0E0xYrod6X4P8bAEY72Uqrl92m0ZnYpxB4mMGiX7KUy43XD6p4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785822914184334.21142217578017; Mon, 3 Aug 2026 22:55:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1381885.1625342 (Exim 4.92) (envelope-from ) id 1wr873-0000dG-6H; Tue, 04 Aug 2026 05:54:53 +0000 Received: by outflank-mailman (output) from mailman id 1381885.1625342; Tue, 04 Aug 2026 05:54:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wr873-0000d9-3K; Tue, 04 Aug 2026 05:54:53 +0000 Received: by outflank-mailman (input) for mailman id 1381885; Tue, 04 Aug 2026 05:54:51 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wr871-0000bZ-Iw for xen-devel@lists.xenproject.org; Tue, 04 Aug 2026 05:54:51 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wr870-00DRnB-Vx for xen-devel@lists.xenproject.org; Tue, 04 Aug 2026 07:54:50 +0200 Received: from [10.42.69.3] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a717e95-e002-0a2a0a5209dd-0a2a4503adec-46 for ; Tue, 04 Aug 2026 07:54:50 +0200 Received: from [209.85.128.44] (helo=mail-wm1-f44.google.com) by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a717eaa-fae8-0a2a45030019-d155802cdded-3 for ; Tue, 04 Aug 2026 07:54:50 +0200 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49802c418b5so23317355e9.1 for ; Mon, 03 Aug 2026 22:54:50 -0700 (PDT) Received: from notebook.. ([78.173.117.189]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4994a100e14sm55453775e9.14.2026.08.03.22.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 22:54:49 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785822890; x=1786427690; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=p6vxw/6ES4G2VqIbltqaKS0hNP1qFgjai3ORZHffXN8=; b=JRBVpzyToFDKUCnkHaEdrbYtw2LlbHqHuWQW1LM5y+CIthEEkEEjCzBkK6ji57okMt KQNGM3ErzhXq4yuErKRTCtkpeozvPF1ShGjtis0vxvYq3+H8xj+ZYvh4Do0jfbWKJWjN BuzdQiQpzH3l1X01MBs4+/qUKjXbNEh2rLdQNFbQcrb8aVbV4AUvDXheMdb+3Dh9RARv LhCTNt7me8MIKwKYvxPeJb67t8papaSyNN196lS2E98/nI9Sz4ScGvfbK6ySL0tEsjM/ NS7icNZf8qEJV/ou7vjnL80GFc1O8+zNX45LqY0e70etuOd723n7uhCQ4nCNAXJ3b5sm VgvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785822890; x=1786427690; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=p6vxw/6ES4G2VqIbltqaKS0hNP1qFgjai3ORZHffXN8=; b=n+ZvlSwGEIrF1sXYq0VRCVWYnJwTuXcq6YMB676sYVzzJ1U+ZkzDyzREEaiZ0GZJp2 M7Eu7LZDCO0KRfryhmmU9MvphuJwziy9w0EuHkQb+5tkmt2eo9SirDE+Xh9P4n31nSU3 RhQIhjM8coKcFb+N+i62qnDtLR+HORibcQS6m5mUWO5Ovf+IRHr+cuJjRq3CeWXvnVrL 7hH3vsB90/nm5qgEfGfuYGE0yRy7uVTrPeB3aW9t+3AKcGjFFXSGi3xB1aVECE60WNGJ 4L8aSLI1P7ApHZG4wMsYCabJnXqjG88W8VdGrvGhuyzdIQ6LAtwMDBOwgsUiWJArH8zm QdPw== X-Gm-Message-State: AOJu0YyF4MoeD3DmTAHai04i5LGibHLZU4tYSJr34JjYvw6+KIoF+ANC zgvvN+x2sAZqXZVn2mGdAt5u3I1VeaDJIq6CqRIVBYBDMIORi2p1I6M7HXyoqQ== X-Gm-Gg: AR+sD10gX4sCWXbh4QV61VrRnBSLQRH3Vk9f0yds9SCvzcy3avC3CR2E5dtS9vwpvl/ rYt1voidGkF7wyl3+K4uMDeopUTYc0YnsRtPAxQrmWsNYeM9fGsRPnvERESCXSMRY8vhAYMfCN2 wWbYrR6kzyaCJ+7kSu99jFKQNQNl94wJ1aGX2BRQXor4GkvH0v/Wg12KWPMDYkLGpcYtskPe/ny qvSyTqJe+t64YAPdwkx1l4GrGeL7yO3MN7AelRPhi6+mrWJdsokhzYcMXMgRw1rFsROUw2b/Mkz OTtYGbzODqw+lWDDp7mLdvbbUiVug4Mx4KHQUD5HEnJoAhyTBhphtFQVknjPSJ/fcyDMWcPKRfy avoHK2TVkm4W6cVIBWtBiZcHygbV8DDK/T78iLJc2D1+5x5uolEFotaOH+H5KLly/haZqOdyLT9 8RY6drQpnreqqe6xF4Ye3PjR9G7CD2ovlksh7ZL9AUBINAbJeLnMmcTvlaLTtN2w== X-Received: by 2002:a05:600c:840f:b0:493:c42e:5be0 with SMTP id 5b1f17b1804b1-4980c60705amr267135705e9.0.1785822890072; Mon, 03 Aug 2026 22:54:50 -0700 (PDT) From: Furkan Caliskan To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, jbeulich@suse.com, jgross@suse.com, gwd@xenproject.org, dfaggioli@suse.com, stewart.hildebrand@amd.com, nathan.studer@dornerworks.com, roger@xenproject.org, anthony.perard@vates.tech, julien@xen.org, sstabellini@kernel.org, michal.orzel@amd.com, bertrand.marquis@arm.com, Volodymyr_Babchuk@epam.com, teddy.astie@vates.tech, tpearson@raptorengineering.com, alistair.francis@wdc.com, connojdavis@gmail.com, Furkan Caliskan Subject: [PATCH v2 2/2] xen/sched: rename scheduler registration symbols Date: Tue, 4 Aug 2026 08:53:27 +0300 Message-Id: <20260804055327.22119-3-frn1furkan10@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260804055327.22119-1-frn1furkan10@gmail.com> References: <20260804055327.22119-1-frn1furkan10@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-33051d/1785822890-6E8CD4E9-A21BE1E6/0/0 X-purgate-type: clean X-purgate-size: 8916 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1785822916391158500 Content-Type: text/plain; charset="utf-8" REGISTER_SCHEDULER(), schedulers[], NUM_SCHEDULERS, and the per-arch SCHEDULER_ARRAY linker macro now register and hold struct sched_ops instances rather than struct scheduler ones, but still carry names describing the old type. Rename them to match the current behaviour. No functional change. Signed-off-by: Furkan Caliskan --- xen/arch/arm/xen.lds.S | 2 +- xen/arch/ppc/xen.lds.S | 2 +- xen/arch/riscv/xen.lds.S | 2 +- xen/arch/x86/xen.lds.S | 2 +- xen/common/sched/arinc653.c | 2 +- xen/common/sched/core.c | 33 +++++++++++++++++---------------- xen/common/sched/credit.c | 2 +- xen/common/sched/credit2.c | 2 +- xen/common/sched/null.c | 2 +- xen/common/sched/private.h | 4 ++-- xen/common/sched/rt.c | 2 +- xen/include/xen/xen.lds.h | 10 +++++----- 12 files changed, 33 insertions(+), 32 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 2d5f1c516d..07bf875599 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -93,7 +93,7 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) =20 - SCHEDULER_ARRAY + SCHED_OPS_ARRAY HYPFS_PARAM =20 *(.data .data.*) diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S index d0f2ed43f1..1f4e200693 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -84,7 +84,7 @@ SECTIONS DECL_SECTION(.data) { /* Data */ *(.data.page_aligned) =20 - SCHEDULER_ARRAY + SCHED_OPS_ARRAY HYPFS_PARAM =20 *(.data .data.*) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 65f136dce9..97f2db1dfd 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -89,7 +89,7 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) =20 - SCHEDULER_ARRAY + SCHED_OPS_ARRAY HYPFS_PARAM =20 *(.data .data.*) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index b9e888e596..0f506ff1f6 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -306,7 +306,7 @@ SECTIONS DECL_SECTION(.data.read_mostly) { *(.data.read_mostly) =20 - SCHEDULER_ARRAY + SCHED_OPS_ARRAY HYPFS_PARAM } PHDR(text) =20 diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c index 746963806e..efcaa44089 100644 --- a/xen/common/sched/arinc653.c +++ b/xen/common/sched/arinc653.c @@ -736,7 +736,7 @@ static const struct sched_ops sched_arinc653_def =3D { .dump_cpu_state =3D NULL, }; =20 -REGISTER_SCHEDULER(sched_arinc653_def); +REGISTER_SCHED_OPS(sched_arinc653_def); =20 /* * Local variables: diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 5cdae0415c..8e938a3810 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -87,9 +87,9 @@ DEFINE_PER_CPU(cpumask_t, cpumask_scratch); /* How many urgent vcpus. */ DEFINE_PER_CPU(atomic_t, sched_urgent_count); =20 -extern const struct sched_ops *__start_schedulers_array[], *__end_schedule= rs_array[]; -#define NUM_SCHEDULERS (__end_schedulers_array - __start_schedulers_array) -#define schedulers __start_schedulers_array +extern const struct sched_ops *__start_sched_ops_array[], *__end_sched_ops= _array[]; +#define NUM_SCHED_OPS (__end_sched_ops_array - __start_sched_ops_array) +#define sched_ops_array __start_sched_ops_array =20 static struct scheduler __read_mostly operations; =20 @@ -2996,9 +2996,9 @@ static inline const struct sched_ops *__init sched_ops_get_by_name(const char* sched_nam= e) { unsigned int i; - for ( i =3D 0; i < NUM_SCHEDULERS; i++ ) - if ( schedulers[i] && !strcmp(schedulers[i]->opt_name, sched_name)= ) - return schedulers[i]; + for ( i =3D 0; i < NUM_SCHED_OPS; i++ ) + if ( sched_ops_array[i] && !strcmp(sched_ops_array[i]->opt_name, s= ched_name) ) + return sched_ops_array[i]; =20 return NULL; } @@ -3018,14 +3018,14 @@ void __init scheduler_init(void) =20 scheduler_enable(); =20 - for ( i =3D 0; i < NUM_SCHEDULERS; i++) + for ( i =3D 0; i < NUM_SCHED_OPS; i++) { #define sched_test_func(f) \ - if ( !schedulers[i]->f ) \ + if ( !sched_ops_array[i]->f ) \ { \ printk("scheduler %s misses .%s, dropped\n", \ - schedulers[i]->opt_name, #f); \ - schedulers[i] =3D NULL; \ + sched_ops_array[i]->opt_name, #f); \ + sched_ops_array[i] =3D NULL; \ } =20 sched_test_func(init); @@ -3038,11 +3038,12 @@ void __init scheduler_init(void) =20 #undef sched_test_func =20 - if ( schedulers[i]->global_init && schedulers[i]->global_init() < = 0 ) + if ( sched_ops_array[i]->global_init && + sched_ops_array[i]->global_init() < 0 ) { printk("scheduler %s failed initialization, dropped\n", - schedulers[i]->opt_name); - schedulers[i] =3D NULL; + sched_ops_array[i]->opt_name); + sched_ops_array[i] =3D NULL; } } =20 @@ -3412,8 +3413,8 @@ struct scheduler *scheduler_alloc(unsigned int sched_= id) int ret; struct scheduler *sched; =20 - for ( i =3D 0; i < NUM_SCHEDULERS; i++ ) - if ( schedulers[i] && schedulers[i]->sched_id =3D=3D sched_id ) + for ( i =3D 0; i < NUM_SCHED_OPS; i++ ) + if ( sched_ops_array[i] && sched_ops_array[i]->sched_id =3D=3D sch= ed_id ) goto found; =20 return ERR_PTR(-ENOENT); @@ -3421,7 +3422,7 @@ struct scheduler *scheduler_alloc(unsigned int sched_= id) found: if ( (sched =3D xzalloc(struct scheduler)) =3D=3D NULL ) return ERR_PTR(-ENOMEM); - sched->ops =3D schedulers[i]; + sched->ops =3D sched_ops_array[i]; =20 if ( (ret =3D sched_init(sched)) !=3D 0 ) { diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index 8df746bf6b..995cf097b5 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -2315,4 +2315,4 @@ static const struct sched_ops sched_credit_def =3D { .move_timers =3D csched_move_timers, }; =20 -REGISTER_SCHEDULER(sched_credit_def); +REGISTER_SCHED_OPS(sched_credit_def); diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 4949606881..9bcc90004a 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -4268,4 +4268,4 @@ static const struct sched_ops sched_credit2_def =3D { .free_domdata =3D csched2_free_domdata, }; =20 -REGISTER_SCHEDULER(sched_credit2_def); +REGISTER_SCHED_OPS(sched_credit2_def); diff --git a/xen/common/sched/null.c b/xen/common/sched/null.c index b3c6651fb1..5194c8216c 100644 --- a/xen/common/sched/null.c +++ b/xen/common/sched/null.c @@ -1067,4 +1067,4 @@ static const struct sched_ops sched_null_def =3D { .dump_settings =3D null_dump, }; =20 -REGISTER_SCHEDULER(sched_null_def); +REGISTER_SCHED_OPS(sched_null_def); diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h index 0c5181891c..c03063befe 100644 --- a/xen/common/sched/private.h +++ b/xen/common/sched/private.h @@ -547,8 +547,8 @@ static inline void sched_unit_unpause(const struct sche= d_unit *unit) vcpu_unpause(v); } =20 -#define REGISTER_SCHEDULER(x) static const struct sched_ops *x##_entry \ - __used_section(".data.schedulers") =3D &(x) +#define REGISTER_SCHED_OPS(x) static const struct sched_ops *x##_entry \ + __used_section(".data.sched_ops") =3D &(x) =20 struct cpupool { diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c index 0e9f04ea72..8b4f05e2d1 100644 --- a/xen/common/sched/rt.c +++ b/xen/common/sched/rt.c @@ -1645,4 +1645,4 @@ static const struct sched_ops sched_rtds_def =3D { .move_timers =3D rt_move_timers, }; =20 -REGISTER_SCHEDULER(sched_rtds_def); +REGISTER_SCHED_OPS(sched_rtds_def); diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index ea11e3fb62..fc44d28734 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -173,11 +173,11 @@ _edevice =3D .; \ } :text =20 -#define SCHEDULER_ARRAY \ - . =3D ALIGN(POINTER_ALIGN); \ - __start_schedulers_array =3D .; \ - *(.data.schedulers) \ - __end_schedulers_array =3D .; +#define SCHED_OPS_ARRAY \ + . =3D ALIGN(POINTER_ALIGN); \ + __start_sched_ops_array =3D .; \ + *(.data.sched_ops) \ + __end_sched_ops_array =3D .; =20 #ifdef CONFIG_HYPFS #define HYPFS_PARAM \ --=20 2.34.1