mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	rcu: Correct READ_ONCE()/WRITE_ONCE() for ->rcu_read_unlock_special
The task_struct structure's ->rcu_read_unlock_special field is only ever read or written by the owning task, but it is accessed both at process and interrupt levels. It may therefore be accessed using plain reads and writes while interrupts are disabled, but must be accessed using READ_ONCE() and WRITE_ONCE() or better otherwise. This commit makes a few adjustments to align with this discipline. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
This commit is contained in:
		
							parent
							
								
									f1a98045ab
								
							
						
					
					
						commit
						add0d37b4f
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -633,7 +633,7 @@ static void rcu_exp_handler(void *unused)
 | 
				
			||||||
		raw_spin_lock_irqsave_rcu_node(rnp, flags);
 | 
							raw_spin_lock_irqsave_rcu_node(rnp, flags);
 | 
				
			||||||
		if (rnp->expmask & rdp->grpmask) {
 | 
							if (rnp->expmask & rdp->grpmask) {
 | 
				
			||||||
			rdp->deferred_qs = true;
 | 
								rdp->deferred_qs = true;
 | 
				
			||||||
			WRITE_ONCE(t->rcu_read_unlock_special.b.exp_hint, true);
 | 
								t->rcu_read_unlock_special.b.exp_hint = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
 | 
							raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -285,7 +285,7 @@ static void rcu_qs(void)
 | 
				
			||||||
				       TPS("cpuqs"));
 | 
									       TPS("cpuqs"));
 | 
				
			||||||
		__this_cpu_write(rcu_data.cpu_no_qs.b.norm, false);
 | 
							__this_cpu_write(rcu_data.cpu_no_qs.b.norm, false);
 | 
				
			||||||
		barrier(); /* Coordinate with rcu_flavor_sched_clock_irq(). */
 | 
							barrier(); /* Coordinate with rcu_flavor_sched_clock_irq(). */
 | 
				
			||||||
		current->rcu_read_unlock_special.b.need_qs = false;
 | 
							WRITE_ONCE(current->rcu_read_unlock_special.b.need_qs, false);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -817,7 +817,7 @@ void exit_rcu(void)
 | 
				
			||||||
	if (unlikely(!list_empty(¤t->rcu_node_entry))) {
 | 
						if (unlikely(!list_empty(¤t->rcu_node_entry))) {
 | 
				
			||||||
		t->rcu_read_lock_nesting = 1;
 | 
							t->rcu_read_lock_nesting = 1;
 | 
				
			||||||
		barrier();
 | 
							barrier();
 | 
				
			||||||
		t->rcu_read_unlock_special.b.blocked = true;
 | 
							WRITE_ONCE(t->rcu_read_unlock_special.b.blocked, true);
 | 
				
			||||||
	} else if (unlikely(t->rcu_read_lock_nesting)) {
 | 
						} else if (unlikely(t->rcu_read_lock_nesting)) {
 | 
				
			||||||
		t->rcu_read_lock_nesting = 1;
 | 
							t->rcu_read_lock_nesting = 1;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue