From patchwork Sat Sep 14 05:19:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11145537 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDF72112B for ; Sat, 14 Sep 2019 05:21:12 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3DB22081B for ; Sat, 14 Sep 2019 05:21:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3DB22081B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i90TY-0006V2-9X; Sat, 14 Sep 2019 05:20:00 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i90TX-0006Um-PF for xen-devel@lists.xenproject.org; Sat, 14 Sep 2019 05:19:59 +0000 X-Inumbo-ID: 44acdb30-d6af-11e9-95c0-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 44acdb30-d6af-11e9-95c0-12813bfff9fa; Sat, 14 Sep 2019 05:19:47 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C393EADAA; Sat, 14 Sep 2019 05:19:46 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Sat, 14 Sep 2019 07:19:41 +0200 Message-Id: <20190914051944.21409-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190914051944.21409-1-jgross@suse.com> References: <20190914051944.21409-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v4 1/4] xen/sched: populate cpupool0 only after all cpus are up X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Dario Faggioli MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 Reviewed-by: Dario Faggioli --- 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); cpupool_put(cpupool0); - cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); + + 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; } -presmp_initcall(cpupool_presmp_init); +__initcall(cpupool_init); /* * Local variables: