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


Groups > linux.kernel > #1440599

[patch 32/66] x86/apb_timer: Convert to hotplug state machine

From Anna-Maria Gleixner <anna-maria@linutronix.de>
Newsgroups linux.kernel
Subject [patch 32/66] x86/apb_timer: Convert to hotplug state machine
Date 2016-07-11 14:50 +0200
Message-ID <rTIOU-762-71@gated-at.bofh.it> (permalink)
References <rTIFb-70u-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Install the callbacks via the state machine. There is no setup just one
teardown callback. Remove the silly comment about the workqueue up dependency.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
 arch/x86/kernel/apb_timer.c |   29 ++++++++++-------------------
 include/linux/cpuhotplug.h  |    1 +
 2 files changed, 11 insertions(+), 19 deletions(-)

--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -215,26 +215,18 @@ void apbt_setup_secondary_clock(void)
  * cpu timers during the offline process due to the ordering of notification.
  * the extra interrupt is harmless.
  */
-static int apbt_cpuhp_notify(struct notifier_block *n,
-			     unsigned long action, void *hcpu)
+static int apbt_cpu_dead(unsigned int cpu)
 {
-	unsigned long cpu = (unsigned long)hcpu;
 	struct apbt_dev *adev = &per_cpu(cpu_apbt_dev, cpu);
 
-	switch (action & ~CPU_TASKS_FROZEN) {
-	case CPU_DEAD:
-		dw_apb_clockevent_pause(adev->timer);
-		if (system_state == SYSTEM_RUNNING) {
-			pr_debug("skipping APBT CPU %lu offline\n", cpu);
-		} else {
-			pr_debug("APBT clockevent for cpu %lu offline\n", cpu);
-			dw_apb_clockevent_stop(adev->timer);
-		}
-		break;
-	default:
-		pr_debug("APBT notified %lu, no action\n", action);
+	dw_apb_clockevent_pause(adev->timer);
+	if (system_state == SYSTEM_RUNNING) {
+		pr_debug("skipping APBT CPU %u offline\n", cpu);
+	} else {
+		pr_debug("APBT clockevent for cpu %u offline\n", cpu);
+		dw_apb_clockevent_stop(adev->timer);
 	}
-	return NOTIFY_OK;
+	return 0;
 }
 
 static __init int apbt_late_init(void)
@@ -242,9 +234,8 @@ static __init int apbt_late_init(void)
 	if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT ||
 		!apb_timer_block_enabled)
 		return 0;
-	/* This notifier should be called after workqueue is ready */
-	hotcpu_notifier(apbt_cpuhp_notify, -20);
-	return 0;
+	return cpuhp_setup_state(CPUHP_X86_APB_DEAD, "X86_APB_DEAD", NULL,
+				 apbt_cpu_dead);
 }
 fs_initcall(apbt_late_init);
 #else
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -13,6 +13,7 @@ enum cpuhp_state {
 	CPUHP_PERF_POWER,
 	CPUHP_PERF_SUPERH,
 	CPUHP_X86_HPET_DEAD,
+	CPUHP_X86_APB_DEAD,
 	CPUHP_WORKQUEUE_PREP,
 	CPUHP_POWER_NUMA_PREPARE,
 	CPUHP_NOTIFY_PREPARE,

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


Thread

[patch 00/66] cpuhotplug: Convert all priority notifiers to the state  machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 29/66] powerpc: numa: Convert to hotplug state machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 27/66] workqueue: Convert to state machine callbacks Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
    Re: [patch 27/66] workqueue: Convert to state machine callbacks Ingo Molnar <mingo@kernel.org> - 2016-07-11 16:40 +0200
      Re: [patch 27/66] workqueue: Convert to state machine callbacks Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 17:00 +0200
    Re: [patch 27/66] workqueue: Convert to state machine callbacks Tejun Heo <tj@kernel.org> - 2016-07-12 16:40 +0200
  [patch 37/66] clocksource/arm_arch_timer: Convert to hotplug state  machine. Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 39/66] clocksource/dummy_timer: Convert to hotplug state  machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 32/66] x86/apb_timer: Convert to hotplug state machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 20/66] sh: perf: Convert the hotplug notifiers to state  machine callbacks Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 16/66] blackfin: perf: Convert hotplug notifier to state  machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 11/66] perf/x86/amd/uncore: Convert to hotplug state machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 14/66] perf/x86/intel/cqm: Convert Intel CQM to hotplug state  machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
  [patch 01/66] x86/vdso: Convert to hotplug state machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200
    Re: [patch 01/66] x86/vdso: Convert to hotplug state machine Andy Lutomirski <luto@amacapital.net> - 2016-07-11 21:00 +0200
  [patch 08/66] perf: Convert to hotplug state machine Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-11 14:50 +0200

csiph-web