Re: [tip:smp/urgent] smp/hotplug: Differentiate the AP completion between up and down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 25, 2017 at 07:29:42AM -0700, tip-bot for Peter Zijlstra wrote:

> @@ -90,6 +92,18 @@ static void inline cpuhp_lock_release(bool bringup) { }
>  
>  #endif
>  
> +static inline void wait_for_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
> +{
> +	struct completion *done = bringup ? &st->done_up : &st->done_down;
> +	wait_for_completion(done);
> +}
> +
> +static inline void complete_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
> +{
> +	struct completion *done = bringup ? &st->done_up : &st->done_down;
> +	complete(done);
> +}


This wants something like this on top to build on !SMP and SMP+!HOTPLUG
without issue.

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -93,18 +93,6 @@ static void inline cpuhp_lock_release(bo
 
 #endif
 
-static inline void wait_for_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
-{
-	struct completion *done = bringup ? &st->done_up : &st->done_down;
-	wait_for_completion(done);
-}
-
-static inline void complete_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
-{
-	struct completion *done = bringup ? &st->done_up : &st->done_down;
-	complete(done);
-}
-
 /**
  * cpuhp_step - Hotplug state machine step
  * @name:	Name of the step
@@ -145,14 +133,6 @@ static bool cpuhp_is_ap_state(enum cpuhp
 	return state > CPUHP_BRINGUP_CPU && state != CPUHP_TEARDOWN_CPU;
 }
 
-/*
- * The former STARTING/DYING states, ran with IRQs disabled and must not fail.
- */
-static bool cpuhp_is_atomic_state(enum cpuhp_state state)
-{
-	return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE;
-}
-
 static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)
 {
 	struct cpuhp_step *sp;
@@ -247,6 +227,26 @@ static int cpuhp_invoke_callback(unsigne
 }
 
 #ifdef CONFIG_SMP
+static inline void wait_for_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
+{
+	struct completion *done = bringup ? &st->done_up : &st->done_down;
+	wait_for_completion(done);
+}
+
+static inline void complete_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
+{
+	struct completion *done = bringup ? &st->done_up : &st->done_down;
+	complete(done);
+}
+
+/*
+ * The former STARTING/DYING states, ran with IRQs disabled and must not fail.
+ */
+static bool cpuhp_is_atomic_state(enum cpuhp_state state)
+{
+	return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE;
+}
+
 /* Serializes the updates to cpu_online_mask, cpu_present_mask */
 static DEFINE_MUTEX(cpu_add_remove_lock);
 bool cpuhp_tasks_frozen;
@@ -443,6 +443,7 @@ static int bringup_cpu(unsigned int cpu)
 /*
  * Hotplug state machine related functions
  */
+#ifdef CONFIG_HOTPLUG_CPU
 static void undo_cpu_down(unsigned int cpu, struct cpuhp_cpu_state *st)
 {
 	for (st->state++; st->state < st->target; st->state++) {
@@ -469,6 +470,7 @@ static int cpuhp_down_callbacks(unsigned
 	}
 	return ret;
 }
+#endif
 
 static void undo_cpu_up(unsigned int cpu, struct cpuhp_cpu_state *st)
 {
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux