From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751809AbcFYQLi (ORCPT ); Sat, 25 Jun 2016 12:11:38 -0400 Received: from mga11.intel.com ([192.55.52.93]:58793 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751390AbcFYQLg (ORCPT ); Sat, 25 Jun 2016 12:11:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,527,1459839600"; d="scan'208";a="724945600" From: Chen Yu To: linux-pm@vger.kernel.org, x86@kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Peter Zijlstra , "H. Peter Anvin" , Borislav Petkov , Pavel Machek , Brian Gerst , Thomas Gleixner , Ingo Molnar , Varun Koyyalagunta , linux-kernel@vger.kernel.org, Chen Yu Subject: [PATCH 2/4][RFC v2] PM / sleep: Introduce arch-specific hook for disable/enable nonboot cpus Date: Sun, 26 Jun 2016 00:18:41 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is requirement that we need to do some arch-specific operations before putting the nonboot CPUs offline/online. One of the requirements comes from the hibernation resume process on x86_64, we need to kick all the offlin-CPUs online and offline again, in order to put them in a safe state, thus to avoid possible unwilling wake up during hibernation resume. Signed-off-by: Chen Yu --- kernel/cpu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index d25266e..ce6e5e4 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1017,6 +1017,16 @@ EXPORT_SYMBOL_GPL(cpu_up); #ifdef CONFIG_PM_SLEEP_SMP static cpumask_var_t frozen_cpus; +void __weak arch_disable_nonboot_cpus_pre(void) +{ + +} + +void __weak arch_enable_nonboot_cpus_pre(void) +{ + +} + int disable_nonboot_cpus(void) { int cpu, first_cpu, error = 0; @@ -1024,6 +1034,7 @@ int disable_nonboot_cpus(void) if (frozen_cpus == NULL) return -ENOMEM; cpu_maps_update_begin(); + arch_disable_nonboot_cpus_pre(); first_cpu = cpumask_first(cpu_online_mask); /* * We take down all of the non-boot CPUs in one shot to avoid races @@ -1078,6 +1089,7 @@ void enable_nonboot_cpus(void) return; /* Allow everyone to use the CPU hotplug again */ cpu_maps_update_begin(); + arch_enable_nonboot_cpus_pre(); WARN_ON(--cpu_hotplug_disabled < 0); if (cpumask_empty(frozen_cpus)) goto out; -- 2.7.4