linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Qian Cai <cai@lca.pw>
Cc: akpm@linux-foundation.org, paulmck@kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmu_notifier: silence PROVE_RCU_LIST warnings
Date: Wed, 18 Mar 2020 09:13:26 -0300	[thread overview]
Message-ID: <20200318121326.GZ20941@ziepe.ca> (raw)
In-Reply-To: <20200317175640.2047-1-cai@lca.pw>

On Tue, Mar 17, 2020 at 01:56:40PM -0400, Qian Cai wrote:
> 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: Qian Cai <cai@lca.pw>
> ---
>  mm/mmu_notifier.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)

Looks right to me

Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>

This was missed during testing because we don't run with
PROVE_RCU_LIST enabled

Jason


      parent reply	other threads:[~2020-03-18 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 17:56 [PATCH] mm/mmu_notifier: silence PROVE_RCU_LIST warnings Qian Cai
2020-03-17 18:06 ` Paul E. McKenney
2020-03-18 12:13 ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200318121326.GZ20941@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=paulmck@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).