Skip to content

__rcu annotations, first draft

Arnd Bergmann lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10rcu: define __rcu address space modifier for sparseinclude/linux/compiler.h include/linux/rcupdate.h+43 -52 replies
2/10rcu: annotated list rcu codeinclude/linux/rculist.h+112 -402 replies
3/10cgroups: __rcu annotationsinclude/linux/cgroup.h include/linux/sched.h kernel/cgroup.c +1 more+38 -350 replies
4/10credentials: rcu annotationinclude/linux/cred.h include/linux/sched.h kernel/cred.c +1 more+32 -300 replies
5/10perf_event: __rcu annotationsinclude/linux/perf_event.h include/linux/sched.h kernel/perf_event.c+32 -320 replies
6/10audit: __rcu annotationskernel/audit.c kernel/audit.h kernel/audit_tree.c +2 more+30 -300 replies
7/10module: __rcu annotationsinclude/linux/module.h kernel/module.c+15 -99 replies
8/10pid: __rcu annotationsinclude/linux/init_task.h include/linux/pid.h kernel/pid.c+12 -110 replies
9/10notifiers: __rcu annotationsinclude/linux/notifier.h kernel/notifier.c+16 -160 replies
10/10scheduler: __rcu annotationsinclude/linux/fdtable.h include/linux/sched.h kernel/exit.c +2 more+27 -260 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] __rcu annotations, first draft
Quoted 6 lines · Paul E. McKenney
Quoted 6 lines

I've just started an experimental implementation and got stuck at list rcu. The two to deal with it that I can see are
- ignore list-rcu for now, and make all include/linux/rculist.h __force the problem to be ignored.
- introduce a new struct rcu_list_head that needs to be used for list rcu.

Quoted 8 lines
Quoted 3 lines

A nicer option might be if sparse would let you write 'struct list_head __rcu head' and interpret that as having the pointers inside it annotated as __rcu.

Only the "next" pointer, not the "prev" pointer, but yes.

Perhaps it would be best to see if the sparse guys are willing to take this on?

I've implemented the second option now, and this seems to work alright. In order to test this out, I've annotated all rcu users in the kernel directory. One observation is that many members of task_struct are using RCU inconsistently. I'm not sure whether these should be considered bugs or false positives though. If we get a lot of false positives or people are generally unhappy about the annotations, they are not worth it, but if we find a few actual bugs, I guess it would be good to have this.

Examples of pointers that I did not annotate because most of the places accessing them do not use RCU are task->sighand, task->nsproxy, and task->real_parent.

Sorry for hijacking the discussion on your patch, but I assume that the same people interested in the lockdep diagnostics are also interested in the static annotations for RCU.

Arnd

Arnd Bergmann (10):
rcu: define __rcu address space modifier for sparse
rcu: annotated list rcu code
cgroups: __rcu annotations
credentials: rcu annotation
perf_event: __rcu annotations
audit: __rcu annotations
module: __rcu annotations
pid: __rcu annotations
notifiers: __rcu annotations
scheduler: __rcu annotations

 include/linux/cgroup.h     |    6 +-
 include/linux/compiler.h   |    2 +
 include/linux/cred.h       |    4 +-
 include/linux/fdtable.h    |    2 +-
 include/linux/init_task.h  |    6 +-
 include/linux/module.h     |    4 +-
 include/linux/notifier.h   |   10 ++--
 include/linux/perf_event.h |   10 ++--
 include/linux/pid.h        |    9 ++-
 include/linux/rculist.h    |  152 ++++++++++++++++++++++++++++++++------------
 include/linux/rcupdate.h   |   46 ++++++++++++--
 include/linux/sched.h      |   14 ++--
 kernel/audit.c             |    4 +-
 kernel/audit.h             |    6 +-
 kernel/audit_tree.c        |   14 ++--
 kernel/auditfilter.c       |   28 ++++----
 kernel/auditsc.c           |    8 +-
 kernel/cgroup.c            |   63 ++++++++++---------
 kernel/cpuset.c            |    2 +-
 kernel/cred.c              |   50 ++++++++-------
 kernel/exit.c              |   12 ++--
 kernel/fork.c              |    6 +-
 kernel/module.c            |   20 ++++--
 kernel/notifier.c          |   12 ++--
 kernel/perf_event.c        |   52 ++++++++--------
 kernel/pid.c               |    8 +-
 kernel/sched.c             |   31 +++++----
 27 files changed, 352 insertions(+), 229 deletions(-)