RCU changes for v2.6.34
Subsystems (22)
Linus,
Please pull the latest core-rcu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core-rcu-for-linus
Lots of nice changes in this cycle, with two areas standing out:
- expedited grace periods for energy efficiency (off by default)
- CONFIG_PROVE_RCU, lockdep based correctness checking (off by default)
We expect CONFIG_PROVE_RCU to trigger and we expect the usual new-lockdep-feature curve here too: many initial reports all at once, then almost overnight it will go down to zero. So the debug feature is off by default and we are on alert to handle any reports quickly ...
The warnings are always one-shot and all previous ones were non-fatal.
Thanks,
Ingo
------------------>
Ingo Molnar (1):
sched, cgroups: Fix module export
Paul E. McKenney (43):
rcu: Adjust force_quiescent_state() locking, step 1
rcu: Adjust force_quiescent_state() locking, step 2
rcu: Prohibit starting new grace periods while forcing quiescent states
rcu: Eliminate local variable signaled from force_quiescent_state()
rcu: Eliminate local variable lastcomp from force_quiescent_state()
rcu: Eliminate second argument of rcu_process_dyntick()
rcu: Eliminate rcu_process_dyntick() return value
rcu: Remove leg of force_quiescent_state() switch statement
rcu: Remove redundant grace-period check
rcu: Make force_quiescent_state() start grace period if needed
rcu: Add force_quiescent_state() testing to rcutorture
rcu: Make MAINTAINERS file match new RCU reality
rcu: Add debug check for too many rcu_read_unlock()
rcu: Give different levels of the rcu_node hierarchy distinct lockdep names
rcu: 1Q2010 update for RCU documentation
rcu: Fix sparse warnings
rcu: Introduce lockdep-based checking to RCU read-side primitives
rcu: Add lockdep-enabled variants of rcu_dereference()
rcu: Integrate rcu_dereference_check() message into lockdep
rcu: Disable lockdep checking in RCU list-traversal primitives
net: Add checking to rcu_dereference() primitives
sched: Use lockdep-based checking on rcu_dereference()
sched: Better name for for_each_domain_rd
vfs: Apply lockdep-based checking to rcu_dereference() uses
vfs: Abstract rcu_dereference_check for files-fdtable use
radix-tree: Disable RCU lockdep checking in radix tree
idr: Apply lockdep-based diagnostics to rcu_dereference() uses
security: Apply lockdep-based checking to rcu_dereference() uses
rcu: Documentation update for CONFIG_PROVE_RCU
rcu: Fix citation of Mathieu's dissertation
rcu: Accelerate grace period if last non-dynticked CPU
rcu: Use canonical URL for Mathieu's dissertation
rcu: Stop overflowing signed integers
rcu: Convert to raw_spinlocks
rcu: Fix deadlock in TREE_PREEMPT_RCU CPU stall detection
rcu: Fix rcutorture mod_timer argument to delay one jiffy
rcu: Add RCU_CPU_STALL_VERBOSE to dump detailed per-task information
rcu: Make lockdep_rcu_dereference() message less alarmist
rcu: Make rcu_read_lock_sched_held() take boot time into account
rcu: Export rcu_scheduler_active
rcu: Fix accelerated grace periods for last non-dynticked CPU
rcu: Make non-RCU_PROVE_LOCKING rcu_read_lock_sched_held() understand boot
rcu: Fix accelerated GPs for last non-dynticked CPU
Documentation/RCU/00-INDEX | 10 +- Documentation/RCU/RTFP.txt | 61 ++++++- Documentation/RCU/checklist.txt | 208 ++++++++++++-------- Documentation/RCU/lockdep.txt | 67 +++++++ Documentation/RCU/rcu.txt | 48 +----- Documentation/RCU/stallwarn.txt | 58 ++++++ Documentation/RCU/torture.txt | 12 ++ Documentation/RCU/whatisRCU.txt | 16 +- Documentation/filesystems/dentry-locking.txt | 3 +- MAINTAINERS | 13 +- fs/file.c | 2 +- fs/proc/array.c | 2 + fs/proc/base.c | 6 +- include/linux/cgroup.h | 5 +- include/linux/cpumask.h | 14 ++ include/linux/cred.h | 2 +- include/linux/fdtable.h | 11 +- include/linux/lockdep.h | 4 + include/linux/rculist.h | 14 +- include/linux/rculist_nulls.h | 4 +- include/linux/rcupdate.h | 165 ++++++++++++++-- include/linux/rcutiny.h | 16 ++- include/linux/rcutree.h | 4 +- include/linux/rtnetlink.h | 3 + include/linux/srcu.h | 95 +++++++++- include/net/addrconf.h | 4 +- init/Kconfig | 16 ++ init/main.c | 2 + kernel/cgroup.c | 15 ++ kernel/exit.c | 14 +- kernel/fork.c | 1 + kernel/lockdep.c | 18 ++ kernel/notifier.c | 6 +- kernel/pid.c | 2 +- kernel/rcupdate.c | 29 +++ kernel/rcutorture.c | 94 +++++++++- kernel/rcutree.c | 268 +++++++++++++------------- kernel/rcutree.h | 61 ++++--- kernel/rcutree_plugin.h | 229 ++++++++++++++++++++--- kernel/rcutree_trace.c | 14 +- kernel/sched.c | 11 +- kernel/srcu.c | 52 ++++-- lib/Kconfig.debug | 26 +++- lib/debug_locks.c | 1 + lib/idr.c | 8 +- lib/radix-tree.c | 24 ++-- net/core/dev.c | 2 +- net/core/filter.c | 6 +- net/core/rtnetlink.c | 8 + net/core/sock.c | 3 +- net/decnet/dn_route.c | 14 +- net/ipv4/route.c | 14 +- net/packet/af_packet.c | 2 +- security/keys/gc.c | 3 +- security/keys/keyring.c | 4 +- 55 files changed, 1346 insertions(+), 448 deletions(-) create mode 100644 Documentation/RCU/lockdep.txt create mode 100644 Documentation/RCU/stallwarn.txt
Documentation/RCU/00-INDEX +8 -2
@@ -6,16 +6,22 @@ checklist.txt - Review Checklist for RCU Patches listRCU.txt - Using RCU to Protect Read-Mostly Linked Lists +lockdep.txt + - RCU and lockdep checking NMI-RCU.txt - Using RCU to Protect Dynamic NMI Handlers +rcubarrier.txt + - RCU and Unloadable Modules +rculist_nulls.txt + - RCU list primitives for use with SLAB_DESTROY_BY_RCU rcuref.txt - Reference-count design for elements of lists/arrays protected by RCU rcu.txt - RCU Concepts -rcubarrier.txt - - Unloading modules that use RCU callbacks RTFP.txt - List of RCU papers (bibliography) going back to 1980. +stallwarn.txt + - RCU CPU stall warnings (CONFIG_RCU_CPU_STALL_DETECTOR) torture.txt - RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST) trace.txt
Documentation/RCU/RTFP.txt +57 -4
82 lines not on this page · raw message
Documentation/RCU/checklist.txt +126 -82
311 lines not on this page · raw message
Documentation/RCU/lockdep.txt new file +67 -0
67 lines not on this page · raw message
Documentation/RCU/rcu.txt +3 -45
57 lines not on this page · raw message
Documentation/RCU/stallwarn.txt new file +58 -0
58 lines not on this page · raw message
Documentation/RCU/torture.txt +12 -0
@@ -30,6 +30,18 @@ MODULE PARAMETERS This module has the following parameters: +fqs_duration Duration (in microseconds) of artificially induced bursts + of force_quiescent_state() invocations. In RCU + implementations having force_quiescent_state(), these + bursts help force races between forcing a given grace + period and that grace period ending on its own. + +fqs_holdoff Holdoff time (in microseconds) between consecutive calls + to force_quiescent_state() within a burst. + +fqs_stutter Wait time (in seconds) between consecutive bursts + of calls to force_quiescent_state(). + irqreaders Says to invoke RCU readers from irq level. This is currently done via timers. Defaults to "1" for variants of RCU that permit this. (Or, more accurately, variants of RCU that do
Documentation/RCU/whatisRCU.txt +10 -6
@@ -323,14 +323,17 @@ used as follows: Defer Protect a. synchronize_rcu() rcu_read_lock() / rcu_read_unlock() - call_rcu() + call_rcu() rcu_dereference() b. call_rcu_bh() rcu_read_lock_bh() / rcu_read_unlock_bh() + rcu_dereference_bh() -c. synchronize_sched() preempt_disable() / preempt_enable() +c. synchronize_sched() rcu_read_lock_sched() / rcu_read_unlock_sched() + preempt_disable() / preempt_enable() local_irq_save() / local_irq_restore() hardirq enter / hardirq exit NMI enter / NMI exit + rcu_dereference_sched() These three mechanisms are used as follows:
@@ -780,9 +783,8 @@ Linux-kernel source code, but it helps to have a full list of the APIs, since there does not appear to be a way to categorize them in docbook. Here is the list, by category. -RCU pointer/list traversal: +RCU list traversal: - rcu_dereference list_for_each_entry_rcu hlist_for_each_entry_rcu hlist_nulls_for_each_entry_rcu
@@ -808,7 +810,7 @@ RCU: Critical sections Grace period Barrier rcu_read_lock synchronize_net rcu_barrier rcu_read_unlock synchronize_rcu - synchronize_rcu_expedited + rcu_dereference synchronize_rcu_expedited call_rcu
@@ -816,7 +818,7 @@ bh: Critical sections Grace period Barrier rcu_read_lock_bh call_rcu_bh rcu_barrier_bh rcu_read_unlock_bh synchronize_rcu_bh - synchronize_rcu_bh_expedited + rcu_dereference_bh synchronize_rcu_bh_expedited sched: Critical sections Grace period Barrier
@@ -825,12 +827,14 @@ sched: Critical sections Grace period Barrier rcu_read_unlock_sched call_rcu_sched [preempt_disable] synchronize_sched_expedited [and friends] + rcu_dereference_sched SRCU: Critical sections Grace period Barrier srcu_read_lock synchronize_srcu N/A srcu_read_unlock synchronize_srcu_expedited + srcu_dereference SRCU: Initialization/cleanup init_srcu_struct
Documentation/filesystems/dentry-locking.txt +2 -1
@@ -62,7 +62,8 @@ changes are : 2. Insertion of a dentry into the hash table is done using hlist_add_head_rcu() which take care of ordering the writes - the writes to the dentry must be visible before the dentry is - inserted. This works in conjunction with hlist_for_each_rcu() while + inserted. This works in conjunction with hlist_for_each_rcu(), + which has since been replaced by hlist_for_each_entry_rcu(), while walking the hash chain. The only requirement is that all initialization to the dentry must be done before hlist_add_head_rcu() since we don't have dcache_lock protection
MAINTAINERS +7 -6
@@ -4509,7 +4509,7 @@ F: drivers/net/wireless/ray* RCUTORTURE MODULE M: Josh Triplett <[email protected]> M: "Paul E. McKenney" <[email protected]> -S: Maintained +S: Supported F: Documentation/RCU/torture.txt F: kernel/rcutorture.c
@@ -4534,11 +4534,12 @@ M: Dipankar Sarma <[email protected]> M: "Paul E. McKenney" <[email protected]> W: http://www.rdrop.com/users/paulmck/rclock/ S: Supported -F: Documentation/RCU/rcu.txt -F: Documentation/RCU/rcuref.txt -F: include/linux/rcupdate.h -F: include/linux/srcu.h -F: kernel/rcupdate.c +F: Documentation/RCU/ +F: include/linux/rcu* +F: include/linux/srcu* +F: kernel/rcu* +F: kernel/srcu* +X: kernel/rcutorture.c REAL TIME CLOCK DRIVER M: Paul Gortmaker <[email protected]>
fs/file.c +1 -1
@@ -478,7 +478,7 @@ repeat: error = fd;#if 1 /* Sanity check */ -if (rcu_dereference (fdt->fd[fd]) !=NULL ) { +if (rcu_dereference_raw (fdt->fd[fd]) !=NULL ) {printk (KERN_WARNING "alloc_fd: slot %d not NULL!\n" , fd);rcu_assign_pointer (fdt->fd[fd],NULL ); }
fs/proc/array.c +2 -0
@@ -270,7 +270,9 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p) blocked = p->blocked;collect_sigign_sigcatch (p, &ignored, &caught); num_threads =atomic_read (&p->signal->count); +rcu_read_lock ();/* FIXME: is this correct? */ qsize =atomic_read (&__task_cred (p)->user->sigpending); +rcu_read_unlock (); qlim = p->signal->rlim[RLIMIT_SIGPENDING ].rlim_cur;unlock_task_sighand (p, &flags); }
fs/proc/base.c +5 -1
@@ -1095,8 +1095,12 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,if (!capable (CAP_AUDIT_CONTROL ))return -EPERM ; -if (current !=pid_task (proc_pid (inode),PIDTYPE_PID )) +rcu_read_lock (); +if (current !=pid_task (proc_pid (inode),PIDTYPE_PID )) { +rcu_read_unlock ();return -EPERM ; + } +rcu_read_unlock ();if (count >=PAGE_SIZE ) count =PAGE_SIZE -1 ;
include/linux/cgroup.h +4 -1
@@ -28,6 +28,7 @@ struct css_id;extern int cgroup_init_early (void );extern int cgroup_init (void );extern void cgroup_lock (void ); +extern int cgroup_lock_is_held (void );extern bool cgroup_lock_live_group (struct cgroup *cgrp);extern void cgroup_unlock (void );extern void cgroup_fork (struct task_struct *p);
@@ -486,7 +487,9 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(static inline struct cgroup_subsys_state *task_subsys_state (struct task_struct *task,int subsys_id) { -return rcu_dereference (task->cgroups->subsys[subsys_id]); +return rcu_dereference_check (task->cgroups->subsys[subsys_id], +rcu_read_lock_held () || +cgroup_lock_is_held ()); } static inline struct cgroup* task_cgroup(struct task_struct *task,
include/linux/cpumask.h +14 -0
@@ -143,6 +143,8 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,#define for_each_cpu (cpu, mask) \ for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) +#define for_each_cpu_not (cpu, mask) \ + for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)#define for_each_cpu_and (cpu, mask, and) \ for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and)#else
@@ -203,6 +205,18 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); (cpu) < nr_cpu_ids;)/** +* for_each_cpu_not - iterate over every cpu in a complemented mask +* @cpu: the (optionally unsigned) integer iterator +* @mask: the cpumask pointer +* +* After the loop, cpu is >= nr_cpu_ids. +*/ +#define for_each_cpu_not (cpu, mask) \ + for ((cpu) = -1; \ + (cpu) = cpumask_next_zero((cpu), (mask)), \ + (cpu) < nr_cpu_ids;) + +/** * for_each_cpu_and - iterate over every cpu in both masks * @cpu: the (optionally unsigned) integer iterator * @mask: the first cpumask pointer
include/linux/cred.h +1 -1
@@ -280,7 +280,7 @@ static inline void put_cred(const struct cred *_cred)* task or by holding tasklist_lock to prevent it from being unlinked. */ #define __task_cred (task) \ - ((const struct cred *)(rcu_dereference((task)->real_cred))) + ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_is_held(&tasklist_lock))))/** * get_task_cred - Get another task's objective credentials
include/linux/fdtable.h +9 -2
@@ -57,7 +57,14 @@ struct files_struct {struct file * fd_array[NR_OPEN_DEFAULT ]; }; -#define files_fdtable (files) (rcu_dereference((files)->fdt)) +#define rcu_dereference_check_fdtable (files, fdtfd) \ + (rcu_dereference_check((fdtfd), \ + rcu_read_lock_held() || \ + lockdep_is_held(&(files)->file_lock) || \ + atomic_read(&(files)->count) == 1)) + +#define files_fdtable (files) \ + (rcu_dereference_check_fdtable((files), (files)->fdt))struct file_operations ;struct vfsmount ;
@@ -78,7 +85,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned instruct fdtable *fdt =files_fdtable (files);if (fd < fdt->max_fds) - file =rcu_dereference (fdt->fd[fd]); + file =rcu_dereference_check_fdtable (files, fdt->fd[fd]);return file; }
include/linux/lockdep.h +4 -0
@@ -534,4 +534,8 @@ do { \# define might_lock_read (lock) do { } while (0)#endif +#ifdef CONFIG_PROVE_RCU +extern void lockdep_rcu_dereference (const char *file,const int line); +#endif +#endif /* __LINUX_LOCKDEP_H */
include/linux/rculist.h +7 -7
@@ -208,7 +208,7 @@ static inline void list_splice_init_rcu(struct list_head *list,* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). */ #define list_entry_rcu (ptr, type, member) \ - container_of(rcu_dereference(ptr), type, member) + container_of(rcu_dereference_raw(ptr), type, member)/** * list_first_entry_rcu - get the first element from a list
@@ -225,9 +225,9 @@ static inline void list_splice_init_rcu(struct list_head *list, list_entry_rcu((ptr)->next, type, member)#define __list_for_each_rcu (pos, head) \ - for (pos = rcu_dereference((head)->next); \ + for (pos = rcu_dereference_raw((head)->next); \ pos != (head); \ - pos = rcu_dereference(pos->next)) + pos = rcu_dereference_raw(pos->next))/** * list_for_each_entry_rcu - iterate over rcu list of given type
@@ -257,9 +257,9 @@ static inline void list_splice_init_rcu(struct list_head *list,* as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_continue_rcu (pos, head) \ - for ((pos) = rcu_dereference((pos)->next); \ + for ((pos) = rcu_dereference_raw((pos)->next); \ prefetch((pos)->next), (pos) != (head); \ - (pos) = rcu_dereference((pos)->next)) + (pos) = rcu_dereference_raw((pos)->next))/** * list_for_each_entry_continue_rcu - continue iteration over list of given type
@@ -418,10 +418,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,* as long as the traversal is guarded by rcu_read_lock(). */ #define hlist_for_each_entry_rcu (tpos, pos, head, member) \ - for (pos = rcu_dereference((head)->first); \ + for (pos = rcu_dereference_raw((head)->first); \ pos && ({ prefetch(pos->next); 1; }) && \ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ - pos = rcu_dereference(pos->next)) + pos = rcu_dereference_raw(pos->next))#endif /* __KERNEL__ */ #endif
include/linux/rculist_nulls.h +2 -2
@@ -101,10 +101,10 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,* */ #define hlist_nulls_for_each_entry_rcu (tpos, pos, head, member) \ - for (pos = rcu_dereference((head)->first); \ + for (pos = rcu_dereference_raw((head)->first); \ (!is_a_nulls(pos)) && \ ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ - pos = rcu_dereference(pos->next)) + pos = rcu_dereference_raw(pos->next))#endif #endif
include/linux/rcupdate.h +150 -15
220 lines not on this page · raw message
include/linux/rcutiny.h +12 -4
@@ -62,6 +62,18 @@ static inline long rcu_batches_completed_bh(void)extern int rcu_expedited_torture_stats (char *page); +static inline void rcu_force_quiescent_state (void ) +{ +} + +static inline void rcu_bh_force_quiescent_state (void ) +{ +} + +static inline void rcu_sched_force_quiescent_state (void ) +{ +} +#define synchronize_rcu synchronize_schedstatic inline void synchronize_rcu_expedited (void )
@@ -93,10 +105,6 @@ static inline void rcu_exit_nohz(void)#endif /* #else #ifdef CONFIG_NO_HZ */ -static inline void rcu_scheduler_starting (void ) -{ -} -static inline void exit_rcu (void ) { }
include/linux/rcutree.h +3 -1
@@ -35,7 +35,6 @@ struct notifier_block;extern void rcu_sched_qs (int cpu);extern void rcu_bh_qs (int cpu);extern int rcu_needs_cpu (int cpu); -extern void rcu_scheduler_starting (void );extern int rcu_expedited_torture_stats (char *page);#ifdef CONFIG_TREE_PREEMPT_RCU
@@ -99,6 +98,9 @@ extern void rcu_check_callbacks(int cpu, int user);extern long rcu_batches_completed (void );extern long rcu_batches_completed_bh (void );extern long rcu_batches_completed_sched (void ); +extern void rcu_force_quiescent_state (void ); +extern void rcu_bh_force_quiescent_state (void ); +extern void rcu_sched_force_quiescent_state (void );#ifdef CONFIG_NO_HZ void rcu_enter_nohz (void );
include/linux/rtnetlink.h +3 -0
@@ -735,6 +735,9 @@ extern void rtnl_lock(void);extern void rtnl_unlock (void );extern int rtnl_trylock (void );extern int rtnl_is_locked (void ); +#ifdef CONFIG_PROVE_LOCKING +extern int lockdep_rtnl_is_held (void ); +#endif /* #ifdef CONFIG_PROVE_LOCKING */ extern void rtnetlink_init (void );extern void __rtnl_unlock (void );
include/linux/srcu.h +93 -2
111 lines not on this page · raw message
include/net/addrconf.h +3 -1
@@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb);static inline struct inet6_dev *__in6_dev_get (struct net_device *dev) { -return rcu_dereference (dev->ip6_ptr); +return rcu_dereference_check (dev->ip6_ptr, +rcu_read_lock_held () || +lockdep_rtnl_is_held ()); } static inline struct inet6_dev *
init/Kconfig +16 -0
@@ -396,6 +396,22 @@ config RCU_FANOUT_EXACT Say N if unsure. +config RCU_FAST_NO_HZ + bool "Accelerate last non-dyntick-idle CPU's grace periods" + depends on TREE_RCU && NO_HZ && SMP + default n + help + This option causes RCU to attempt to accelerate grace periods + in order to allow the final CPU to enter dynticks-idle state + more quickly. On the other hand, this option increases the + overhead of the dynticks-idle checking, particularly on systems + with large numbers of CPUs. + + Say Y if energy efficiency is critically important, particularly + if you have relatively few CPUs. + + Say N if you are unsure. + config TREE_RCU_TRACE def_bool RCU_TRACE && ( TREE_RCU || TREE_PREEMPT_RCU ) select DEBUG_FS
init/main.c +2 -0
@@ -416,7 +416,9 @@ static noinline void __init_refok rest_init(void)kernel_thread (kernel_init,NULL ,CLONE_FS |CLONE_SIGHAND );numa_default_policy (); pid =kernel_thread (kthreadd,NULL ,CLONE_FS |CLONE_FILES ); +rcu_read_lock (); kthreadd_task =find_task_by_pid_ns (pid, &init_pid_ns); +rcu_read_unlock ();unlock_kernel ();/*
kernel/cgroup.c +15 -0
@@ -23,6 +23,7 @@*/ #include <linux/cgroup.h> +#include <linux/module.h> #include <linux/ctype.h> #include <linux/errno.h> #include <linux/fs.h>
@@ -166,6 +167,20 @@ static DEFINE_SPINLOCK(hierarchy_id_lock);*/ static int need_forkexit_callback__read_mostly ; +#ifdef CONFIG_PROVE_LOCKING +int cgroup_lock_is_held (void ) +{ +return lockdep_is_held (&cgroup_mutex); +} +#else /* #ifdef CONFIG_PROVE_LOCKING */ +int cgroup_lock_is_held (void ) +{ +return mutex_is_locked (&cgroup_mutex); +} +#endif /* #else #ifdef CONFIG_PROVE_LOCKING */ + +EXPORT_SYMBOL_GPL (cgroup_lock_is_held); +/* convenient tests for these bits */ inline int cgroup_is_removed (const struct cgroup *cgrp) {
kernel/exit.c +11 -3
@@ -85,7 +85,9 @@ static void __exit_signal(struct task_struct *tsk)BUG_ON (!sig);BUG_ON (!atomic_read (&sig->count)); - sighand =rcu_dereference (tsk->sighand); + sighand =rcu_dereference_check (tsk->sighand, +rcu_read_lock_held () || +lockdep_is_held (&tasklist_lock));spin_lock (&sighand->siglock);posix_cpu_timers_exit (tsk);
@@ -170,8 +172,10 @@ void release_task(struct task_struct * p) repeat:tracehook_prepare_release_task (p);/* don't need to get the RCU readlock here - the process is dead and -* can't be modifying its own credentials */ +* can't be modifying its own credentials. But shut RCU-lockdep up */ +rcu_read_lock ();atomic_dec (&__task_cred (p)->user->processes); +rcu_read_unlock ();proc_flush_task (p);
@@ -473,9 +477,11 @@ static void close_files(struct files_struct * files)/* * It is safe to dereference the fd table without RCU or * ->file_lock because this is the last reference to the -* files structure. +* files structure. But use RCU to shut RCU-lockdep up. */ +rcu_read_lock (); fdt =files_fdtable (files); +rcu_read_unlock ();for (;;) {unsigned long set; i = j * __NFDBITS;
@@ -521,10 +527,12 @@ void put_files_struct(struct files_struct *files)* at the end of the RCU grace period. Otherwise, * you can free files immediately. */ +rcu_read_lock (); fdt =files_fdtable (files);if (fdt != &files->fdtab)kmem_cache_free (files_cachep, files);free_fdtable (fdt); +rcu_read_unlock (); } }
kernel/fork.c +1 -0
@@ -86,6 +86,7 @@ int max_threads; /* tunable limit on nr_threads */ DEFINE_PER_CPU(unsigned long, process_counts) = 0;__cacheline_aligned DEFINE_RWLOCK (tasklist_lock );/* outer */ +EXPORT_SYMBOL_GPL (tasklist_lock);int nr_processes (void ) {
kernel/lockdep.c +18 -0
@@ -3809,3 +3809,21 @@ void lockdep_sys_exit(void)lockdep_print_held_locks (curr); } } + +void lockdep_rcu_dereference (const char *file,const int line) +{ +struct task_struct *curr = current; + +if (!debug_locks_off ()) +return ; +printk ("\n===================================================\n" ); +printk ("[ INFO: suspicious rcu_dereference_check() usage. ]\n" ); +printk ("---------------------------------------------------\n" ); +printk ("%s:%d invoked rcu_dereference_check() without protection!\n" , + file, line); +printk ("\nother info that might help us debug this:\n\n" ); +lockdep_print_held_locks (curr); +printk ("\nstack backtrace:\n" ); +dump_stack (); +} +EXPORT_SYMBOL_GPL (lockdep_rcu_dereference);
kernel/notifier.c +3 -3
@@ -78,10 +78,10 @@ static int __kprobes notifier_call_chain(struct notifier_block **nl,int ret =NOTIFY_DONE ;struct notifier_block *nb, *next_nb; - nb =rcu_dereference (*nl); + nb =rcu_dereference_raw (*nl);while (nb && nr_to_call) { - next_nb =rcu_dereference (nb->next); + next_nb =rcu_dereference_raw (nb->next);#ifdef CONFIG_DEBUG_NOTIFIERS if (unlikely (!func_ptr_is_kernel_text (nb->notifier_call))) {
@@ -309,7 +309,7 @@ int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,* racy then it does not matter what the result of the test * is, we re-check the list after having taken the lock anyway: */ -if (rcu_dereference (nh->head)) { +if (rcu_dereference_raw (nh->head)) {down_read (&nh->rwsem); ret =notifier_call_chain (&nh->head, val, v, nr_to_call, nr_calls);
kernel/pid.c +1 -1
@@ -367,7 +367,7 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type)struct task_struct *result =NULL ;if (pid) {struct hlist_node *first; - first =rcu_dereference (pid->tasks[type].first); + first =rcu_dereference_check (pid->tasks[type].first,rcu_read_lock_held () ||lockdep_is_held (&tasklist_lock));if (first) result = hlist_entry(first, struct task_struct, pids[(type)].node); }
kernel/rcupdate.c +29 -0
@@ -44,14 +44,43 @@#include <linux/cpu.h> #include <linux/mutex.h> #include <linux/module.h> +#include <linux/kernel_stat.h> #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key rcu_lock_key;struct lockdep_map rcu_lock_map =STATIC_LOCKDEP_MAP_INIT ("rcu_read_lock" , &rcu_lock_key);EXPORT_SYMBOL_GPL (rcu_lock_map); + +static struct lock_class_key rcu_bh_lock_key; +struct lockdep_map rcu_bh_lock_map = +STATIC_LOCKDEP_MAP_INIT ("rcu_read_lock_bh" , &rcu_bh_lock_key); +EXPORT_SYMBOL_GPL (rcu_bh_lock_map); + +static struct lock_class_key rcu_sched_lock_key; +struct lockdep_map rcu_sched_lock_map = +STATIC_LOCKDEP_MAP_INIT ("rcu_read_lock_sched" , &rcu_sched_lock_key); +EXPORT_SYMBOL_GPL (rcu_sched_lock_map);#endif +int rcu_scheduler_active__read_mostly ; +EXPORT_SYMBOL_GPL (rcu_scheduler_active); + +/* +* This function is invoked towards the end of the scheduler's initialization +* process. Before this is called, the idle task might contain +* RCU read-side critical sections (during which time, this idle +* task is booting the system). After this function is called, the +* idle tasks are prohibited from containing RCU read-side critical +* sections. +*/ +void rcu_scheduler_starting (void ) +{ +WARN_ON (num_online_cpus () !=1 ); +WARN_ON (nr_context_switches () >0 ); + rcu_scheduler_active =1 ; +} +/* * Awaken the corresponding synchronize_rcu() instance now that a * grace period has elapsed.
kernel/rcutorture.c +89 -5
213 lines not on this page · raw message
kernel/rcutree.c +134 -134
672 lines not on this page · raw message
kernel/rcutree.h +34 -27
137 lines not on this page · raw message
kernel/rcutree_plugin.h +205 -24
369 lines not on this page · raw message
kernel/rcutree_trace.c +7 -7
@@ -50,7 +50,7 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp) {if (!rdp->beenonline)return ; - seq_printf(m, "%3d%cc=%ld g=%ld pq=%d pqc=%ld qp=%d", + seq_printf(m, "%3d%cc=%lu g=%lu pq=%d pqc=%lu qp=%d", rdp->cpu, cpu_is_offline(rdp->cpu) ? '!' : ' ', rdp->completed, rdp->gpnum,
@@ -105,7 +105,7 @@ static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp) {if (!rdp->beenonline)return ; - seq_printf(m, "%d,%s,%ld,%ld,%d,%ld,%d", + seq_printf(m, "%d,%s,%lu,%lu,%d,%lu,%d", rdp->cpu, cpu_is_offline(rdp->cpu) ? "\"N\"" : "\"Y\"", rdp->completed, rdp->gpnum,
@@ -155,13 +155,13 @@ static const struct file_operations rcudata_csv_fops = {static void print_one_rcu_state (struct seq_file *m,struct rcu_state *rsp) { -long gpnum; +unsigned long gpnum;int level =0 ;int phase;struct rcu_node *rnp; gpnum = rsp->gpnum; - seq_printf(m, "c=%ld g=%ld s=%d jfq=%ld j=%x " + seq_printf(m, "c=%lu g=%lu s=%d jfq=%ld j=%x " "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu oqlen=%ld\n", rsp->completed, gpnum, rsp->signaled, (long)(rsp->jiffies_force_qs - jiffies),
@@ -215,12 +215,12 @@ static const struct file_operations rcuhier_fops = {static int show_rcugp (struct seq_file *m,void *unused) {#ifdef CONFIG_TREE_PREEMPT_RCU -seq_printf (m,"rcu_preempt: completed=%ld gpnum=%ld\n" , +seq_printf (m,"rcu_preempt: completed=%ld gpnum=%lu\n" , rcu_preempt_state.completed, rcu_preempt_state.gpnum);#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ -seq_printf (m,"rcu_sched: completed=%ld gpnum=%ld\n" , +seq_printf (m,"rcu_sched: completed=%ld gpnum=%lu\n" , rcu_sched_state.completed, rcu_sched_state.gpnum); -seq_printf (m,"rcu_bh: completed=%ld gpnum=%ld\n" , +seq_printf (m,"rcu_bh: completed=%ld gpnum=%lu\n" , rcu_bh_state.completed, rcu_bh_state.gpnum);return 0 ; }
kernel/sched.c +8 -3
@@ -645,6 +645,11 @@ static inline int cpu_of(struct rq *rq)#endif } +#define rcu_dereference_check_sched_domain (p) \ + rcu_dereference_check((p), \ + rcu_read_lock_sched_held() || \ + lockdep_is_held(&sched_domains_mutex)) +/* * The domain tree (rq->sd) is protected by RCU's quiescent state transition. * See detach_destroy_domains: synchronize_sched for details.
@@ -653,7 +658,7 @@ static inline int cpu_of(struct rq *rq)* preempt-disabled sections. */ #define for_each_domain (cpu, __sd) \ - for (__sd = rcu_dereference(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent) + for (__sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent)#define cpu_rq (cpu) (&per_cpu(runqueues, (cpu)))#define this_rq () (&__get_cpu_var(runqueues))
@@ -1531,7 +1536,7 @@ static unsigned long target_load(int cpu, int type)static struct sched_group *group_of (int cpu) { -struct sched_domain *sd =rcu_dereference (cpu_rq (cpu)->sd); +struct sched_domain *sd =rcu_dereference_sched (cpu_rq (cpu)->sd);if (!sd)return NULL ;
@@ -4888,7 +4893,7 @@ static void run_rebalance_domains(struct softirq_action *h)static inline int on_null_domain (int cpu) { -return !rcu_dereference (cpu_rq (cpu)->sd); +return !rcu_dereference_sched (cpu_rq (cpu)->sd); }/*
kernel/srcu.c +34 -18
56 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.