Lines Matching +full:side +full:- +full:by +full:- +full:side
1 .. SPDX-License-Identifier: GPL-2.0
4 Lockdep-RCU Splat
7 Lockdep-RCU was added to the Linux kernel in early 2010
10 family to access an RCU-protected pointer without the proper protection.
11 When such misuse is detected, an lockdep-RCU splat is emitted.
13 The usual cause of a lockdep-RCU splat is someone accessing an
14 RCU-protected data structure without either (1) being in the right kind of
15 RCU read-side critical section or (2) holding the right update-side lock.
20 So let's look at an example RCU lockdep splat from 3.0-rc5, one that
25 -----------------------------
26 block/cfq-iosched.c:2776 suspicious rcu_dereference_protected() usage!
31 3 locks held by scsi_scan_6/1552:
32 #0: (&shost->scan_mutex){+.+.}, at: [<ffffffff8145efca>]
34 #1: (&eq->sysfs_lock){+.+.}, at: [<ffffffff812a5032>]
36 #2: (&(&q->__queue_lock)->rlock){-.-.}, at: [<ffffffff812b6233>]
40 Pid: 1552, comm: scsi_scan_6 Not tainted 3.0.0-rc5 #17
68 Line 2776 of block/cfq-iosched.c in v3.0-rc5 is as follows::
70 if (rcu_dereference(ioc->ioc_data) == cic) {
72 This form says that it must be in a plain vanilla RCU read-side critical
76 is to inform RCU, perhaps by changing __cfq_exit_single_io_context() to
80 if (rcu_dereference_protected(ioc->ioc_data,
81 lockdep_is_held(&q->queue_lock)) == cic) {
83 With this change, there would be no lockdep-RCU splat emitted if this
84 code was invoked either from within an RCU read-side critical section
85 or with the ->queue_lock held. In particular, this would have suppressed
86 the above lockdep-RCU splat because ->queue_lock is held (see #2 in the
89 On the other hand, perhaps we really do need an RCU read-side critical
96 if (rcu_dereference(ioc->ioc_data) == cic) {
97 spin_lock(&ioc->lock);
98 rcu_assign_pointer(ioc->ioc_data, NULL);
99 spin_unlock(&ioc->lock);
104 read-side critical section, which again would have suppressed the
105 above lockdep-RCU splat.
110 by rcu_access_pointer() as follows::
112 if (rcu_access_pointer(ioc->ioc_data) == cic) {
115 this change would also suppress the above lockdep-RCU splat.