Skip to content

Commit c964c1f

Browse files
author
Frederic Weisbecker
committed
rcu: Assume rcu_report_dead() is always called locally
rcu_report_dead() has to be called locally by the CPU that is going to exit the RCU state machine. Passing a cpu argument here is error-prone and leaves the possibility for a racy remote call. Use local access instead. Reviewed-by: Paul E. McKenney <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 358662a commit c964c1f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

arch/arm64/kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ void __noreturn cpu_die_early(void)
401401

402402
/* Mark this CPU absent */
403403
set_cpu_present(cpu, 0);
404-
rcu_report_dead(cpu);
404+
rcu_report_dead();
405405

406406
if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) {
407407
update_cpu_boot_status(CPU_KILL_ME);

include/linux/rcupdate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static inline void call_rcu_hurry(struct rcu_head *head, rcu_callback_t func)
122122
void rcu_init(void);
123123
extern int rcu_scheduler_active;
124124
void rcu_sched_clock_irq(int user);
125-
void rcu_report_dead(unsigned int cpu);
125+
void rcu_report_dead(void);
126126
void rcutree_migrate_callbacks(int cpu);
127127

128128
#ifdef CONFIG_TASKS_RCU_GENERIC

kernel/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ void cpuhp_report_idle_dead(void)
13881388
struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state);
13891389

13901390
BUG_ON(st->state != CPUHP_AP_OFFLINE);
1391-
rcu_report_dead(smp_processor_id());
1391+
rcu_report_dead();
13921392
st->state = CPUHP_AP_IDLE_DEAD;
13931393
/*
13941394
* We cannot call complete after rcu_report_dead() so we delegate it

kernel/rcu/tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4560,11 +4560,11 @@ void rcu_cpu_starting(unsigned int cpu)
45604560
* from the outgoing CPU rather than from the cpuhp_step mechanism.
45614561
* This is because this function must be invoked at a precise location.
45624562
*/
4563-
void rcu_report_dead(unsigned int cpu)
4563+
void rcu_report_dead(void)
45644564
{
45654565
unsigned long flags;
45664566
unsigned long mask;
4567-
struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
4567+
struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
45684568
struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */
45694569

45704570
/*

0 commit comments

Comments
 (0)