~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/RCU/lockdep.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/RCU/lockdep.rst (Version linux-6.12-rc7) and /Documentation/RCU/lockdep.rst (Version linux-4.13.16)


  1 .. SPDX-License-Identifier: GPL-2.0               
  2                                                   
  3 ========================                          
  4 RCU and lockdep checking                          
  5 ========================                          
  6                                                   
  7 All flavors of RCU have lockdep checking avail    
  8 aware of when each task enters and leaves any     
  9 critical section.  Each flavor of RCU is track    
 10 that this is not the case in 2.6.32 and earlie    
 11 tracking to include RCU state, which can somet    
 12 deadlocks and the like.                           
 13                                                   
 14 In addition, RCU provides the following primit    
 15 state::                                           
 16                                                   
 17         rcu_read_lock_held() for normal RCU.      
 18         rcu_read_lock_bh_held() for RCU-bh.       
 19         rcu_read_lock_sched_held() for RCU-sch    
 20         rcu_read_lock_any_held() for any of no    
 21         srcu_read_lock_held() for SRCU.           
 22         rcu_read_lock_trace_held() for RCU Tas    
 23                                                   
 24 These functions are conservative, and will the    
 25 aren't certain (for example, if CONFIG_DEBUG_L    
 26 This prevents things like WARN_ON(!rcu_read_lo    
 27 positives when lockdep is disabled.               
 28                                                   
 29 In addition, a separate kernel config paramete    
 30 checking of rcu_dereference() primitives:         
 31                                                   
 32         rcu_dereference(p):                       
 33                 Check for RCU read-side critic    
 34         rcu_dereference_bh(p):                    
 35                 Check for RCU-bh read-side cri    
 36         rcu_dereference_sched(p):                 
 37                 Check for RCU-sched read-side     
 38         srcu_dereference(p, sp):                  
 39                 Check for SRCU read-side criti    
 40         rcu_dereference_check(p, c):              
 41                 Use explicit check expression     
 42                 rcu_read_lock_held().  This is    
 43                 invoked by both RCU readers an    
 44         rcu_dereference_bh_check(p, c):           
 45                 Use explicit check expression     
 46                 rcu_read_lock_bh_held().  This    
 47                 is invoked by both RCU-bh read    
 48         rcu_dereference_sched_check(p, c):        
 49                 Use explicit check expression     
 50                 rcu_read_lock_sched_held().  T    
 51                 is invoked by both RCU-sched r    
 52         srcu_dereference_check(p, c):             
 53                 Use explicit check expression     
 54                 srcu_read_lock_held().  This i    
 55                 is invoked by both SRCU reader    
 56         rcu_dereference_raw(p):                   
 57                 Don't check.  (Use sparingly,     
 58         rcu_dereference_raw_check(p):             
 59                 Don't do lockdep at all.  (Use    
 60         rcu_dereference_protected(p, c):          
 61                 Use explicit check expression     
 62                 and compiler constraints.  Thi    
 63                 structure cannot change, for e    
 64                 invoked only by updaters.         
 65         rcu_access_pointer(p):                    
 66                 Return the value of the pointe    
 67                 but retain the compiler constr    
 68                 or coalescing.  This is useful    
 69                 value of the pointer itself, f    
 70                                                   
 71 The rcu_dereference_check() check expression c    
 72 expression, but would normally include a lockd    
 73 moderately ornate example, consider the follow    
 74                                                   
 75         file = rcu_dereference_check(fdt->fd[f    
 76                                      lockdep_i    
 77                                      atomic_re    
 78                                                   
 79 This expression picks up the pointer "fdt->fd[    
 80 and, if CONFIG_PROVE_RCU is configured, verifi    
 81 is used in:                                       
 82                                                   
 83 1.      An RCU read-side critical section (imp    
 84 2.      with files->file_lock held, or            
 85 3.      on an unshared files_struct.              
 86                                                   
 87 In case (1), the pointer is picked up in an RC    
 88 RCU read-side critical sections, in case (2) t    
 89 any change from taking place, and finally, in     
 90 is the only task accessing the file_struct, ag    
 91 from taking place.  If the above statement was    
 92 code, it could instead be written as follows::    
 93                                                   
 94         file = rcu_dereference_protected(fdt->    
 95                                          lockd    
 96                                          atomi    
 97                                                   
 98 This would verify cases #2 and #3 above, and f    
 99 complain even if this was used in an RCU read-    
100 one of these two cases held.  Because rcu_dere    
101 all barriers and compiler constraints, it gene    
102 the other flavors of rcu_dereference().  On th    
103 to use rcu_dereference_protected() if either t    
104 or the RCU-protected data that it points to ca    
105                                                   
106 Like rcu_dereference(), when lockdep is enable    
107 traversal primitives check for being called fr    
108 critical section.  However, a lockdep expressi    
109 as a additional optional argument.  With this     
110 traversal primitives will complain only if the    
111 false and they are called from outside any RCU    
112                                                   
113 For example, the workqueue for_each_pwq() macr    
114 either within an RCU read-side critical sectio    
115 It is thus implemented as follows::               
116                                                   
117         #define for_each_pwq(pwq, wq)             
118                 list_for_each_entry_rcu((pwq),    
119                                         lock_i    
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php