mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	rcu: Remove SPARSE_RCU_POINTER Kconfig option
The sparse-based checking for non-RCU accesses to RCU-protected pointers has been around for a very long time, and it is now the only type of sparse-based checking that is optional. This commit therefore makes it unconditional. Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Fengguang Wu <fengguang.wu@intel.com>
This commit is contained in:
		
							parent
							
								
									c4a09ff752
								
							
						
					
					
						commit
						41a2901e7d
					
				
					 7 changed files with 7 additions and 42 deletions
				
			
		| 
						 | 
					@ -559,9 +559,7 @@ The <tt>rcu_access_pointer()</tt> on line 6 is similar to
 | 
				
			||||||
	For <tt>remove_gp_synchronous()</tt>, as long as all modifications
 | 
						For <tt>remove_gp_synchronous()</tt>, as long as all modifications
 | 
				
			||||||
	to <tt>gp</tt> are carried out while holding <tt>gp_lock</tt>,
 | 
						to <tt>gp</tt> are carried out while holding <tt>gp_lock</tt>,
 | 
				
			||||||
	the above optimizations are harmless.
 | 
						the above optimizations are harmless.
 | 
				
			||||||
	However,
 | 
						However, <tt>sparse</tt> will complain if you
 | 
				
			||||||
	with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt>,
 | 
					 | 
				
			||||||
	<tt>sparse</tt> will complain if you
 | 
					 | 
				
			||||||
	define <tt>gp</tt> with <tt>__rcu</tt> and then
 | 
						define <tt>gp</tt> with <tt>__rcu</tt> and then
 | 
				
			||||||
	access it without using
 | 
						access it without using
 | 
				
			||||||
	either <tt>rcu_access_pointer()</tt> or <tt>rcu_dereference()</tt>.
 | 
						either <tt>rcu_access_pointer()</tt> or <tt>rcu_dereference()</tt>.
 | 
				
			||||||
| 
						 | 
					@ -1978,9 +1976,8 @@ guard against mishaps and misuse:
 | 
				
			||||||
	and <tt>rcu_dereference()</tt>, perhaps (incorrectly)
 | 
						and <tt>rcu_dereference()</tt>, perhaps (incorrectly)
 | 
				
			||||||
	substituting a simple assignment.
 | 
						substituting a simple assignment.
 | 
				
			||||||
	To catch this sort of error, a given RCU-protected pointer may be
 | 
						To catch this sort of error, a given RCU-protected pointer may be
 | 
				
			||||||
	tagged with <tt>__rcu</tt>, after which running sparse
 | 
						tagged with <tt>__rcu</tt>, after which sparse
 | 
				
			||||||
	with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt> will complain
 | 
						will complain about simple-assignment accesses to that pointer.
 | 
				
			||||||
	about simple-assignment accesses to that pointer.
 | 
					 | 
				
			||||||
	Arnd Bergmann made me aware of this requirement, and also
 | 
						Arnd Bergmann made me aware of this requirement, and also
 | 
				
			||||||
	supplied the needed
 | 
						supplied the needed
 | 
				
			||||||
	<a href="https://lwn.net/Articles/376011/">patch series</a>.
 | 
						<a href="https://lwn.net/Articles/376011/">patch series</a>.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -413,11 +413,11 @@ over a rather long period of time, but improvements are always welcome!
 | 
				
			||||||
	read-side critical sections.  It is the responsibility of the
 | 
						read-side critical sections.  It is the responsibility of the
 | 
				
			||||||
	RCU update-side primitives to deal with this.
 | 
						RCU update-side primitives to deal with this.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
17.	Use CONFIG_PROVE_RCU, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and the
 | 
					17.	Use CONFIG_PROVE_LOCKING, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and the
 | 
				
			||||||
	__rcu sparse checks (enabled by CONFIG_SPARSE_RCU_POINTER) to
 | 
						__rcu sparse checks to validate your RCU code.	These can help
 | 
				
			||||||
	validate your RCU code.  These can help find problems as follows:
 | 
						find problems as follows:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CONFIG_PROVE_RCU: check that accesses to RCU-protected data
 | 
						CONFIG_PROVE_LOCKING: check that accesses to RCU-protected data
 | 
				
			||||||
		structures are carried out under the proper RCU
 | 
							structures are carried out under the proper RCU
 | 
				
			||||||
		read-side critical section, while holding the right
 | 
							read-side critical section, while holding the right
 | 
				
			||||||
		combination of locks, or whatever other conditions
 | 
							combination of locks, or whatever other conditions
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,9 +103,3 @@ have already built it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The optional make variable CF can be used to pass arguments to sparse.  The
 | 
					The optional make variable CF can be used to pass arguments to sparse.  The
 | 
				
			||||||
build system passes -Wbitwise to sparse automatically.
 | 
					build system passes -Wbitwise to sparse automatically.
 | 
				
			||||||
 | 
					 | 
				
			||||||
