Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2799424ybc; Mon, 25 Nov 2019 04:28:16 -0800 (PST) X-Google-Smtp-Source: APXvYqw+SQqP3dsSWfpU9PpSHqbqIhP54+0/cKBUDuxjMDuCurRiglJYrFEOrrclDt69rwyQRuwf X-Received: by 2002:a17:906:2898:: with SMTP id o24mr13373570ejd.102.1574684896338; Mon, 25 Nov 2019 04:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574684896; cv=none; d=google.com; s=arc-20160816; b=ovVZIkHPZxywCjrV8RiXh2ShOyjv4yO7dZj5nWT8TSHUB6W3DvaIB6tkZu8sYp1wtn 8H9nAAkeg0gJjbLjk0GuTnhXP0xrX4lS0dApNhRDT521gCx3zhvqQTnReHC5t5ceB/Yl aEupLY3UaUIM4zybzOuHRMVNfe0TEMevGoigVCrDDKvb7X8OCBX1J4CFnuTADDI1T+5G YgTlMkU+uJBAZA6MF5owpb3auuX4lYoxY7KZm6uX6rU8G5bJGvd7ffDCA29hUpv1tC8l hpdw1jD5EooVk3T6F20+O6SMd+a6yXc1R6E/VuE96HXxi6VssmZPdQLv1eFWQ5EP7bjt aHkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4nG9uylBbFnpm05DiLmxdl6JmdRmfOBalPEj6BQ3qxg=; b=Gu30Edm92FNAYfSHGsugs6IgQ7KGD1HqnDBJsocYmMNWEZmHkUtOXvPNOpfW8HGbAe zrUzNTV9+LlYHyHJzedtkEXmvscdGJzBOot+4lyjUwhJAEpTkVo+ZlOqQ9iaIMxoFo7D 8GDy1izojnR9sDfpp0l7dj8Z9hqw72oH7/RwTI9dbLKtRYxNzC2fo3ZyFVBuGOh9rNpv Ur1J6VHVU+9GV22BH3ECtyTM5Abhfjjn/pblXBifB5bOvQIFxfRYGrUH8nvzXzDndwNo ZdwR75ozx68NYI9ijLeaHgEw8mklzGZtDrVeEuJxO9Y6h6XoLIdbQyKR5JjWbVrDfq2q WKJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dm22si5461954edb.381.2019.11.25.04.27.52; Mon, 25 Nov 2019 04:28:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbfKYL2l (ORCPT + 99 others); Mon, 25 Nov 2019 06:28:41 -0500 Received: from foss.arm.com ([217.140.110.172]:49110 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727822AbfKYL2Z (ORCPT ); Mon, 25 Nov 2019 06:28:25 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8381331B; Mon, 25 Nov 2019 03:28:24 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC7FD3F52E; Mon, 25 Nov 2019 03:28:22 -0800 (PST) From: Qais Yousef To: Thomas Gleixner , Greg Kroah-Hartman Cc: Qais Yousef , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Jiri Kosina , Nicholas Piggin , Daniel Lezcano , Ingo Molnar , Eiichi Tsukata , Zhenzhong Duan , Nadav Amit , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH v2 13/14] smp: Create a new function to bringup nonboot cpus online Date: Mon, 25 Nov 2019 11:27:53 +0000 Message-Id: <20191125112754.25223-14-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191125112754.25223-1-qais.yousef@arm.com> References: <20191125112754.25223-1-qais.yousef@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is the last direct user of cpu_up() before we can hide it now as internal implementation detail of the cpu subsystem. Signed-off-by: Qais Yousef CC: Thomas Gleixner CC: Josh Poimboeuf CC: "Peter Zijlstra (Intel)" CC: Jiri Kosina CC: Nicholas Piggin CC: Daniel Lezcano CC: Ingo Molnar CC: Eiichi Tsukata CC: Zhenzhong Duan CC: Nadav Amit CC: Greg Kroah-Hartman CC: "Rafael J. Wysocki" CC: linux-kernel@vger.kernel.org --- include/linux/cpu.h | 1 + kernel/cpu.c | 12 ++++++++++++ kernel/smp.c | 9 +-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index f05168b49fab..b5d9287899d1 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -93,6 +93,7 @@ void notify_cpu_starting(unsigned int cpu); extern void cpu_maps_update_begin(void); extern void cpu_maps_update_done(void); extern int bringup_hibernate_cpu(unsigned int sleep_cpu); +extern void smp_bringup_nonboot_cpus(unsigned int setup_max_cpus); #else /* CONFIG_SMP */ #define cpuhp_tasks_frozen 0 diff --git a/kernel/cpu.c b/kernel/cpu.c index 9610442c8dbc..3631184a284f 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1245,6 +1245,18 @@ int bringup_hibernate_cpu(unsigned int sleep_cpu) return 0; } +void smp_bringup_nonboot_cpus(unsigned int setup_max_cpus) +{ + unsigned int cpu; + + for_each_present_cpu(cpu) { + if (num_online_cpus() >= setup_max_cpus) + break; + if (!cpu_online(cpu)) + cpu_up(cpu); + } +} + #ifdef CONFIG_PM_SLEEP_SMP static cpumask_var_t frozen_cpus; diff --git a/kernel/smp.c b/kernel/smp.c index 7dbcb402c2fc..74134272b5aa 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -578,20 +578,13 @@ void __init setup_nr_cpu_ids(void) void __init smp_init(void) { int num_nodes, num_cpus; - unsigned int cpu; idle_threads_init(); cpuhp_threads_init(); pr_info("Bringing up secondary CPUs ...\n"); - /* FIXME: This should be done in userspace --RR */ - for_each_present_cpu(cpu) { - if (num_online_cpus() >= setup_max_cpus) - break; - if (!cpu_online(cpu)) - cpu_up(cpu); - } + smp_bringup_nonboot_cpus(setup_max_cpus); num_nodes = num_online_nodes(); num_cpus = num_online_cpus(); -- 2.17.1