Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526837

[tip:smp/hotplug] arm/bL_switcher: Convert to hotplug state machine

From tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:smp/hotplug] arm/bL_switcher: Convert to hotplug state machine
Date 2016-11-21 17:00 +0100
Message-ID <sFZaF-333-23@gated-at.bofh.it> (permalink)
References <sEzLk-4lB-59@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  5175233eccc753a9d660e08b75084de250f032ad
Gitweb:     http://git.kernel.org/tip/5175233eccc753a9d660e08b75084de250f032ad
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Thu, 17 Nov 2016 19:35:35 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 21 Nov 2016 16:37:08 +0100

arm/bL_switcher: Convert to hotplug state machine

Install the callbacks via the state machine.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: rt@linuxtronix.de
Cc: linux-arm-kernel@lists.infradead.org
Cc: Russell King <linux@armlinux.org.uk>
Link: http://lkml.kernel.org/r/20161117183541.8588-15-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/arm/common/bL_switcher.c | 34 ++++++++++++++++++++--------------
 include/linux/cpuhotplug.h    |  1 +
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index 37dc0fe..4673001 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -757,19 +757,18 @@ EXPORT_SYMBOL_GPL(bL_switcher_put_enabled);
  * while the switcher is active.
  * We're just not ready to deal with that given the trickery involved.
  */
-static int bL_switcher_hotplug_callback(struct notifier_block *nfb,
-					unsigned long action, void *hcpu)
+static int bL_switcher_cpu_pre(unsigned int cpu)
 {
-	if (bL_switcher_active) {
-		int pairing = bL_switcher_cpu_pairing[(unsigned long)hcpu];
-		switch (action & 0xf) {
-		case CPU_UP_PREPARE:
-		case CPU_DOWN_PREPARE:
-			if (pairing == -1)
-				return NOTIFY_BAD;
-		}
-	}
-	return NOTIFY_DONE;
+	int pairing;
+
+	if (!bL_switcher_active)
+		return 0;
+
+	pairing = bL_switcher_cpu_pairing[cpu];
+
+	if (pairing == -1)
+		return -EINVAL;
+	return 0;
 }
 
 static bool no_bL_switcher;
@@ -782,8 +781,15 @@ static int __init bL_switcher_init(void)
 	if (!mcpm_is_available())
 		return -ENODEV;
 
-	cpu_notifier(bL_switcher_hotplug_callback, 0);
-
+	cpuhp_setup_state_nocalls(CPUHP_ARM_BL_PREPARE, "arm/bl:prepare",
+				  bL_switcher_cpu_pre, NULL);
+	ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "arm/bl:predown",
+					NULL, bL_switcher_cpu_pre);
+	if (ret < 0) {
+		cpuhp_remove_state_nocalls(CPUHP_ARM_BL_PREPARE);
+		pr_err("bL_switcher: Failed to allocate a hotplug state\n");
+		return ret;
+	}
 	if (!no_bL_switcher) {
 		ret = bL_switcher_enable();
 		if (ret)
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 12bbcf3..e3771fb 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -61,6 +61,7 @@ enum cpuhp_state {
 	CPUHP_NET_FLOW_PREPARE,
 	CPUHP_TOPOLOGY_PREPARE,
 	CPUHP_NET_IUCV_PREPARE,
+	CPUHP_ARM_BL_PREPARE,
 	CPUHP_TIMERS_DEAD,
 	CPUHP_NOTF_ERR_INJ_PREPARE,
 	CPUHP_MIPS_SOC_PREPARE,

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

cpu hotplug: convert more drivers (batch #5) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
  [PATCH 12/20] net/iucv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
    [tip:smp/hotplug] net/iucv: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
    [tip:smp/hotplug] net/iucv: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-23 00:20 +0100
    Re: [PATCH 12/20] net/iucv: Convert to hotplug state machine Ursula Braun <ubraun@linux.vnet.ibm.com> - 2016-11-23 20:40 +0100
      Re: [PATCH 12/20] net/iucv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-24 10:20 +0100
        [PATCH 12/20 v2] net/iucv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-24 15:20 +0100
          [PATCH] net/iucv: use explicit clean up labels in iucv_init() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-24 17:20 +0100
            [tip:smp/hotplug] net/iucv: Use explicit clean up labels in  iucv_init() tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-24 21:00 +0100
  [PATCH 09/20] powercap/intel rapl: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
    [tip:smp/hotplug] powercap/intel rapl: Convert to hotplug state  machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
  [PATCH 19/20] x86/oprofile/nmi: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
    [tip:smp/hotplug] x86/oprofile/nmi: Convert to hotplug state  machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
    [tip:smp/hotplug] x86/oprofile/nmi: Convert to hotplug state  machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
  [PATCH 14/20] arm/bL_switcher: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
    [tip:smp/hotplug] arm/bL_switcher: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
    [tip:smp/hotplug] arm/bL_switcher: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
  [PATCH 13/20] sched/nohz: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
    [tip:smp/hotplug] sched/nohz: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
    [tip:smp/hotplug] sched/nohz: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-23 00:20 +0100
  [PATCH 16/20] powerpc/sysfs: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
    [tip:smp/hotplug] powerpc/sysfs: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
    [tip:smp/hotplug] powerpc/sysfs: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
  [PATCH 10/20] powercap/intel_rapl: Cleanup duplicated init code Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    [tip:smp/hotplug] powercap/intel_rapl: Cleanup duplicated init code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-11-21 17:00 +0100
  [PATCH 01/20] x86/mce/therm_throt: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    [tip:smp/hotplug] x86/mce/therm_throt: Convert to hotplug state  machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 16:50 +0100
    [tip:smp/hotplug] x86/mce/therm_throt: Convert to hotplug state  machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
  [PATCH 07/20] pci/xgene-msi: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    [tip:smp/hotplug] PCI/xgene-msi: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 16:50 +0100
    [tip:smp/hotplug] PCI/xgene-msi: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-23 00:20 +0100
  [PATCH 06/20] hwmon/via-cputemp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    [PATCH 06/20 v2] hwmon/via-cputemp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-18 16:20 +0100
    Re: [PATCH 06/20] hwmon/via-cputemp: Convert to hotplug state machine Guenter Roeck <linux@roeck-us.net> - 2016-11-23 16:40 +0100
  [PATCH 05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Guenter Roeck <linux@roeck-us.net> - 2016-11-19 18:30 +0100
      Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-20 00:00 +0100
        Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Guenter Roeck <linux@roeck-us.net> - 2016-11-20 05:00 +0100
          Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-20 21:40 +0100
  [PATCH 08/20] powercap/intel_rapl: Add missing domain data update on hotplug Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    [tip:smp/hotplug] powercap/intel_rapl: Add missing domain data  update on hotplug tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-11-21 16:50 +0100
  [PATCH 03/20] x86/msr: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
    [tip:smp/hotplug] x86/msr: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 16:50 +0100
    [tip:smp/hotplug] x86/msr: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100

csiph-web