Checking RCU annotations
 | 
					 | 
				
			||||||
~~~~~~~~~~~~~~~~~~~~~~~~
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RCU annotations are not checked by default.  To enable RCU annotation
 | 
					 | 
				
			||||||
checks, include -DCONFIG_SPARSE_RCU_POINTER in your CF flags.
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,11 +17,7 @@
 | 
				
			||||||
# define __release(x)	__context__(x,-1)
 | 
					# define __release(x)	__context__(x,-1)
 | 
				
			||||||
# define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0)
 | 
					# define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0)
 | 
				
			||||||
# define __percpu	__attribute__((noderef, address_space(3)))
 | 
					# define __percpu	__attribute__((noderef, address_space(3)))
 | 
				
			||||||
#ifdef CONFIG_SPARSE_RCU_POINTER
 | 
					 | 
				
			||||||
# define __rcu		__attribute__((noderef, address_space(4)))
 | 
					# define __rcu		__attribute__((noderef, address_space(4)))
 | 
				
			||||||
#else /* CONFIG_SPARSE_RCU_POINTER */
 | 
					 | 
				
			||||||
# define __rcu
 | 
					 | 
				
			||||||
#endif /* CONFIG_SPARSE_RCU_POINTER */
 | 
					 | 
				
			||||||
# define __private	__attribute__((noderef))
 | 
					# define __private	__attribute__((noderef))
 | 
				
			||||||
extern void __chk_user_ptr(const volatile void __user *);
 | 
					extern void __chk_user_ptr(const volatile void __user *);
 | 
				
			||||||
extern void __chk_io_ptr(const volatile void __iomem *);
 | 
					extern void __chk_io_ptr(const volatile void __iomem *);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1306,21 +1306,6 @@ menu "RCU Debugging"
 | 
				
			||||||
config PROVE_RCU
 | 
					config PROVE_RCU
 | 
				
			||||||
	def_bool PROVE_LOCKING
 | 
						def_bool PROVE_LOCKING
 | 
				
			||||||
 | 
					
 | 
				
			||||||
config SPARSE_RCU_POINTER
 | 
					 | 
				
			||||||
	bool "RCU debugging: sparse-based checks for pointer usage"
 | 
					 | 
				
			||||||
	default n
 | 
					 | 
				
			||||||
	help
 | 
					 | 
				
			||||||
	 This feature enables the __rcu sparse annotation for
 | 
					 | 
				
			||||||
	 RCU-protected pointers.  This annotation will cause sparse
 | 
					 | 
				
			||||||
	 to flag any non-RCU used of annotated pointers.  This can be
 | 
					 | 
				
			||||||
	 helpful when debugging RCU usage.  Please note that this feature
 | 
					 | 
				
			||||||
	 is not intended to enforce code cleanliness; it is instead merely
 | 
					 | 
				
			||||||
	 a debugging aid.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	 Say Y to make sparse flag questionable use of RCU-protected pointers
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	 Say N if you are unsure.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
config TORTURE_TEST
 | 
					config TORTURE_TEST
 | 
				
			||||||
	tristate
 | 
						tristate
 | 
				
			||||||
	default n
 | 
						default n
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,9 +25,6 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
 | 
				
			||||||
	 earlycpio.o seq_buf.o siphash.o \
 | 
						 earlycpio.o seq_buf.o siphash.o \
 | 
				
			||||||
	 nmi_backtrace.o nodemask.o win_minmax.o
 | 
						 nmi_backtrace.o nodemask.o win_minmax.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CFLAGS_radix-tree.o += -DCONFIG_SPARSE_RCU_POINTER
 | 
					 | 
				
			||||||
CFLAGS_idr.o += -DCONFIG_SPARSE_RCU_POINTER
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
lib-$(CONFIG_MMU) += ioremap.o
 | 
					lib-$(CONFIG_MMU) += ioremap.o
 | 
				
			||||||
lib-$(CONFIG_SMP) += cpumask.o
 | 
					lib-$(CONFIG_SMP) += cpumask.o
 | 
				
			||||||
lib-$(CONFIG_DMA_NOOP_OPS) += dma-noop.o
 | 
					lib-$(CONFIG_DMA_NOOP_OPS) += dma-noop.o
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,10 +74,6 @@ CONFIG_TINY_RCU
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	These are controlled by CONFIG_PREEMPT and/or CONFIG_SMP.
 | 
						These are controlled by CONFIG_PREEMPT and/or CONFIG_SMP.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CONFIG_SPARSE_RCU_POINTER
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	Makes sense only for sparse runs, not for kernel builds.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CONFIG_SRCU
 | 
					CONFIG_SRCU
 | 
				
			||||||
CONFIG_TASKS_RCU
 | 
					CONFIG_TASKS_RCU
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue