• Qian Cai's avatar
    mm/mmu_notifier: silence PROVE_RCU_LIST warnings · 63886bad
    Qian Cai authored
    It is safe to traverse mm->notifier_subscriptions->list either under
    SRCU read lock or mm->notifier_subscriptions->lock using
    hlist_for_each_entry_rcu().  Silence the PROVE_RCU_LIST false positives,
    for example,
    
      WARNING: suspicious RCU usage
      -----------------------------
      mm/mmu_notifier.c:484 RCU-list traversed in non-reader section!!
    
      other info that might help us debug this:
    
      rcu_scheduler_active = 2, debug_locks = 1
      3 locks held by libvirtd/802:
       #0: ffff9321e3f58148 (&mm->mmap_sem#2){++++}, at: do_mprotect_pkey+0xe1/0x3e0
       #1: ffffffff91ae6160 (mmu_notifier_invalidate_range_start){+.+.}, at: change_p4d_range+0x5fa/0x800
       #2: ffffffff91ae6e08 (srcu){....}, at: __mmu_notifier_invalidate_range_start+0x178/0x460
    
      stack backtrace:
      CPU: 7 PID: 802 Comm: libvirtd Tainted: G          I       5.6.0-rc6-next-20200317+ #2
      Hardware name: HP ProLiant BL460c Gen8, BIOS I31 11/02/2014
      Call Trace:
        dump_stack+0xa4/0xfe
        lockdep_rcu_suspicious+0xeb/0xf5
        __mmu_notifier_invalidate_range_start+0x3ff/0x460
        change_p4d_range+0x746/0x800
        change_protection+0x1df/0x300
        mprotect_fixup+0x245/0x3e0
        do_mprotect_pkey+0x23b/0x3e0
        __x64_sys_mprotect+0x51/0x70
        do_syscall_64+0x91/0xae8
        entry_SYSCALL_64_after_hwframe+0x49/0xb3
    Signed-off-by: default avatarQian Cai <cai@lca.pw>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Reviewed-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    Reviewed-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    Link: http://lkml.kernel.org/r/20200317175640.2047-1-cai@lca.pwSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    63886bad
mmu_notifier.c 34.5 KB