public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpu/hotplug: merge cpuhp_bp_states&cpuhp_ap_states as cpuhp_hp_states
@ 2017-12-01 13:50 Lai Jiangshan
  2017-12-03  6:33 ` Paul E. McKenney
  2018-03-14 15:42 ` [tip:smp/hotplug] cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states tip-bot for Lai Jiangshan
  0 siblings, 2 replies; 4+ messages in thread
From: Lai Jiangshan @ 2017-12-01 13:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lai Jiangshan, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Sebastian Andrzej Siewior, Paul E. McKenney, Boris Ostrovsky

cpuhp_bp_states&cpuhp_ap_states have diffent set of steps
without any conflicting configed steps, so that they can
be merged.

The original `[CPUHP_BRINGUP_CPU] = { },` is removed, because
the new cpuhp_hp_states has CPUHP_ONLINE index which is larger
than CPUHP_BRINGUP_CPU.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
---
 kernel/cpu.c | 42 +++++++++++++++---------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 7891aecc6aec..c27963066333 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -124,8 +124,7 @@ struct cpuhp_step {
 };
 
 static DEFINE_MUTEX(cpuhp_state_mutex);
-static struct cpuhp_step cpuhp_bp_states[];
-static struct cpuhp_step cpuhp_ap_states[];
+static struct cpuhp_step cpuhp_hp_states[];
 
 static bool cpuhp_is_ap_state(enum cpuhp_state state)
 {
@@ -138,10 +137,7 @@ static bool cpuhp_is_ap_state(enum cpuhp_state state)
 
 static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)
 {
-	struct cpuhp_step *sp;
-
-	sp = cpuhp_is_ap_state(state) ? cpuhp_ap_states : cpuhp_bp_states;
-	return sp + state;
+	return cpuhp_hp_states + state;
 }
 
 /**
@@ -1224,7 +1220,7 @@ int __boot_cpu_id;
 #endif /* CONFIG_SMP */
 
 /* Boot processor state steps */
