mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	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
			
			
This commit is contained in:
		
							parent
							
								
									fc6eabbbf8
								
							
						
					
					
						commit
						17a2f1ced0
					
				
					 1 changed files with 15 additions and 27 deletions
				
			
		
							
								
								
									
										42
									
								
								kernel/cpu.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								kernel/cpu.c
									
									
									
									
									
								
							|  | @ -124,8 +124,7 @@ struct cpuhp_step { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static DEFINE_MUTEX(cpuhp_state_mutex); | static DEFINE_MUTEX(cpuhp_state_mutex); | ||||||
| static struct cpuhp_step cpuhp_bp_states[]; | static struct cpuhp_step cpuhp_hp_states[]; | ||||||
| static struct cpuhp_step cpuhp_ap_states[]; |  | ||||||
| 
 | 
 | ||||||
| static bool cpuhp_is_ap_state(enum cpuhp_state state) | 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) | static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state) | ||||||
| { | { | ||||||
| 	struct cpuhp_step *sp; | 	return cpuhp_hp_states + state; | ||||||
| 
 |  | ||||||
| 	sp = cpuhp_is_ap_state(state) ? cpuhp_ap_states : cpuhp_bp_states; |  | ||||||
| 	return sp + state; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | @ -1224,7 +1220,7 @@ int __boot_cpu_id; | ||||||
| #endif /* CONFIG_SMP */ | #endif /* CONFIG_SMP */ | ||||||
| 
 | 
 | ||||||
| /* Boot processor state steps */ | /* Boot processor state steps */ | ||||||
| static struct cpuhp_step cpuhp_bp_states[] = { | static struct cpuhp_step cpuhp_hp_states[] = { | ||||||
| 	[CPUHP_OFFLINE] = { | 	[CPUHP_OFFLINE] = { | ||||||
| 		.name			= "offline", | 		.name			= "offline", | ||||||
| 		.startup.single		= NULL, | 		.startup.single		= NULL, | ||||||
|  | @ -1289,24 +1285,6 @@ static struct cpuhp_step cpuhp_bp_states[] = { | ||||||
| 		.teardown.single	= NULL, | 		.teardown.single	= NULL, | ||||||
| 		.cant_stop		= true, | 		.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 */ | 	/* Final state before CPU kills itself */ | ||||||
| 	[CPUHP_AP_IDLE_DEAD] = { | 	[CPUHP_AP_IDLE_DEAD] = { | ||||||
| 		.name			= "idle:dead", | 		.name			= "idle:dead", | ||||||
|  | @ -1340,6 +1318,16 @@ static struct cpuhp_step cpuhp_ap_states[] = { | ||||||
| 	[CPUHP_AP_ONLINE] = { | 	[CPUHP_AP_ONLINE] = { | ||||||
| 		.name			= "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 */ | 	/* Handle smpboot threads park/unpark */ | ||||||
| 	[CPUHP_AP_SMPBOOT_THREADS] = { | 	[CPUHP_AP_SMPBOOT_THREADS] = { | ||||||
| 		.name			= "smpboot/threads:online", | 		.name			= "smpboot/threads:online", | ||||||
|  | @ -1408,11 +1396,11 @@ static int cpuhp_reserve_state(enum cpuhp_state state) | ||||||
| 
 | 
 | ||||||
| 	switch (state) { | 	switch (state) { | ||||||
| 	case CPUHP_AP_ONLINE_DYN: | 	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; | 		end = CPUHP_AP_ONLINE_DYN_END; | ||||||
| 		break; | 		break; | ||||||
| 	case CPUHP_BP_PREPARE_DYN: | 	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; | 		end = CPUHP_BP_PREPARE_DYN_END; | ||||||
| 		break; | 		break; | ||||||
| 	default: | 	default: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Lai Jiangshan
						Lai Jiangshan