[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20170925161837.oj52hmqg2w57ha6f@hirez.programming.kicks-ass.net>
Date: Mon, 25 Sep 2017 18:18:37 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: tglx@...utronix.de, linux-kernel@...r.kernel.org, mingo@...nel.org,
hpa@...or.com
Cc: linux-tip-commits@...r.kernel.org
Subject: Re: [tip:smp/urgent] smp/hotplug: Differentiate the AP completion
between up and down
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)
{
Powered by blists - more mailing lists