-static struct cpuhp_step cpuhp_bp_states[] = {
+static struct cpuhp_step cpuhp_hp_states[] = {
 	[CPUHP_OFFLINE] = {
 		.name			= "offline",
 		.startup.single		= NULL,
@@ -1289,24 +1285,6 @@ static struct cpuhp_step cpuhp_bp_states[] = {
 		.teardown.single	= NULL,
 		.cant_stop		= true,
 	},
-	/*
-	 * Handled on controll processor until the plugged processor manages
-	 * this itself.
-	 */
-	[CPUHP_TEARDOWN_CPU] = {
-		.name			= "cpu:teardown",
-		.startup.single		= NULL,
-		.teardown.single	= takedown_cpu,
-		.cant_stop		= true,
-	},
-#else
-	[CPUHP_BRINGUP_CPU] = { },
-#endif
-};
-
-/* Application processor state steps */
-static struct cpuhp_step cpuhp_ap_states[] = {
-#ifdef CONFIG_SMP
 	/* Final state before CPU kills itself */
 	[CPUHP_AP_IDLE_DEAD] = {
 		.name			= "idle:dead",
@@ -1340,6 +1318,16 @@ static struct cpuhp_step cpuhp_ap_states[] = {
 	[CPUHP_AP_ONLINE] = {
 		.name			= "ap:online",
 	},
+	/*
+	 * Handled on controll processor until the plugged processor manages
+	 * this itself.
+	 */
+	[CPUHP_TEARDOWN_CPU] = {
+		.name			= "cpu:teardown",
+		.startup.single		= NULL,
+		.teardown.single	= takedown_cpu,
+		.cant_stop		= true,
+	},
 	/* Handle smpboot threads park/unpark */
 	[CPUHP_AP_SMPBOOT_THREADS] = {
 		.name			= "smpboot/threads:online",
@@ -1408,11 +1396,11 @@ static int cpuhp_reserve_state(enum cpuhp_state state)
 
 	switch (state) {
 	case CPUHP_AP_ONLINE_DYN:
-		step = cpuhp_ap_states + CPUHP_AP_ONLINE_DYN;
+		step = cpuhp_hp_states + CPUHP_AP_ONLINE_DYN;
 		end = CPUHP_AP_ONLINE_DYN_END;
 		break;
 	case CPUHP_BP_PREPARE_DYN:
-		step = cpuhp_bp_states + CPUHP_BP_PREPARE_DYN;
+		step = cpuhp_hp_states + CPUHP_BP_PREPARE_DYN;
 		end = CPUHP_BP_PREPARE_DYN_END;
 		break;
 	default:
-- 
2.13.6 (Apple Git-96)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpu/hotplug: merge cpuhp_bp_states&cpuhp_ap_states as cpuhp_hp_states
  2017-12-01 13:50 [PATCH] cpu/hotplug: merge cpuhp_bp_states&cpuhp_ap_states as cpuhp_hp_states Lai Jiangshan
@ 2017-12-03  6:33 ` Paul E. McKenney
  2017-12-03 13:22   ` Lai Jiangshan
  2018-03-14 15:42 ` [tip:smp/hotplug] cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states tip-bot for Lai Jiangshan
  1 sibling, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2017-12-03  6:33 UTC (permalink / raw)
  To: Lai Jiangshan
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Sebastian Andrzej Siewior, Boris Ostrovsky

On Fri, Dec 01, 2017 at 09:50:05PM +0800, Lai Jiangshan wrote:
> cpuhp_bp_states&cpuhp_ap_states have diffent set of steps
> without any conflicting configed steps, so that they can
> be merged.
> 
> The original `[CPUHP_BRINGUP_CPU] = { },` is removed, because
> the new cpuhp_hp_states has CPUHP_ONLINE index which is larger
> than CPUHP_BRINGUP_CPU.
> 
> Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>

Hello, Lai,

What is this against?  I tried testing it, but it doesn't apply to
v4.15-rc1 or v4.14.

							Thanx, Paul

> ---
>  kernel/cpu.c | 42 +++++++++++++++---------------------------
>  1 file changed, 15 insertions(+), 27 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 7891aecc6aec..c27963066333 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -124,8 +124,7 @@ struct cpuhp_step {
>  };
> 
>  static DEFINE_MUTEX(cpuhp_state_mutex);
> -static struct cpuhp_step cpuhp_bp_states[];
> -static struct cpuhp_step cpuhp_ap_states[];
> +static struct cpuhp_step cpuhp_hp_states[];
> 
>  static bool cpuhp_is_ap_state(enum cpuhp_state state)
>  {
> @@ -138,10 +137,7 @@ static bool cpuhp_is_ap_state(enum cpuhp_state state)
> 
>  static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)
>  {
> -	struct cpuhp_step *sp;
> -
> -	sp = cpuhp_is_ap_state(state) ? cpuhp_ap_states : cpuhp_bp_states;
> -	return sp + state;
> +	return cpuhp_hp_states + state;
>  }
> 
>  /**
> @@ -1224,7 +1220,7 @@ int __boot_cpu_id;
>  #endif /* CONFIG_SMP */
> 
>  /* Boot processor state steps */
> -static struct cpuhp_step cpuhp_bp_states[] = {
> +static struct cpuhp_step cpuhp_hp_states[] = {
>  	[CPUHP_OFFLINE] = {
>  		.name			= "offline",
>  		.startup.single		= NULL,
> @@ -1289,24 +1285,6 @@ static struct cpuhp_step cpuhp_bp_states[] = {
>  		.teardown.single	= NULL,
>  		.cant_stop		= true,
>  	},
> -	/*
> -	 * Handled on controll processor until the plugged processor manages
> -	 * this itself.
> -	 */
> -	[CPUHP_TEARDOWN_CPU] = {
> -		.name			= "cpu:teardown",
> -		.startup.single		= NULL,
> -		.teardown.single	= takedown_cpu,
> -		.cant_stop		= true,
> -	},
> -#else
> -	[CPUHP_BRINGUP_CPU] = { },
> -#endif
> -};
> -
> -/* Application processor state steps */
> -static struct cpuhp_step cpuhp_ap_states[] = {
> -#ifdef CONFIG_SMP
>  	/* Final state before CPU kills itself */
>  	[CPUHP_AP_IDLE_DEAD] = {
>  		.name			= "idle:dead",
> @@ -1340,6 +1318,16 @@ static struct cpuhp_step cpuhp_ap_states[] = {
>  	[CPUHP_AP_ONLINE] = {
>  		.name			= "ap:online",
>  	},
> +	/*
> +	 * Handled on controll processor until the plugged processor manages
> +	 * this itself.
> +	 */
> +	[CPUHP_TEARDOWN_CPU] = {
> +		.name			= "cpu:teardown",
> +		.startup.single		= NULL,
> +		.teardown.single	= takedown_cpu,
> +		.cant_stop		= true,
> +	},
>  	/* Handle smpboot threads park/unpark */
>  	[CPUHP_AP_SMPBOOT_THREADS] = {
>  		.name			= "smpboot/threads:online",
> @@ -1408,11 +1396,11 @@ static int cpuhp_reserve_state(enum cpuhp_state state)
> 
>  	switch (state) {
>  	case CPUHP_AP_ONLINE_DYN:
> -		step = cpuhp_ap_states + CPUHP_AP_ONLINE_DYN;
> +		step = cpuhp_hp_states + CPUHP_AP_ONLINE_DYN;
>  		end = CPUHP_AP_ONLINE_DYN_END;
>  		break;
>  	case CPUHP_BP_PREPARE_DYN:
> -		step = cpuhp_bp_states + CPUHP_BP_PREPARE_DYN;
> +		step = cpuhp_hp_states + CPUHP_BP_PREPARE_DYN;
>  		end = CPUHP_BP_PREPARE_DYN_END;
>  		break;
>  	default:
> -- 
> 2.13.6 (Apple Git-96)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpu/hotplug: merge cpuhp_bp_states&cpuhp_ap_states as cpuhp_hp_states
  2017-12-03  6:33 ` Paul E. McKenney
@ 2017-12-03 13:22   ` Lai Jiangshan
  0 siblings, 0 replies; 4+ messages in thread
From: Lai Jiangshan @ 2017-12-03 13:22 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: LKML, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Sebastian Andrzej Siewior, Boris Ostrovsky

On Sun, Dec 3, 2017 at 2:33 PM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
> On Fri, Dec 01, 2017 at 09:50:05PM +0800, Lai Jiangshan wrote:
>> cpuhp_bp_states&cpuhp_ap_states have diffent set of steps
>> without any conflicting configed steps, so that they can
>> be merged.
>>
>> The original `[CPUHP_BRINGUP_CPU] = { },` is removed, because
>> the new cpuhp_hp_states has CPUHP_ONLINE index which is larger
>> than CPUHP_BRINGUP_CPU.
>>
>> Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
>
> Hello, Lai,
>
> What is this against?  I tried testing it, but it doesn't apply to
> v4.15-rc1 or v4.14.


Hello, Paul,

It assumes my previous patch applied.
"smp/hotplug: move step CPUHP_AP_SMPCFD_DYING to the correct place"

https://www.spinics.net/lists/linux-tip-commits/msg41542.html

Thanks,
Lai

>
>                                                         Thanx, Paul
>
>> ---
>>  kernel/cpu.c | 42 +++++++++++++++---------------------------
>>  1 file changed, 15 insertions(+), 27 deletions(-)
>>
>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> index 7891aecc6aec..c27963066333 100644
>> --- a/kernel/cpu.c
>> +++ b/kernel/cpu.c
>> @@ -124,8 +124,7 @@ struct cpuhp_step {
>>  };
>>
>>  static DEFINE_MUTEX(cpuhp_state_mutex);
>> -static struct cpuhp_step cpuhp_bp_states[];
>> -static struct cpuhp_step cpuhp_ap_states[];
>> +static struct cpuhp_step cpuhp_hp_states[];
>>
>>  static bool cpuhp_is_ap_state(enum cpuhp_state state)
>>  {
>> @@ -138,10 +137,7 @@ static bool cpuhp_is_ap_state(enum cpuhp_state state)
>>
>>  static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)
>>  {
>> -     struct cpuhp_step *sp;
>> -
>> -     sp = cpuhp_is_ap_state(state) ? cpuhp_ap_states : cpuhp_bp_states;
>> -     return sp + state;
>> +     return cpuhp_hp_states + state;
>>  }
>>
>>  /**
>> @@ -1224,7 +1220,7 @@ int __boot_cpu_id;
>>  #endif /* CONFIG_SMP */
>>
>>  /* Boot processor state steps */
>> -static struct cpuhp_step cpuhp_bp_states[] = {
>> +static struct cpuhp_step cpuhp_hp_states[] = {
>>       [CPUHP_OFFLINE] = {
>>               .name                   = "offline",
>>               .startup.single         = NULL,
>> @@ -1289,24 +1285,6 @@ static struct cpuhp_step cpuhp_bp_states[] = {
>>               .teardown.single        = NULL,
>>               .cant_stop              = true,
>>       },
>> -     /*
>> -      * Handled on controll processor until the plugged processor manages
>> -      * this itself.
>> -      */
>> -     [CPUHP_TEARDOWN_CPU] = {
>> -             .name                   = "cpu:teardown",
>> -             .startup.single         = NULL,
>> -             .teardown.single        = takedown_cpu,
>> -             .cant_stop              = true,
>> -     },
>> -#else
>> -     [CPUHP_BRINGUP_CPU] = { },
>> -#endif
>> -};
>> -
>> -/* Application processor state steps */
>> -static struct cpuhp_step cpuhp_ap_states[] = {
>> -#ifdef CONFIG_SMP
>>       /* Final state before CPU kills itself */
>>       [CPUHP_AP_IDLE_DEAD] = {
>>               .name                   = "idle:dead",
>> @@ -1340,6 +1318,16 @@ static struct cpuhp_step cpuhp_ap_states[] = {
>>       [CPUHP_AP_ONLINE] = {
>>               .name                   = "ap:online",
>>       },
>> +     /*
>> +      * Handled on controll processor until the plugged processor manages
>> +      * this itself.
>> +      */
>> +     [CPUHP_TEARDOWN_CPU] = {
>> +             .name                   = "cpu:teardown",
>> +             .startup.single         = NULL,
>> +             .teardown.single        = takedown_cpu,
>> +             .cant_stop              = true,
>> +     },
>>       /* Handle smpboot threads park/unpark */
>>       [CPUHP_AP_SMPBOOT_THREADS] = {
>>               .name                   = "smpboot/threads:online",
>> @@ -1408,11 +1396,11 @@ static int cpuhp_reserve_state(enum cpuhp_state state)
>>
>>       switch (state) {
>>       case CPUHP_AP_ONLINE_DYN:
>> -             step = cpuhp_ap_states + CPUHP_AP_ONLINE_DYN;
>> +             step = cpuhp_hp_states + CPUHP_AP_ONLINE_DYN;
>>               end = CPUHP_AP_ONLINE_DYN_END;
>>               break;
>>       case CPUHP_BP_PREPARE_DYN:
>> -             step = cpuhp_bp_states + CPUHP_BP_PREPARE_DYN;
>> +             step = cpuhp_hp_states + CPUHP_BP_PREPARE_DYN;
>>               end = CPUHP_BP_PREPARE_DYN_END;
>>               break;
>>       default:
>> --
>> 2.13.6 (Apple Git-96)
>>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:smp/hotplug] cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states
  2017-12-01 13:50 [PATCH] cpu/hotplug: merge cpuhp_bp_states&cpuhp_ap_states as cpuhp_hp_states Lai Jiangshan
  2017-12-03  6:33 ` Paul E. McKenney
@ 2018-03-14 15:42 ` tip-bot for Lai Jiangshan
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Lai Jiangshan @ 2018-03-14 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: boris.ostrovsky, linux-kernel, bigeasy, hpa, tglx, peterz,
	paulmck, mingo, jiangshanlai

Commit-ID:  17a2f1ced0280068897990b0dd25ce70555b8ac7
Gitweb:     https://git.kernel.org/tip/17a2f1ced0280068897990b0dd25ce70555b8ac7
Author:     Lai Jiangshan <jiangshanlai@gmail.com>
AuthorDate: Fri, 1 Dec 2017 21:50:05 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 14 Mar 2018 16:38:43 +0100

cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states

cpuhp_bp_states and cpuhp_ap_states have different set of steps without any
conflicting steps, so that they can be merged.

The original `[CPUHP_BRINGUP_CPU] = { },` is removed, because the new
cpuhp_hp_states has CPUHP_ONLINE index which is larger than
CPUHP_BRINGUP_CPU.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Link: https://lkml.kernel.org/r/20171201135008.21633-1-jiangshanlai@gmail.com

---
 kernel/cpu.c | 42 +++++++++++++++---------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 53f7dc65f9a3..a1860d42aacf 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -124,8 +124,7 @@ struct cpuhp_step {
 };
 
 static DEFINE_MUTEX(cpuhp_state_mutex);
-static struct cpuhp_step cpuhp_bp_states[];
-static struct cpuhp_step cpuhp_ap_states[];
+static struct cpuhp_step cpuhp_hp_states[];
 
 static bool cpuhp_is_ap_state(enum cpuhp_state state)
 {
@@ -138,10 +137,7 @@ static bool cpuhp_is_ap_state(enum cpuhp_state state)
 
 static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)
 {
-	struct cpuhp_step *sp;
-
-	sp = cpuhp_is_ap_state(state) ? cpuhp_ap_states : cpuhp_bp_states;
-	return sp + state;
+	return cpuhp_hp_states + state;
 }
 
 /**
@@ -1224,7 +1220,7 @@ int __boot_cpu_id;
 #endif /* CONFIG_SMP */
 
 /* Boot processor state steps */
-static struct cpuhp_step cpuhp_bp_states[] = {
+static struct cpuhp_step cpuhp_hp_states[] = {
 	[CPUHP_OFFLINE] = {
 		.name			= "offline",
 		.startup.single		= NULL,
@@ -1289,24 +1285,6 @@ static struct cpuhp_step cpuhp_bp_states[] = {
 		.teardown.single	= NULL,
 		.cant_stop		= true,
 	},
-	/*
-	 * Handled on controll processor until the plugged processor manages
-	 * this itself.
-	 */
-	[CPUHP_TEARDOWN_CPU] = {
-		.name			= "cpu:teardown",
-		.startup.single		= NULL,
-		.teardown.single	= takedown_cpu,
-		.cant_stop		= true,
-	},
-#else
-	[CPUHP_BRINGUP_CPU] = { },
-#endif
-};
-
-/* Application processor state steps */
-static struct cpuhp_step cpuhp_ap_states[] = {
-#ifdef CONFIG_SMP
 	/* Final state before CPU kills itself */
 	[CPUHP_AP_IDLE_DEAD] = {
 		.name			= "idle:dead",
@@ -1340,6 +1318,16 @@ static struct cpuhp_step cpuhp_ap_states[] = {
 	[CPUHP_AP_ONLINE] = {
 		.name			= "ap:online",
 	},
+	/*
+	 * Handled on controll processor until the plugged processor manages
+	 * this itself.
+	 */
+	[CPUHP_TEARDOWN_CPU] = {
+		.name			= "cpu:teardown",
+		.startup.single		= NULL,
+		.teardown.single	= takedown_cpu,
+		.cant_stop		= true,
+	},
 	/* Handle smpboot threads park/unpark */
 	[CPUHP_AP_SMPBOOT_THREADS] = {
 		.name			= "smpboot/threads:online",
@@ -1408,11 +1396,11 @@ static int cpuhp_reserve_state(enum cpuhp_state state)
 
 	switch (state) {
 	case CPUHP_AP_ONLINE_DYN:
-		step = cpuhp_ap_states + CPUHP_AP_ONLINE_DYN;
+		step = cpuhp_hp_states + CPUHP_AP_ONLINE_DYN;
 		end = CPUHP_AP_ONLINE_DYN_END;
 		break;
 	case CPUHP_BP_PREPARE_DYN:
-		step = cpuhp_bp_states + CPUHP_BP_PREPARE_DYN;
+		step = cpuhp_hp_states + CPUHP_BP_PREPARE_DYN;
 		end = CPUHP_BP_PREPARE_DYN_END;
 		break;
 	default:

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-14 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-01 13:50 [PATCH] cpu/hotplug: merge cpuhp_bp_states&cpuhp_ap_states as cpuhp_hp_states Lai Jiangshan
2017-12-03  6:33 ` Paul E. McKenney
2017-12-03 13:22   ` Lai Jiangshan
2018-03-14 15:42 ` [tip:smp/hotplug] cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states tip-bot for Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox