All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhouyi Zhou <zhouzhouyi@gmail.com>
To: paulmck@kernel.org
Cc: Matthew Wilcox <willy@infradead.org>,
	Oleksandr Natalenko <oleksandr@natalenko.name>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org, Chris Clayton <chris2553@googlemail.com>,
	Chris Rankin <rankincj@gmail.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	rcu <rcu@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: linux-5.13.2: warning from kernel/rcu/tree_plugin.h:359
Date: Mon, 19 Jul 2021 10:27:43 +0800	[thread overview]
Message-ID: <CAABZP2yrK-Jqg2m8zWrBbRTMk7wF4dfwG=Dou_qCDDpgB9XBqA@mail.gmail.com> (raw)
In-Reply-To: <CAABZP2yE+3vzd+LgJDJcJ2f8qttJQSUQ6efD9MaFd2iD4xPTZA@mail.gmail.com>

On Mon, Jul 19, 2021 at 10:24 AM Zhouyi Zhou <zhouzhouyi@gmail.com> wrote:
>
> On Mon, Jul 19, 2021 at 9:53 AM Paul E. McKenney <paulmck@kernel.org> wrote:
> >
> > On Sun, Jul 18, 2021 at 11:51:36PM +0100, Matthew Wilcox wrote:
> > > On Sun, Jul 18, 2021 at 02:59:14PM -0700, Paul E. McKenney wrote:
> > > > > > https://lore.kernel.org/lkml/CAK2bqVK0Q9YcpakE7_Rc6nr-E4e2GnMOgi5jJj=_Eh_1k
> > > > > > EHLHA@mail.gmail.com/
> > > >
> > > > But this one does show this warning in v5.12.17:
> > > >
> > > >     WARN_ON_ONCE(!preempt && rcu_preempt_depth() > 0);
> > > >
> > > > This is in rcu_note_context_switch(), and could be caused by something
> > > > like a schedule() within an RCU read-side critical section.  This would
> > > > of course be RCU-usage bugs, given that you are not permitted to block
> > > > within an RCU read-side critical section.
> > > >
> > > > I suggest checking the functions in the stack trace to see where the
> > > > rcu_read_lock() is hiding.  CONFIG_PROVE_LOCKING might also be helpful.
> > >
> > > I'm not sure I see it in this stack trace.
> > >
> > > Is it possible that there's something taking the rcu read lock in an
> > > interrupt handler, then returning from the interrupt handler without
> > > releasing the rcu lock?  Do we have debugging that would fire if
> > > somebody did this?
> >
> > Lockdep should complain, but in the absence of lockdep I don't know
> > that anything would gripe in this situation.
> I think Lockdep should complain.
> Meanwhile, I examined the 5.12.17 by naked eye, and found a suspicious place
I examined 5.13.2 the unpaired rcu_read_lock is still there
> that could possibly trigger that problem:
>
> struct swap_info_struct *get_swap_device(swp_entry_t entry)
> {
>      struct swap_info_struct *si;
>      unsigned long offset;
>
>      if (!entry.val)
>              goto out;
>     si = swp_swap_info(entry);
>     if (!si)
>        goto bad_nofile;
>
>    rcu_read_lock();
>   if (data_race(!(si->flags & SWP_VALID)))
>      goto unlock_out;
>   offset = swp_offset(entry);
>   if (offset >= si->max)
>    goto unlock_out;
>
>   return si;
> bad_nofile:
>   pr_err("%s: %s%08lx\n", __func__, Bad_file, entry.val);
> out:
>   return NULL;
> unlock_out:
>   rcu_read_unlock();
>   return NULL;
> }
> I guess the function "return si" without a rcu_read_unlock.
>
> However the get_swap_device has changed in the mainline tree,
> there is no rcu_read_lock anymore.
>
> >
> > Also, this is a preemptible kernel, so it is possible to trace
> > __rcu_read_lock(), if that helps.
> >
> >                                                         Thanx, Paul
> Thanx
> Zhouyi

  reply	other threads:[~2021-07-19  2:27 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17 20:22 linux-5.13.2: warning from kernel/rcu/tree_plugin.h:359 Chris Clayton
2021-07-18  6:18 ` Fwd: " Chris Clayton
2021-07-18 21:01 ` Oleksandr Natalenko
2021-07-18 21:03   ` Oleksandr Natalenko
2021-07-18 21:22     ` Matthew Wilcox
2021-07-18 21:36       ` Chris Clayton
2021-07-18 21:59     ` Paul E. McKenney
2021-07-18 22:51       ` Matthew Wilcox
2021-07-19  1:53         ` Paul E. McKenney
2021-07-19  2:24           ` Zhouyi Zhou
2021-07-19  2:24             ` Zhouyi Zhou
2021-07-19  2:27             ` Zhouyi Zhou [this message]
2021-07-19  2:27               ` Zhouyi Zhou
2021-07-19  2:43             ` Matthew Wilcox
2021-07-19  2:59               ` Zhouyi Zhou
2021-07-19  2:59                 ` Zhouyi Zhou
2021-07-19 10:14               ` Boqun Feng
2021-07-19 11:12                 ` Miaohe Lin
2021-07-19 11:17                   ` Oleksandr Natalenko
2021-07-19 11:22                   ` Matthew Wilcox
2021-07-19 11:50                     ` Miaohe Lin
2021-07-19 11:59                       ` Oleksandr Natalenko
2021-07-19 12:08                         ` Miaohe Lin
2021-07-19 12:12                           ` Oleksandr Natalenko
2021-07-19 12:16                             ` Matthew Wilcox
2021-07-19 12:23                               ` Oleksandr Natalenko
2021-07-19 16:47                                 ` Zhouyi Zhou
2021-07-19 16:47                                   ` Zhouyi Zhou
2021-07-19 16:56                                   ` Zhouyi Zhou
2021-07-19 16:56                                     ` Zhouyi Zhou
2021-07-22  7:30                                     ` Chris Clayton
2021-07-22  8:57                                       ` Zhouyi Zhou
2021-07-22  8:57                                         ` Zhouyi Zhou
2021-07-22 12:36                                         ` Matthew Wilcox
2021-07-22 13:26                                           ` Greg KH
2021-07-22 14:00                                             ` Greg KH
2021-07-23  1:51                                               ` Miaohe Lin
2021-07-23  7:02                                                 ` Greg KH
2021-07-23  7:13                                                   ` Miaohe Lin
2021-07-22 17:44                                           ` Zhouyi Zhou
2021-07-22 17:44                                             ` Zhouyi Zhou
2021-07-22 14:05                                       ` Paul E. McKenney
2021-07-19 12:17                             ` Miaohe Lin
2021-07-19  7:32       ` Chris Clayton

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='CAABZP2yrK-Jqg2m8zWrBbRTMk7wF4dfwG=Dou_qCDDpgB9XBqA@mail.gmail.com' \
    --to=zhouzhouyi@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris2553@googlemail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=oleksandr@natalenko.name \
    --cc=paulmck@kernel.org \
    --cc=rankincj@gmail.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.