tree: git://git.cmpxchg.org/linux-mmotm.git master head: 60319c74c8a7816a4b392f51a12a77cde302262b commit: 7a5f64d9a72a65046cfdc05a02f84e6462ae5bff [332/380] mm: rcu-protected get_mm_exe_file() config: i386-randconfig-ib1-03200743 (attached as .config) reproduce: git checkout 7a5f64d9a72a65046cfdc05a02f84e6462ae5bff # save the attached .config to linux build tree make ARCH=i386 All warnings: In file included from include/linux/linkage.h:4:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from kernel/fork.c:14: kernel/fork.c: In function 'set_mm_exe_file': kernel/fork.c:699:17: warning: passing argument 1 of 'lock_is_held' from incompatible pointer type lock_is_held(&mm->mmap_sem)); ^ include/linux/compiler.h:145:28: note: in definition of macro '__trace_if' if (__builtin_constant_p((cond)) ? !!(cond) : \ ^ include/linux/rcupdate.h:528:3: note: in expansion of macro 'if' if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ ^ >> include/linux/rcupdate.h:594:2: note: in expansion of macro 'rcu_lockdep_assert' rcu_lockdep_assert(c, "suspicious rcu_dereference_protected() usage"); \ ^ include/linux/rcupdate.h:810:2: note: in expansion of macro '__rcu_dereference_protected' __rcu_dereference_protected((p), (c), __rcu) ^ kernel/fork.c:697:30: note: in expansion of macro 'rcu_dereference_protected' struct file *old_exe_file = rcu_dereference_protected(mm->exe_file, ^ In file included from include/linux/spinlock_types.h:18:0, from include/linux/spinlock.h:81, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from kernel/fork.c:14: include/linux/lockdep.h:341:12: note: expected 'struct lockdep_map *' but argument is of type 'struct rw_semaphore *' extern int lock_is_held(struct lockdep_map *lock); ^ In file included from include/linux/linkage.h:4:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from kernel/fork.c:14: kernel/fork.c:699:17: warning: passing argument 1 of 'lock_is_held' from incompatible pointer type lock_is_held(&mm->mmap_sem)); ^ include/linux/compiler.h:145:40: note: in definition of macro '__trace_if' if (__builtin_constant_p((cond)) ? !!(cond) : \ ^ include/linux/rcupdate.h:528:3: note: in expansion of macro 'if' if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ ^ >> include/linux/rcupdate.h:594:2: note: in expansion of macro 'rcu_lockdep_assert' rcu_lockdep_assert(c, "suspicious rcu_dereference_protected() usage"); \ ^ include/linux/rcupdate.h:810:2: note: in expansion of macro '__rcu_dereference_protected' __rcu_dereference_protected((p), (c), __rcu) ^ kernel/fork.c:697:30: note: in expansion of macro 'rcu_dereference_protected' struct file *old_exe_file = rcu_dereference_protected(mm->exe_file, ^ In file included from include/linux/spinlock_types.h:18:0, from include/linux/spinlock.h:81, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from kernel/fork.c:14: include/linux/lockdep.h:341:12: note: expected 'struct lockdep_map *' but argument is of type 'struct rw_semaphore *' extern int lock_is_held(struct lockdep_map *lock); ^ In file included from include/linux/linkage.h:4:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from kernel/fork.c:14: kernel/fork.c:699:17: warning: passing argument 1 of 'lock_is_held' from incompatible pointer type lock_is_held(&mm->mmap_sem)); ^ include/linux/compiler.h:156:16: note: in definition of macro '__trace_if' ______r = !!(cond); \ ^ include/linux/rcupdate.h:528:3: note: in expansion of macro 'if' if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ ^ >> include/linux/rcupdate.h:594:2: note: in expansion of macro 'rcu_lockdep_assert' rcu_lockdep_assert(c, "suspicious rcu_dereference_protected() usage"); \ ^ include/linux/rcupdate.h:810:2: note: in expansion of macro '__rcu_dereference_protected' __rcu_dereference_protected((p), (c), __rcu) ^ kernel/fork.c:697:30: note: in expansion of macro 'rcu_dereference_protected' struct file *old_exe_file = rcu_dereference_protected(mm->exe_file, ^ In file included from include/linux/spinlock_types.h:18:0, from include/linux/spinlock.h:81, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from kernel/fork.c:14: include/linux/lockdep.h:341:12: note: expected 'struct lockdep_map *' but argument is of type 'struct rw_semaphore *' extern int lock_is_held(struct lockdep_map *lock); ^ vim +/rcu_lockdep_assert +594 include/linux/rcupdate.h 4221a991 Tetsuo Handa 2010-06-26 522 * @c: condition to check b3fbab05 Paul E. McKenney 2011-05-24 523 * @s: informative message 4221a991 Tetsuo Handa 2010-06-26 524 */ b3fbab05 Paul E. McKenney 2011-05-24 525 #define rcu_lockdep_assert(c, s) \ 2b3fc35f Lai Jiangshan 2010-04-20 526 do { \ 7ccaba53 Jan Beulich 2012-03-23 527 static bool __section(.data.unlikely) __warned; \ 2b3fc35f Lai Jiangshan 2010-04-20 @528 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ 2b3fc35f Lai Jiangshan 2010-04-20 529 __warned = true; \ b3fbab05 Paul E. McKenney 2011-05-24 530 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ 2b3fc35f Lai Jiangshan 2010-04-20 531 } \ 2b3fc35f Lai Jiangshan 2010-04-20 532 } while (0) 2b3fc35f Lai Jiangshan 2010-04-20 533 50406b98 Paul E. McKenney 2012-01-12 534 #if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU) 50406b98 Paul E. McKenney 2012-01-12 535 static inline void rcu_preempt_sleep_check(void) 50406b98 Paul E. McKenney 2012-01-12 536 { 50406b98 Paul E. McKenney 2012-01-12 537 rcu_lockdep_assert(!lock_is_held(&rcu_lock_map), 5cf05ad7 Paul E. McKenney 2012-05-17 538 "Illegal context switch in RCU read-side critical section"); 50406b98 Paul E. McKenney 2012-01-12 539 } 50406b98 Paul E. McKenney 2012-01-12 540 #else /* #ifdef CONFIG_PROVE_RCU */ 50406b98 Paul E. McKenney 2012-01-12 541 static inline void rcu_preempt_sleep_check(void) 50406b98 Paul E. McKenney 2012-01-12 542 { 50406b98 Paul E. McKenney 2012-01-12 543 } 50406b98 Paul E. McKenney 2012-01-12 544 #endif /* #else #ifdef CONFIG_PROVE_RCU */ 50406b98 Paul E. McKenney 2012-01-12 545 b3fbab05 Paul E. McKenney 2011-05-24 546 #define rcu_sleep_check() \ b3fbab05 Paul E. McKenney 2011-05-24 547 do { \ 50406b98 Paul E. McKenney 2012-01-12 548 rcu_preempt_sleep_check(); \ b3fbab05 Paul E. McKenney 2011-05-24 549 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ 41f4abd9 Joe Perches 2013-12-05 550 "Illegal context switch in RCU-bh read-side critical section"); \ b3fbab05 Paul E. McKenney 2011-05-24 551 rcu_lockdep_assert(!lock_is_held(&rcu_sched_lock_map), \ 41f4abd9 Joe Perches 2013-12-05 552 "Illegal context switch in RCU-sched read-side critical section"); \ b3fbab05 Paul E. McKenney 2011-05-24 553 } while (0) b3fbab05 Paul E. McKenney 2011-05-24 554 ca5ecddf Paul E. McKenney 2010-04-28 555 #else /* #ifdef CONFIG_PROVE_RCU */ ca5ecddf Paul E. McKenney 2010-04-28 556 b3fbab05 Paul E. McKenney 2011-05-24 557 #define rcu_lockdep_assert(c, s) do { } while (0) b3fbab05 Paul E. McKenney 2011-05-24 558 #define rcu_sleep_check() do { } while (0) ca5ecddf Paul E. McKenney 2010-04-28 559 ca5ecddf Paul E. McKenney 2010-04-28 560 #endif /* #else #ifdef CONFIG_PROVE_RCU */ ca5ecddf Paul E. McKenney 2010-04-28 561 ca5ecddf Paul E. McKenney 2010-04-28 562 /* ca5ecddf Paul E. McKenney 2010-04-28 563 * Helper functions for rcu_dereference_check(), rcu_dereference_protected() ca5ecddf Paul E. McKenney 2010-04-28 564 * and rcu_assign_pointer(). Some of these could be folded into their ca5ecddf Paul E. McKenney 2010-04-28 565 * callers, but they are left separate in order to ease introduction of ca5ecddf Paul E. McKenney 2010-04-28 566 * multiple flavors of pointers to match the multiple flavors of RCU ca5ecddf Paul E. McKenney 2010-04-28 567 * (e.g., __rcu_bh, * __rcu_sched, and __srcu), should this make sense in ca5ecddf Paul E. McKenney 2010-04-28 568 * the future. ca5ecddf Paul E. McKenney 2010-04-28 569 */ 53ecfba2 Paul E. McKenney 2010-09-13 570 53ecfba2 Paul E. McKenney 2010-09-13 571 #ifdef __CHECKER__ 53ecfba2 Paul E. McKenney 2010-09-13 572 #define rcu_dereference_sparse(p, space) \ 53ecfba2 Paul E. McKenney 2010-09-13 573 ((void)(((typeof(*p) space *)p) == p)) 53ecfba2 Paul E. McKenney 2010-09-13 574 #else /* #ifdef __CHECKER__ */ 53ecfba2 Paul E. McKenney 2010-09-13 575 #define rcu_dereference_sparse(p, space) 53ecfba2 Paul E. McKenney 2010-09-13 576 #endif /* #else #ifdef __CHECKER__ */ 53ecfba2 Paul E. McKenney 2010-09-13 577 ca5ecddf Paul E. McKenney 2010-04-28 578 #define __rcu_access_pointer(p, space) \ ca5ecddf Paul E. McKenney 2010-04-28 579 ({ \ ca5ecddf Paul E. McKenney 2010-04-28 580 typeof(*p) *_________p1 = (typeof(*p) *__force)ACCESS_ONCE(p); \ 53ecfba2 Paul E. McKenney 2010-09-13 581 rcu_dereference_sparse(p, space); \ ca5ecddf Paul E. McKenney 2010-04-28 582 ((typeof(*p) __force __kernel *)(_________p1)); \ ca5ecddf Paul E. McKenney 2010-04-28 583 }) ca5ecddf Paul E. McKenney 2010-04-28 584 #define __rcu_dereference_check(p, c, space) \ ca5ecddf Paul E. McKenney 2010-04-28 585 ({ \ ac59853c Pranith Kumar 2014-11-13 586 /* Dependency order vs. p above. */ \ ac59853c Pranith Kumar 2014-11-13 587 typeof(*p) *________p1 = (typeof(*p) *__force)lockless_dereference(p); \ 41f4abd9 Joe Perches 2013-12-05 588 rcu_lockdep_assert(c, "suspicious rcu_dereference_check() usage"); \ 53ecfba2 Paul E. McKenney 2010-09-13 589 rcu_dereference_sparse(p, space); \ ac59853c Pranith Kumar 2014-11-13 590 ((typeof(*p) __force __kernel *)(________p1)); \ ca5ecddf Paul E. McKenney 2010-04-28 591 }) ca5ecddf Paul E. McKenney 2010-04-28 592 #define __rcu_dereference_protected(p, c, space) \ ca5ecddf Paul E. McKenney 2010-04-28 593 ({ \ 41f4abd9 Joe Perches 2013-12-05 @594 rcu_lockdep_assert(c, "suspicious rcu_dereference_protected() usage"); \ 53ecfba2 Paul E. McKenney 2010-09-13 595 rcu_dereference_sparse(p, space); \ ca5ecddf Paul E. McKenney 2010-04-28 596 ((typeof(*p) __force __kernel *)(p)); \ ca5ecddf Paul E. McKenney 2010-04-28 597 }) :::::: The code at line 594 was first introduced by commit :::::: 41f4abd92a34f9c5110bbb870c04f8854604e28d rcu: Glue ASCII strings together :::::: TO: Joe Perches :::::: CC: Paul E. McKenney --- 0-DAY kernel test infrastructure Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation