All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Fancellu <luca.fancellu@arm.com>
To: xen-devel@lists.xenproject.org
Cc: bertrand.marquis@arm.com, wei.chen@arm.com,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	Juergen Gross <jgross@suse.com>,
	Dario Faggioli <dfaggioli@suse.com>
Subject: [PATCH v6 6/6] xen/cpupool: Allow cpupool0 to use different scheduler
Date: Fri,  8 Apr 2022 09:45:17 +0100	[thread overview]
Message-ID: <20220408084517.33082-7-luca.fancellu@arm.com> (raw)
In-Reply-To: <20220408084517.33082-1-luca.fancellu@arm.com>

Currently cpupool0 can use only the default scheduler, and
cpupool_create has an hardcoded behavior when creating the pool 0
that doesn't allocate new memory for the scheduler, but uses the
default scheduler structure in memory.

With this commit it is possible to allocate a different scheduler for
the cpupool0 when using the boot time cpupool.
To achieve this the hardcoded behavior in cpupool_create is removed
and the cpupool0 creation is moved.

When compiling without boot time cpupools enabled, the current
behavior is maintained (except that cpupool0 scheduler memory will be
allocated).

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
Changes in v6:
- Add R-by
Changes in v5:
- no changes
Changes in v4:
- no changes
Changes in v3:
- fix typo in commit message (Juergen)
- rebase changes
Changes in v2:
- new patch
---
 xen/common/boot_cpupools.c | 5 ++++-
 xen/common/sched/cpupool.c | 8 +-------
 xen/include/xen/sched.h    | 5 ++++-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/common/boot_cpupools.c b/xen/common/boot_cpupools.c
index 240bae4cebb8..5955e6f9a98b 100644
--- a/xen/common/boot_cpupools.c
+++ b/xen/common/boot_cpupools.c
@@ -205,8 +205,11 @@ void __init btcpupools_allocate_pools(void)
     if ( add_extra_cpupool )
         next_pool_id++;
 
+    /* Keep track of cpupool id 0 with the global cpupool0 */
+    cpupool0 = cpupool_create_pool(0, pool_sched_map[0]);
+
     /* Create cpupools with selected schedulers */
-    for ( i = 0; i < next_pool_id; i++ )
+    for ( i = 1; i < next_pool_id; i++ )
         cpupool_create_pool(i, pool_sched_map[i]);
 }
 
diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index 86a175f99cd5..83112f5f04d3 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -312,10 +312,7 @@ static struct cpupool *cpupool_create(unsigned int poolid,
         c->cpupool_id = q->cpupool_id + 1;
     }
 
-    if ( poolid == 0 )
-        c->sched = scheduler_get_default();
-    else
-        c->sched = scheduler_alloc(sched_id);
+    c->sched = scheduler_alloc(sched_id);
     if ( IS_ERR(c->sched) )
     {
         ret = PTR_ERR(c->sched);
@@ -1242,9 +1239,6 @@ static int __init cf_check cpupool_init(void)
 
     cpupool_hypfs_init();
 
-    cpupool0 = cpupool_create(0, 0);
-    BUG_ON(IS_ERR(cpupool0));
-    cpupool_put(cpupool0);
     register_cpu_notifier(&cpu_nfb);
 
     btcpupools_dtb_parse();
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b62315ad5e5d..e8f31758c058 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1185,7 +1185,10 @@ void btcpupools_dtb_parse(void);
 int btcpupools_get_domain_pool_id(const struct dt_device_node *node);
 
 #else /* !CONFIG_BOOT_TIME_CPUPOOLS */
-static inline void btcpupools_allocate_pools(void) {}
+static inline void btcpupools_allocate_pools(void)
+{
+    cpupool0 = cpupool_create_pool(0, -1);
+}
 static inline void btcpupools_dtb_parse(void) {}
 static inline unsigned int btcpupools_get_cpupool_id(unsigned int cpu)
 {
-- 
2.17.1



      parent reply	other threads:[~2022-04-08  8:45 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  8:45 [PATCH v6 0/6] Boot time cpupools Luca Fancellu
2022-04-08  8:45 ` [PATCH v6 1/6] tools/cpupools: Give a name to unnamed cpupools Luca Fancellu
2022-04-08  9:54   ` Anthony PERARD
2022-04-08  8:45 ` [PATCH v6 2/6] xen/sched: create public function for cpupools creation Luca Fancellu
2022-04-08  8:45 ` [PATCH v6 3/6] xen/sched: retrieve scheduler id by name Luca Fancellu
2022-04-08 10:29   ` Dario Faggioli
2022-04-08  8:45 ` [PATCH v6 4/6] xen/cpupool: Create different cpupools at boot time Luca Fancellu
2022-04-08  8:56   ` Jan Beulich
2022-04-08  9:06     ` Luca Fancellu
2022-04-08  9:01   ` Jan Beulich
2022-04-08 11:37     ` Luca Fancellu
2022-04-08 11:58       ` Jan Beulich
2022-04-08 20:25         ` Stefano Stabellini
2022-04-09  9:14           ` Juergen Gross
2022-04-11  6:15           ` Jan Beulich
2022-04-11  8:29             ` Luca Fancellu
2022-04-11 10:29               ` Dario Faggioli
2022-04-08 17:41   ` Julien Grall
2022-04-08 20:18   ` Stefano Stabellini
2022-04-11 10:58   ` Julien Grall
2022-04-11 11:30     ` Luca Fancellu
2022-04-11 11:42       ` Julien Grall
2022-04-08  8:45 ` [PATCH v6 5/6] arm/dom0less: assign dom0less guests to cpupools Luca Fancellu
2022-04-08  9:10   ` Jan Beulich
2022-04-08  9:39     ` Luca Fancellu
2022-04-08 10:24       ` Jan Beulich
2022-04-08 11:15         ` Luca Fancellu
2022-04-08 12:10           ` Jan Beulich
2022-04-11  8:54             ` Luca Fancellu
2022-04-11  9:08               ` Jan Beulich
2022-04-11 10:20                 ` Luca Fancellu
2022-04-11 10:23                   ` Jan Beulich
2022-04-08 10:37     ` Juergen Gross
2022-04-08  8:45 ` Luca Fancellu [this message]

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=20220408084517.33082-7-luca.fancellu@arm.com \
    --to=luca.fancellu@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=dfaggioli@suse.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.chen@arm.com \
    --cc=wl@xen.org \
    --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.