From patchwork Tue Oct 31 09:58:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yu X-Patchwork-Id: 10034001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E985602B9 for ; Tue, 31 Oct 2017 10:22:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32C1228945 for ; Tue, 31 Oct 2017 10:22:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2798728A29; Tue, 31 Oct 2017 10:22:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B28E2289A5 for ; Tue, 31 Oct 2017 10:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586AbdJaJzx (ORCPT ); Tue, 31 Oct 2017 05:55:53 -0400 Received: from mga06.intel.com ([134.134.136.31]:38674 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753563AbdJaJzv (ORCPT ); Tue, 31 Oct 2017 05:55:51 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 31 Oct 2017 02:55:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,323,1505804400"; d="scan'208";a="1031564205" Received: from yu-chen.sh.intel.com ([10.239.160.127]) by orsmga003.jf.intel.com with ESMTP; 31 Oct 2017 02:55:46 -0700 From: Yu Chen To: x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Lukas Wunner , "Rafael J . Wysocki" , Len Brown , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu , Rui Zhang Subject: [PATCH 1/3][RFC/RFT] PM / sleep: Introduce a flag to identify the enable_nonboot_cpus stage Date: Tue, 31 Oct 2017 17:58:19 +0800 Message-Id: <1fb567e68f522a51cc447f79becafe773b697246.1509438899.git.yu.c.chen@intel.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chen Yu A new flag is introduced to indicate that, we are in the process of running enable_nonboot_cpus() to bring the APs up. This flag is to prepare for the use of MTRR sync later. Cc: Len Brown Cc: Rafael J. Wysocki Cc: Rui Zhang Signed-off-by: Chen Yu --- include/linux/cpu.h | 2 ++ kernel/cpu.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index ca73bc1563f4..f0759d837919 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -133,9 +133,11 @@ static inline int disable_nonboot_cpus(void) return freeze_secondary_cpus(0); } extern void enable_nonboot_cpus(void); +extern bool in_enable_nonboot_cpus(void); #else /* !CONFIG_PM_SLEEP_SMP */ static inline int disable_nonboot_cpus(void) { return 0; } static inline void enable_nonboot_cpus(void) {} +static inline bool in_enable_nonboot_cpus(void) { return false; } #endif /* !CONFIG_PM_SLEEP_SMP */ void cpu_startup_entry(enum cpuhp_state state); diff --git a/kernel/cpu.c b/kernel/cpu.c index 04892a82f6ac..071dcae8b0fb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1077,6 +1077,12 @@ EXPORT_SYMBOL_GPL(cpu_up); #ifdef CONFIG_PM_SLEEP_SMP static cpumask_var_t frozen_cpus; +static bool enable_nonboot_cpus_run; + +bool in_enable_nonboot_cpus(void) +{ + return enable_nonboot_cpus_run; +} int freeze_secondary_cpus(int primary) { @@ -1143,6 +1149,7 @@ void enable_nonboot_cpus(void) pr_info("Enabling non-boot CPUs ...\n"); arch_enable_nonboot_cpus_begin(); + enable_nonboot_cpus_run = true; for_each_cpu(cpu, frozen_cpus) { trace_suspend_resume(TPS("CPU_ON"), cpu, true); @@ -1155,6 +1162,7 @@ void enable_nonboot_cpus(void) pr_warn("Error taking CPU%d up: %d\n", cpu, error); } + enable_nonboot_cpus_run = false; arch_enable_nonboot_cpus_end(); cpumask_clear(frozen_cpus);