Skip to content

Commit

Permalink
rcu: Remove SPARSE_RCU_POINTER Kconfig option
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul E. McKenney committed Jun 9, 2017
1 parent c4a09ff commit 41a2901
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 42 deletions.
9 changes: 3 additions & 6 deletions Documentation/RCU/Design/Requirements/Requirements.html
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,7 @@ <h3><a name="Publish-Subscribe Guarantee">Publish/Subscribe Guarantee</a></h3>
For <tt>remove_gp_synchronous()</tt>, as long as all modifications
to <tt>gp</tt> are carried out while holding <tt>gp_lock</tt>,
the above optimizations are harmless.
However,
with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt>,
<tt>sparse</tt> will complain if you
However, <tt>sparse</tt> will complain if you
define <tt>gp</tt> with <tt>__rcu</tt> and then
access it without using
either <tt>rcu_access_pointer()</tt> or <tt>rcu_dereference()</tt>.
Expand Down Expand Up @@ -1978,9 +1976,8 @@ <h2><a name="Software-Engineering Requirements">
and <tt>rcu_dereference()</tt>, perhaps (incorrectly)
substituting a simple assignment.
To catch this sort of error, a given RCU-protected pointer may be
tagged with <tt>__rcu</tt>, after which running sparse
with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt> will complain
about simple-assignment accesses to that pointer.
tagged with <tt>__rcu</tt>, after which sparse
will complain about simple-assignment accesses to that pointer.
Arnd Bergmann made me aware of this requirement, and also
supplied the needed
<a href="https://lwn.net/Articles/376011/">patch series</a>.
Expand Down
8 changes: 4 additions & 4 deletions Documentation/RCU/checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
RCU update-side primitives to deal with this.

17. Use CONFIG_PROVE_RCU, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and the
__rcu sparse checks (enabled by CONFIG_SPARSE_RCU_POINTER) to
validate your RCU code. These can help find problems as follows:
17. Use CONFIG_PROVE_LOCKING, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and the
__rcu sparse checks to validate your RCU code. These can help
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
read-side critical section, while holding the right
combination of locks, or whatever other conditions
Expand Down
6 changes: 0 additions & 6 deletions Documentation/dev-tools/sparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,3 @@ have already built it.

The optional make variable CF can be used to pass arguments to sparse. The
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.
4 changes: 0 additions & 4 deletions include/linux/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
# define __release(x) __context__(x,-1)
# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
# define __percpu __attribute__((noderef, address_space(3)))
#ifdef CONFIG_SPARSE_RCU_POINTER
# define __rcu __attribute__((noderef, address_space(4)))
#else /* CONFIG_SPARSE_RCU_POINTER */
# define __rcu
#endif /* CONFIG_SPARSE_RCU_POINTER */
# define __private __attribute__((noderef))
extern void __chk_user_ptr(const volatile void __user *);
extern void __chk_io_ptr(const volatile void __iomem *);
Expand Down
15 changes: 0 additions & 15 deletions lib/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -1306,21 +1306,6 @@ menu "RCU Debugging"
config PROVE_RCU
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
tristate
default n
Expand Down
3 changes: 0 additions & 3 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
earlycpio.o seq_buf.o siphash.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_SMP) += cpumask.o
lib-$(CONFIG_DMA_NOOP_OPS) += dma-noop.o
Expand Down
4 changes: 0 additions & 4 deletions tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ CONFIG_TINY_RCU

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_TASKS_RCU

Expand Down

0 comments on commit 41a2901

Please sign in to comment.