forked from mirrors/linux
		
	rcu: Standardize explicit CPU-hotplug calls
rcu_report_dead() and rcutree_migrate_callbacks() have their headers in rcupdate.h while those are pure rcutree calls, like the other CPU-hotplug functions. Also rcu_cpu_starting() and rcu_report_dead() have different naming conventions while they mirror each other's effects. Fix the headers and propose a naming that relates both functions and aligns with the prefix of other rcutree CPU-hotplug functions. Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
This commit is contained in:
		
							parent
							
								
									2cb1f6e9a7
								
							
						
					
					
						commit
						448e9f34d9
					
				
					 15 changed files with 33 additions and 26 deletions
				
			
		|  | @ -181,7 +181,7 @@ operations is carried out at several levels: | ||||||
|    of this wait (or series of waits, as the case may be) is to permit a |    of this wait (or series of waits, as the case may be) is to permit a | ||||||
|    concurrent CPU-hotplug operation to complete. |    concurrent CPU-hotplug operation to complete. | ||||||
| #. In the case of RCU-sched, one of the last acts of an outgoing CPU is | #. In the case of RCU-sched, one of the last acts of an outgoing CPU is | ||||||
|    to invoke ``rcu_report_dead()``, which reports a quiescent state for |    to invoke ``rcutree_report_cpu_dead()``, which reports a quiescent state for | ||||||
|    that CPU. However, this is likely paranoia-induced redundancy. |    that CPU. However, this is likely paranoia-induced redundancy. | ||||||
| 
 | 
 | ||||||
| +-----------------------------------------------------------------------+ | +-----------------------------------------------------------------------+ | ||||||
|  |  | ||||||
|  | @ -1135,7 +1135,7 @@ | ||||||
|        font-weight="bold" |        font-weight="bold" | ||||||
|        font-size="192" |        font-size="192" | ||||||
|        id="text202-7-5-3-27-6-5" |        id="text202-7-5-3-27-6-5" | ||||||
|        style="font-size:192px;font-style:normal;font-weight:bold;text-anchor:start;fill:#000000;stroke-width:0.025in;font-family:Courier">rcu_report_dead()</text> |        style="font-size:192px;font-style:normal;font-weight:bold;text-anchor:start;fill:#000000;stroke-width:0.025in;font-family:Courier">rcutree_report_cpu_dead()</text> | ||||||
|     <text |     <text | ||||||
|        xml:space="preserve" |        xml:space="preserve" | ||||||
|        x="3745.7725" |        x="3745.7725" | ||||||
|  | @ -1256,7 +1256,7 @@ | ||||||
|        font-style="normal" |        font-style="normal" | ||||||
|        y="3679.27" |        y="3679.27" | ||||||
|        x="-3804.9949" |        x="-3804.9949" | ||||||
|        xml:space="preserve">rcu_cpu_starting()</text> |        xml:space="preserve">rcutree_report_cpu_starting()</text> | ||||||
|     <g |     <g | ||||||
|        style="fill:none;stroke-width:0.025in" |        style="fill:none;stroke-width:0.025in" | ||||||
|        id="g3107-7-5-0" |        id="g3107-7-5-0" | ||||||
|  |  | ||||||
| Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB | 
|  | @ -3274,7 +3274,7 @@ | ||||||
|          font-weight="bold" |          font-weight="bold" | ||||||
|          font-size="192" |          font-size="192" | ||||||
|          id="text202-7-5-3-27-6-5" |          id="text202-7-5-3-27-6-5" | ||||||
|          style="font-size:192px;font-style:normal;font-weight:bold;text-anchor:start;fill:#000000;stroke-width:0.025in;font-family:Courier">rcu_report_dead()</text> |          style="font-size:192px;font-style:normal;font-weight:bold;text-anchor:start;fill:#000000;stroke-width:0.025in;font-family:Courier">rcutree_report_cpu_dead()</text> | ||||||
|       <text |       <text | ||||||
|          xml:space="preserve" |          xml:space="preserve" | ||||||
|          x="3745.7725" |          x="3745.7725" | ||||||
|  | @ -3395,7 +3395,7 @@ | ||||||
|          font-style="normal" |          font-style="normal" | ||||||
|          y="3679.27" |          y="3679.27" | ||||||
|          x="-3804.9949" |          x="-3804.9949" | ||||||
|          xml:space="preserve">rcu_cpu_starting()</text> |          xml:space="preserve">rcutree_report_cpu_starting()</text> | ||||||
|       <g |       <g | ||||||
|          style="fill:none;stroke-width:0.025in" |          style="fill:none;stroke-width:0.025in" | ||||||
|          id="g3107-7-5-0" |          id="g3107-7-5-0" | ||||||
|  |  | ||||||
| Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 209 KiB | 
|  | @ -607,7 +607,7 @@ | ||||||
|        font-weight="bold" |        font-weight="bold" | ||||||
|        font-size="192" |        font-size="192" | ||||||
|        id="text202-7-5-3-27-6" |        id="text202-7-5-3-27-6" | ||||||
|        style="font-size:192px;font-style:normal;font-weight:bold;text-anchor:start;fill:#000000;stroke-width:0.025in;font-family:Courier">rcu_report_dead()</text> |        style="font-size:192px;font-style:normal;font-weight:bold;text-anchor:start;fill:#000000;stroke-width:0.025in;font-family:Courier">rcutree_report_cpu_dead()</text> | ||||||
|     <text |     <text | ||||||
|        xml:space="preserve" |        xml:space="preserve" | ||||||
|        x="3745.7725" |        x="3745.7725" | ||||||
|  | @ -728,7 +728,7 @@ | ||||||
|        font-style="normal" |        font-style="normal" | ||||||
|        y="3679.27" |        y="3679.27" | ||||||
|        x="-3804.9949" |        x="-3804.9949" | ||||||
|        xml:space="preserve">rcu_cpu_starting()</text> |        xml:space="preserve">rcutree_report_cpu_starting()</text> | ||||||
|     <g |     <g | ||||||
|        style="fill:none;stroke-width:0.025in" |        style="fill:none;stroke-width:0.025in" | ||||||
|        id="g3107-7-5-0" |        id="g3107-7-5-0" | ||||||
|  |  | ||||||
| Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB | 
|  | @ -1955,12 +1955,12 @@ if offline CPUs block an RCU grace period for too long. | ||||||
| 
 | 
 | ||||||
| An offline CPU's quiescent state will be reported either: | An offline CPU's quiescent state will be reported either: | ||||||
| 
 | 
 | ||||||
| 1.  As the CPU goes offline using RCU's hotplug notifier (rcu_report_dead()). | 1.  As the CPU goes offline using RCU's hotplug notifier (rcutree_report_cpu_dead()). | ||||||
| 2.  When grace period initialization (rcu_gp_init()) detects a | 2.  When grace period initialization (rcu_gp_init()) detects a | ||||||
|     race either with CPU offlining or with a task unblocking on a leaf |     race either with CPU offlining or with a task unblocking on a leaf | ||||||
|     ``rcu_node`` structure whose CPUs are all offline. |     ``rcu_node`` structure whose CPUs are all offline. | ||||||
| 
 | 
 | ||||||
| The CPU-online path (rcu_cpu_starting()) should never need to report | The CPU-online path (rcutree_report_cpu_starting()) should never need to report | ||||||
| a quiescent state for an offline CPU.  However, as a debugging measure, | a quiescent state for an offline CPU.  However, as a debugging measure, | ||||||
| it does emit a warning if a quiescent state was not already reported | it does emit a warning if a quiescent state was not already reported | ||||||
| for that CPU. | for that CPU. | ||||||
|  |  | ||||||
|  | @ -215,7 +215,7 @@ asmlinkage notrace void secondary_start_kernel(void) | ||||||
| 	if (system_uses_irq_prio_masking()) | 	if (system_uses_irq_prio_masking()) | ||||||
| 		init_gic_priority_masking(); | 		init_gic_priority_masking(); | ||||||
| 
 | 
 | ||||||
| 	rcu_cpu_starting(cpu); | 	rcutree_report_cpu_starting(cpu); | ||||||
| 	trace_hardirqs_off(); | 	trace_hardirqs_off(); | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  | @ -401,7 +401,7 @@ void __noreturn cpu_die_early(void) | ||||||
| 
 | 
 | ||||||
| 	/* Mark this CPU absent */ | 	/* Mark this CPU absent */ | ||||||
| 	set_cpu_present(cpu, 0); | 	set_cpu_present(cpu, 0); | ||||||
| 	rcu_report_dead(); | 	rcutree_report_cpu_dead(); | ||||||
| 
 | 
 | ||||||
| 	if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) { | 	if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) { | ||||||
| 		update_cpu_boot_status(CPU_KILL_ME); | 		update_cpu_boot_status(CPU_KILL_ME); | ||||||
|  |  | ||||||
|  | @ -1629,7 +1629,7 @@ void start_secondary(void *unused) | ||||||
| 
 | 
 | ||||||
| 	smp_store_cpu_info(cpu); | 	smp_store_cpu_info(cpu); | ||||||
| 	set_dec(tb_ticks_per_jiffy); | 	set_dec(tb_ticks_per_jiffy); | ||||||
| 	rcu_cpu_starting(cpu); | 	rcutree_report_cpu_starting(cpu); | ||||||
| 	cpu_callin_map[cpu] = 1; | 	cpu_callin_map[cpu] = 1; | ||||||
| 
 | 
 | ||||||
| 	if (smp_ops->setup_cpu) | 	if (smp_ops->setup_cpu) | ||||||
|  |  | ||||||
|  | @ -898,7 +898,7 @@ static void smp_start_secondary(void *cpuvoid) | ||||||
| 	S390_lowcore.restart_flags = 0; | 	S390_lowcore.restart_flags = 0; | ||||||
| 	restore_access_regs(S390_lowcore.access_regs_save_area); | 	restore_access_regs(S390_lowcore.access_regs_save_area); | ||||||
| 	cpu_init(); | 	cpu_init(); | ||||||
| 	rcu_cpu_starting(cpu); | 	rcutree_report_cpu_starting(cpu); | ||||||
| 	init_cpu_timer(); | 	init_cpu_timer(); | ||||||
| 	vtime_init(); | 	vtime_init(); | ||||||
| 	vdso_getcpu_init(); | 	vdso_getcpu_init(); | ||||||
|  |  | ||||||
|  | @ -288,7 +288,7 @@ static void notrace start_secondary(void *unused) | ||||||
| 
 | 
 | ||||||
| 	cpu_init(); | 	cpu_init(); | ||||||
| 	fpu__init_cpu(); | 	fpu__init_cpu(); | ||||||
| 	rcu_cpu_starting(raw_smp_processor_id()); | 	rcutree_report_cpu_starting(raw_smp_processor_id()); | ||||||
| 	x86_cpuinit.early_percpu_clock_init(); | 	x86_cpuinit.early_percpu_clock_init(); | ||||||
| 
 | 
 | ||||||
| 	ap_starting(); | 	ap_starting(); | ||||||
|  |  | ||||||
|  | @ -566,7 +566,7 @@ enum | ||||||
|  * |  * | ||||||
|  * _ RCU: |  * _ RCU: | ||||||
|  * 	1) rcutree_migrate_callbacks() migrates the queue. |  * 	1) rcutree_migrate_callbacks() migrates the queue. | ||||||
|  * 	2) rcu_report_dead() reports the final quiescent states. |  * 	2) rcutree_report_cpu_dead() reports the final quiescent states. | ||||||
|  * |  * | ||||||
|  * _ IRQ_POLL: irq_poll_cpu_dead() migrates the queue |  * _ IRQ_POLL: irq_poll_cpu_dead() migrates the queue | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -122,8 +122,6 @@ static inline void call_rcu_hurry(struct rcu_head *head, rcu_callback_t func) | ||||||
| void rcu_init(void); | void rcu_init(void); | ||||||
| extern int rcu_scheduler_active; | extern int rcu_scheduler_active; | ||||||
| void rcu_sched_clock_irq(int user); | void rcu_sched_clock_irq(int user); | ||||||
| void rcu_report_dead(void); |  | ||||||
| void rcutree_migrate_callbacks(int cpu); |  | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_TASKS_RCU_GENERIC | #ifdef CONFIG_TASKS_RCU_GENERIC | ||||||
| void rcu_init_tasks_generic(void); | void rcu_init_tasks_generic(void); | ||||||
|  |  | ||||||
|  | @ -171,6 +171,6 @@ static inline void rcu_all_qs(void) { barrier(); } | ||||||
| #define rcutree_offline_cpu      NULL | #define rcutree_offline_cpu      NULL | ||||||
| #define rcutree_dead_cpu         NULL | #define rcutree_dead_cpu         NULL | ||||||
| #define rcutree_dying_cpu        NULL | #define rcutree_dying_cpu        NULL | ||||||
| static inline void rcu_cpu_starting(unsigned int cpu) { } | static inline void rcutree_report_cpu_starting(unsigned int cpu) { } | ||||||
| 
 | 
 | ||||||
| #endif /* __LINUX_RCUTINY_H */ | #endif /* __LINUX_RCUTINY_H */ | ||||||
|  |  | ||||||
|  | @ -110,7 +110,7 @@ void rcu_all_qs(void); | ||||||
| /* RCUtree hotplug events */ | /* RCUtree hotplug events */ | ||||||
| int rcutree_prepare_cpu(unsigned int cpu); | int rcutree_prepare_cpu(unsigned int cpu); | ||||||
| int rcutree_online_cpu(unsigned int cpu); | int rcutree_online_cpu(unsigned int cpu); | ||||||
| void rcu_cpu_starting(unsigned int cpu); | void rcutree_report_cpu_starting(unsigned int cpu); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_HOTPLUG_CPU | #ifdef CONFIG_HOTPLUG_CPU | ||||||
| int rcutree_dead_cpu(unsigned int cpu); | int rcutree_dead_cpu(unsigned int cpu); | ||||||
|  | @ -122,4 +122,9 @@ int rcutree_offline_cpu(unsigned int cpu); | ||||||
| #define rcutree_offline_cpu NULL | #define rcutree_offline_cpu NULL | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | void rcutree_migrate_callbacks(int cpu); | ||||||
|  | 
 | ||||||
|  | /* Called from hotplug and also arm64 early secondary boot failure */ | ||||||
|  | void rcutree_report_cpu_dead(void); | ||||||
|  | 
 | ||||||
| #endif /* __LINUX_RCUTREE_H */ | #endif /* __LINUX_RCUTREE_H */ | ||||||
|  |  | ||||||
|  | @ -1388,10 +1388,10 @@ void cpuhp_report_idle_dead(void) | ||||||
| 	struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state); | 	struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state); | ||||||
| 
 | 
 | ||||||
| 	BUG_ON(st->state != CPUHP_AP_OFFLINE); | 	BUG_ON(st->state != CPUHP_AP_OFFLINE); | ||||||
| 	rcu_report_dead(); | 	rcutree_report_cpu_dead(); | ||||||
| 	st->state = CPUHP_AP_IDLE_DEAD; | 	st->state = CPUHP_AP_IDLE_DEAD; | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * We cannot call complete after rcu_report_dead() so we delegate it | 	 * We cannot call complete after rcutree_report_cpu_dead() so we delegate it | ||||||
| 	 * to an online cpu. | 	 * to an online cpu. | ||||||
| 	 */ | 	 */ | ||||||
| 	smp_call_function_single(cpumask_first(cpu_online_mask), | 	smp_call_function_single(cpumask_first(cpu_online_mask), | ||||||
|  | @ -1617,7 +1617,7 @@ void notify_cpu_starting(unsigned int cpu) | ||||||
| 	struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); | 	struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); | ||||||
| 	enum cpuhp_state target = min((int)st->target, CPUHP_AP_ONLINE); | 	enum cpuhp_state target = min((int)st->target, CPUHP_AP_ONLINE); | ||||||
| 
 | 
 | ||||||
| 	rcu_cpu_starting(cpu);	/* Enables RCU usage on this CPU. */ | 	rcutree_report_cpu_starting(cpu);	/* Enables RCU usage on this CPU. */ | ||||||
| 	cpumask_set_cpu(cpu, &cpus_booted_once_mask); | 	cpumask_set_cpu(cpu, &cpus_booted_once_mask); | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  |  | ||||||
|  | @ -4216,7 +4216,7 @@ bool rcu_lockdep_current_cpu_online(void) | ||||||
| 	rdp = this_cpu_ptr(&rcu_data); | 	rdp = this_cpu_ptr(&rcu_data); | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Strictly, we care here about the case where the current CPU is | 	 * Strictly, we care here about the case where the current CPU is | ||||||
| 	 * in rcu_cpu_starting() and thus has an excuse for rdp->grpmask | 	 * in rcutree_report_cpu_starting() and thus has an excuse for rdp->grpmask | ||||||
| 	 * not being up to date. So arch_spin_is_locked() might have a | 	 * not being up to date. So arch_spin_is_locked() might have a | ||||||
| 	 * false positive if it's held by some *other* CPU, but that's | 	 * false positive if it's held by some *other* CPU, but that's | ||||||
| 	 * OK because that just means a false *negative* on the warning. | 	 * OK because that just means a false *negative* on the warning. | ||||||
|  | @ -4445,8 +4445,10 @@ int rcutree_online_cpu(unsigned int cpu) | ||||||
|  * from the incoming CPU rather than from the cpuhp_step mechanism. |  * from the incoming CPU rather than from the cpuhp_step mechanism. | ||||||
|  * This is because this function must be invoked at a precise location. |  * This is because this function must be invoked at a precise location. | ||||||
|  * This incoming CPU must not have enabled interrupts yet. |  * This incoming CPU must not have enabled interrupts yet. | ||||||
|  |  * | ||||||
|  |  * This mirrors the effects of rcutree_report_cpu_dead(). | ||||||
|  */ |  */ | ||||||
| void rcu_cpu_starting(unsigned int cpu) | void rcutree_report_cpu_starting(unsigned int cpu) | ||||||
| { | { | ||||||
| 	unsigned long mask; | 	unsigned long mask; | ||||||
| 	struct rcu_data *rdp; | 	struct rcu_data *rdp; | ||||||
|  | @ -4500,8 +4502,10 @@ void rcu_cpu_starting(unsigned int cpu) | ||||||
|  * Note that this function is special in that it is invoked directly |  * Note that this function is special in that it is invoked directly | ||||||
|  * from the outgoing CPU rather than from the cpuhp_step mechanism. |  * from the outgoing CPU rather than from the cpuhp_step mechanism. | ||||||
|  * This is because this function must be invoked at a precise location. |  * This is because this function must be invoked at a precise location. | ||||||
|  |  * | ||||||
|  |  * This mirrors the effect of rcutree_report_cpu_starting(). | ||||||
|  */ |  */ | ||||||
| void rcu_report_dead(void) | void rcutree_report_cpu_dead(void) | ||||||
| { | { | ||||||
| 	unsigned long flags; | 	unsigned long flags; | ||||||
| 	unsigned long mask; | 	unsigned long mask; | ||||||
|  | @ -5072,7 +5076,7 @@ void __init rcu_init(void) | ||||||
| 	pm_notifier(rcu_pm_notify, 0); | 	pm_notifier(rcu_pm_notify, 0); | ||||||
| 	WARN_ON(num_online_cpus() > 1); // Only one CPU this early in boot.
 | 	WARN_ON(num_online_cpus() > 1); // Only one CPU this early in boot.
 | ||||||
| 	rcutree_prepare_cpu(cpu); | 	rcutree_prepare_cpu(cpu); | ||||||
| 	rcu_cpu_starting(cpu); | 	rcutree_report_cpu_starting(cpu); | ||||||
| 	rcutree_online_cpu(cpu); | 	rcutree_online_cpu(cpu); | ||||||
| 
 | 
 | ||||||
| 	/* Create workqueue for Tree SRCU and for expedited GPs. */ | 	/* Create workqueue for Tree SRCU and for expedited GPs. */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Frederic Weisbecker
						Frederic Weisbecker