Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>, Dario Faggioli <dfaggioli@suse.com>
Subject: [Xen-devel] [PATCH v4 1/4] xen/sched: populate cpupool0 only after all cpus are up
Date: Sat, 14 Sep 2019 07:19:41 +0200
Message-ID: <20190914051944.21409-2-jgross@suse.com> (raw)
In-Reply-To: <20190914051944.21409-1-jgross@suse.com>

Simplify cpupool initialization by populating cpupool0 with cpus only
after all cpus are up. This avoids having to call the cpu notifier
directly for cpu 0.

With that in place there is no need to create cpupool0 earlier, so
do that just before assigning the cpus. Initialize free cpus with all
online cpus at that time in order to be able to add the cpu notifier
late, too.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
V1: new patch
 xen/common/cpupool.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index f90e496eda..caea5bd8b3 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -762,18 +762,28 @@ static struct notifier_block cpu_nfb = {
     .notifier_call = cpu_callback
-static int __init cpupool_presmp_init(void)
+static int __init cpupool_init(void)
+    unsigned int cpu;
     int err;
-    void *cpu = (void *)(long)smp_processor_id();
     cpupool0 = cpupool_create(0, 0, &err);
     BUG_ON(cpupool0 == NULL);
-    cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
+    spin_lock(&cpupool_lock);
+    cpumask_copy(&cpupool_free_cpus, &cpu_online_map);
+    for_each_cpu ( cpu, &cpupool_free_cpus )
+        cpupool_assign_cpu_locked(cpupool0, cpu);
+    spin_unlock(&cpupool_lock);
     return 0;
  * Local variables:

Xen-devel mailing list

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14  5:19 [Xen-devel] [PATCH v4 0/4] xen/sched: use new idle scheduler for free cpus Juergen Gross
2019-09-14  5:19 ` Juergen Gross [this message]
2019-09-14  5:19 ` [Xen-devel] [PATCH v4 2/4] xen/sched: remove cpu from pool0 before removing it Juergen Gross
2019-09-14  5:19 ` [Xen-devel] [PATCH v4 3/4] xen/sched: add minimalistic idle scheduler for free cpus Juergen Gross
2019-09-14  5:19 ` [Xen-devel] [PATCH v4 4/4] xen/sched: switch to debugtrace in cpupool handling Juergen Gross

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190914051944.21409-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=dfaggioli@suse.com \
    --cc=xen-devel@lists.xenproject.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@archiver.kernel.org
	public-inbox-index xen-devel

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/ public-inbox