lkml.org 
[lkml]   [2010]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: INFO: suspicious rcu_dereference_check() usage - include/linux/cgroup.h:492 invoked rcu_dereference_check() without protection!
From
Date
On Mon, 2010-04-19 at 20:04 -0700, Paul E. McKenney wrote:
> On Mon, Apr 19, 2010 at 09:25:29PM -0400, Eric Paris wrote:

> > That one is also fixed so feel free to add a tested or something from
> > me. But we've got another, weeeee! If there some way I could get all
> > of these at once?
>
> Sure! I -think- that if you remove the first "if" statement in
> lockdep_rcu_dereference() in kernel/lockdep.c, you will get lots of them
> all at once. Maybe more than your console log is able to hold...
>
> So another approach would be to print only the first 100 or some such.
>
> It -looks- to me that you could make __debug_locks_off() atomically
> decrement a counter rather than just setting it to zero, see
> include/linux/debug_locks.h. I suspect that atomic_dec_not_zero()
> would work very well for you here.
>
> Peter probably knows a better approach, but those would work.

Right, so because the RCU checking stuff doesn't poke at the lockdep
class chains, but simply validates the current task state we can delay
or altogether not disable lockdep.

So something like the below, or simply remove that debug_locks_off()
thing alltogether.

---
kernel/lockdep.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 78325f8..31c8738 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -3784,12 +3784,16 @@ void lockdep_sys_exit(void)
}
}

+static atomic_t rcu_warns = ATOMIC_INIT(100);
+
void lockdep_rcu_dereference(const char *file, const int line)
{
struct task_struct *curr = current;

- if (!debug_locks_off())
- return;
+ if (!debug_locks || atomic_dec_and_test(&rcu_warns)) {
+ if (!debug_locks_off())
+ return;
+ }
printk("\n===================================================\n");
printk( "[ INFO: suspicious rcu_dereference_check() usage. ]\n");
printk( "---------------------------------------------------\n");



\
 
 \ /
  Last update: 2010-04-20 09:27    [from the cache]
©2003-2011 Jasper Spaans